Added qweechat

This commit is contained in:
emdee 2022-11-20 01:11:51 +00:00
parent 1e5618060a
commit f1d8ce105c
56 changed files with 312 additions and 339 deletions

1
.gitignore vendored
View file

@ -26,4 +26,3 @@ Toxygen.egg-info
.cache .cache
*.db *.db
*.junk

View file

@ -55,5 +55,12 @@ is making a dependency. Just download it and copy the two directories
See ToDo.md to the current ToDo list. See ToDo.md to the current ToDo list.
If you install https://github.com/weechat/qweechat
you can have IRC and jabber in a window too. Start
[weechat](https://github.com/weechat/weechat) and
```
/relay weechat 9000 password
```
Work on this project is suspended until the Work on this project is suspended until the
[MultiDevice](https://git.plastiras.org/emdee/tox_profile/wiki/MultiDevice-Announcements-POC) problem is solved. Fork me! [MultiDevice](https://git.plastiras.org/emdee/tox_profile/wiki/MultiDevice-Announcements-POC) problem is solved. Fork me!

View file

@ -1,19 +1,18 @@
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*- # -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
import os import os
import sys import sys
import threading
import traceback import traceback
from random import shuffle from random import shuffle
import threading
from time import sleep from time import sleep
from gevent import monkey; monkey.patch_all(); del monkey # noqa
import gevent import gevent
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5 import QtWidgets, QtGui, QtCore
from qtpy.QtCore import QTimer from qtpy.QtCore import QTimer
from qtpy.QtWidgets import QApplication from qtpy.QtWidgets import QApplication
from gevent import monkey; monkey.patch_all(); del monkey # noqa
try: try:
import coloredlogs import coloredlogs
if 'COLOREDLOGS_LEVEL_STYLES' not in os.environ: if 'COLOREDLOGS_LEVEL_STYLES' not in os.environ:
@ -22,27 +21,29 @@ try:
except ImportError as e: except ImportError as e:
coloredlogs = False coloredlogs = False
try: # install https://github.com/weechat/qweechat
# https://github.com/pyqtconsole/pyqtconsole # if you want IRC and jabber
from pyqtconsole.console import PythonConsole
except Exception as e:
PythonConsole = None
try:
import qdarkstylexxx
except ImportError:
qdarkstyle = None
import wrapper_tests.support_testing as ts
from middleware import threads
import middleware.callbacks as callbacks import middleware.callbacks as callbacks
import styles.style # TODO: dynamic loading
import ui.password_screen as password_screen
import updater.updater as updater import updater.updater as updater
from middleware.tox_factory import tox_factory
import wrapper.toxencryptsave as tox_encrypt_save
import user_data.toxes import user_data.toxes
from user_data import settings
from user_data.settings import get_user_config_path, merge_args_into_settings
from user_data.settings import Settings
from user_data.profile_manager import ProfileManager
from plugin_support.plugin_support import PluginLoader
import ui.password_screen as password_screen
from ui.login_screen import LoginScreen
from ui.main_screen import MainWindow
from ui import tray
import utils.ui as util_ui import utils.ui as util_ui
import utils.util as util import utils.util as util
import wrapper.toxencryptsave as tox_encrypt_save
from av.calls_manager import CallsManager from av.calls_manager import CallsManager
from common.provider import Provider from common.provider import Provider
from contacts.contact_provider import ContactProvider from contacts.contact_provider import ContactProvider
@ -52,32 +53,23 @@ from contacts.group_factory import GroupFactory
from contacts.group_peer_factory import GroupPeerFactory from contacts.group_peer_factory import GroupPeerFactory
from contacts.profile import Profile from contacts.profile import Profile
from file_transfers.file_transfers_handler import FileTransfersHandler from file_transfers.file_transfers_handler import FileTransfersHandler
from file_transfers.file_transfers_messages_service import \ from file_transfers.file_transfers_messages_service import FileTransfersMessagesService
FileTransfersMessagesService
from groups.groups_service import GroupsService from groups.groups_service import GroupsService
from history.database import Database from history.database import Database
from history.history import History from history.history import History
from messenger.messenger import Messenger from messenger.messenger import Messenger
from middleware import threads
from middleware.tox_factory import tox_factory
from network.tox_dns import ToxDns from network.tox_dns import ToxDns
from plugin_support.plugin_support import PluginLoader
from smileys.smileys import SmileyLoader from smileys.smileys import SmileyLoader
from ui import tray
from ui.create_profile_screen import CreateProfileScreen from ui.create_profile_screen import CreateProfileScreen
from ui.items_factories import ContactItemsFactory, MessagesItemsFactory from ui.items_factories import MessagesItemsFactory, ContactItemsFactory
from ui.login_screen import LoginScreen
from ui.main_screen import MainWindow
from ui.widgets_factory import WidgetsFactory from ui.widgets_factory import WidgetsFactory
from user_data import settings
from user_data.backup_service import BackupService from user_data.backup_service import BackupService
from user_data.profile_manager import ProfileManager import styles.style # TODO: dynamic loading
from user_data.settings import (Settings, get_user_config_path,
merge_args_into_settings) import wrapper_tests.support_testing as ts
global LOG global LOG
import logging import logging
LOG = logging.getLogger('app') LOG = logging.getLogger('app')
IDLE_PERIOD = 0.10 IDLE_PERIOD = 0.10
@ -148,8 +140,6 @@ sSTYLE = """
.QToolBar { font-weight: bold; } .QToolBar { font-weight: bold; }
""" """
from copy import deepcopy from copy import deepcopy
class App: class App:
def __init__(self, version, oArgs): def __init__(self, version, oArgs):
@ -287,7 +277,7 @@ class App:
self._app.quit() self._app.quit()
del self._app.quit del self._app.quit
del self._app del self._app
sys.stderr.write('quit raising SystemExit' +'\n') sys.stderr.write('quit raising SystemExit' +'\n')
# hanging on gevents # hanging on gevents
# Thread 1 "python3.9" received signal SIGSEGV, Segmentation fault. # Thread 1 "python3.9" received signal SIGSEGV, Segmentation fault.
@ -311,7 +301,7 @@ class App:
if hasattr(self, '_tray') and self._tray: if hasattr(self, '_tray') and self._tray:
self._tray.hide() self._tray.hide()
self._settings.close() self._settings.close()
LOG.debug(f"stop_app: Killing {self._tox}") LOG.debug(f"stop_app: Killing {self._tox}")
self._kill_toxav() self._kill_toxav()
self._kill_tox() self._kill_tox()

View file

@ -1,22 +1,22 @@
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*- # -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
import itertools
import threading
import time
import pyaudio import pyaudio
import wrapper_tests.support_testing as ts import time
import threading
import itertools
import common.tox_save from wrapper.toxav_enums import *
from av import screen_sharing from av import screen_sharing
from av.call import Call from av.call import Call
from main import sleep import common.tox_save
from middleware.threads import BaseThread, invoke_in_main_thread
from utils import ui as util_ui from utils import ui as util_ui
from wrapper.toxav_enums import * import wrapper_tests.support_testing as ts
from middleware.threads import invoke_in_main_thread
from main import sleep
from middleware.threads import BaseThread
global LOG global LOG
import logging import logging
LOG = logging.getLogger('app.'+__name__) LOG = logging.getLogger('app.'+__name__)
# callbacks can be called in any thread so were being careful # callbacks can be called in any thread so were being careful
def LOG_ERROR(l): print('EROR< '+l) def LOG_ERROR(l): print('EROR< '+l)
@ -405,7 +405,7 @@ class AV(common.tox_save.ToxAvSave):
if self._calls[friend_num].out_audio: if self._calls[friend_num].out_audio:
try: try:
# app.av.calls ERROR Error send_audio: One of the frame parameters was invalid. E.g. the resolution may be too small or too large, or the audio sampling rate may be unsupported # app.av.calls ERROR Error send_audio: One of the frame parameters was invalid. E.g. the resolution may be too small or too large, or the audio sampling rate may be unsupported
# app.av.calls ERROR Error send_audio audio_send_frame: This client is currently not in a call with the friend. # app.av.calls ERROR Error send_audio audio_send_frame: This client is currently not in a call with the friend.
self._toxav.audio_send_frame(friend_num, self._toxav.audio_send_frame(friend_num,
pcm, pcm,
count, count,

View file

@ -4,14 +4,13 @@ import sys
import threading import threading
import av.calls import av.calls
import common.event as event
import utils.ui as util_ui
from messenger.messages import * from messenger.messages import *
from ui import av_widgets from ui import av_widgets
import common.event as event
import utils.ui as util_ui
global LOG global LOG
import logging import logging
LOG = logging.getLogger('app.'+__name__) LOG = logging.getLogger('app.'+__name__)
class CallsManager: class CallsManager:

View file

@ -1,34 +1,29 @@
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*- # -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
import random import random
import urllib.request import urllib.request
from PyQt5 import QtCore, QtNetwork
from utils.util import * from utils.util import *
from PyQt5 import QtNetwork
from PyQt5 import QtCore
try: try:
from io import BytesIO
import certifi import certifi
from io import BytesIO
except ImportError: except ImportError:
certifi = None certifi = None
import wrapper_tests.support_testing as ts
from wrapper_tests.support_http import download_url
from wrapper_tests.support_testing import _get_nodes_path
from user_data.settings import get_user_config_path from user_data.settings import get_user_config_path
from wrapper_tests.support_testing import _get_nodes_path
from wrapper_tests.support_http import download_url
import wrapper_tests.support_testing as ts
global LOG global LOG
import logging import logging
LOG = logging.getLogger('app.'+'bootstrap') LOG = logging.getLogger('app.'+'bootstrap')
def download_nodes_list(settings, oArgs): def download_nodes_list(settings, oArgs):
if not settings['download_nodes_list']: if not settings['download_nodes_list']:
return '' return ''
if not ts.bAreWeConnected(): if not ts.bAreWeConnected():
return '' return ''
url = settings['download_nodes_url'] url = settings['download_nodes_url']
path = _get_nodes_path(oArgs=oArgs) path = _get_nodes_path(oArgs=oArgs)
# dont download blindly so we can edit the file and not block on startup # dont download blindly so we can edit the file and not block on startup

View file

@ -1,11 +1,10 @@
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*- # -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
from user_data.settings import *
from PyQt5 import QtCore, QtGui from PyQt5 import QtCore, QtGui
from wrapper.toxcore_enums_and_consts import TOX_PUBLIC_KEY_SIZE
import utils.util as util
import common.event as event import common.event as event
import contacts.common as common import contacts.common as common
import utils.util as util
from user_data.settings import *
from wrapper.toxcore_enums_and_consts import TOX_PUBLIC_KEY_SIZE
class BaseContact: class BaseContact:

View file

@ -1,16 +1,16 @@
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*- # -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
import re from history.database import TIMEOUT, \
SAVE_MESSAGES, MESSAGE_AUTHOR
from contacts import basecontact, common from contacts import basecontact, common
from messenger.messages import *
from contacts.contact_menu import * from contacts.contact_menu import *
from file_transfers import file_transfers as ft from file_transfers import file_transfers as ft
from history.database import MESSAGE_AUTHOR, SAVE_MESSAGES, TIMEOUT import re
from messenger.messages import *
# LOG=util.log # LOG=util.log
global LOG global LOG
import logging import logging
LOG = logging.getLogger('app.'+__name__) LOG = logging.getLogger('app.'+__name__)
class Contact(basecontact.BaseContact): class Contact(basecontact.BaseContact):

View file

@ -6,7 +6,6 @@ from wrapper.toxcore_enums_and_consts import *
global LOG global LOG
import logging import logging
LOG = logging.getLogger('app') LOG = logging.getLogger('app')
# ----------------------------------------------------------------------------------------------------------------- # -----------------------------------------------------------------------------------------------------------------

View file

@ -4,7 +4,6 @@ import common.tox_save as tox_save
global LOG global LOG
import logging import logging
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
# callbacks can be called in any thread so were being careful # callbacks can be called in any thread so were being careful

View file

@ -2,17 +2,16 @@
import traceback import traceback
from common.tox_save import ToxSave
from contacts.friend import Friend from contacts.friend import Friend
from contacts.group_chat import GroupChat from contacts.group_chat import GroupChat
from messenger.messages import *
from common.tox_save import ToxSave
from contacts.group_peer_contact import GroupPeerContact from contacts.group_peer_contact import GroupPeerContact
from groups.group_peer import GroupChatPeer from groups.group_peer import GroupChatPeer
from messenger.messages import *
# LOG=util.log # LOG=util.log
global LOG global LOG
import logging import logging
LOG = logging.getLogger('app.'+__name__) LOG = logging.getLogger('app.'+__name__)
def LOG_ERROR(l): print('ERROR_: '+l) def LOG_ERROR(l): print('ERROR_: '+l)

View file

@ -1,8 +1,7 @@
import os from contacts import contact, common
from contacts import common, contact
from contacts.contact_menu import *
from messenger.messages import * from messenger.messages import *
import os
from contacts.contact_menu import *
class Friend(contact.Contact): class Friend(contact.Contact):

View file

@ -1,16 +1,15 @@
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*- # -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
import utils.util as util
from common.tox_save import ToxSave
from contacts import contact from contacts import contact
from contacts.contact_menu import GroupMenuGenerator from contacts.contact_menu import GroupMenuGenerator
from groups.group_ban import GroupBan import utils.util as util
from groups.group_peer import GroupChatPeer from groups.group_peer import GroupChatPeer
from wrapper import toxcore_enums_and_consts as constants from wrapper import toxcore_enums_and_consts as constants
from common.tox_save import ToxSave
from groups.group_ban import GroupBan
global LOG global LOG
import logging import logging
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
def LOG_ERROR(l): print('ERROR_: '+l) def LOG_ERROR(l): print('ERROR_: '+l)
def LOG_WARN(l): print('WARN_: '+l) def LOG_WARN(l): print('WARN_: '+l)

View file

@ -1,12 +1,11 @@
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*- # -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
import wrapper.toxcore_enums_and_consts as constants
from common.tox_save import ToxSave
from contacts.group_chat import GroupChat from contacts.group_chat import GroupChat
from common.tox_save import ToxSave
import wrapper.toxcore_enums_and_consts as constants
global LOG global LOG
import logging import logging
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
class GroupFactory(ToxSave): class GroupFactory(ToxSave):
@ -20,7 +19,7 @@ class GroupFactory(ToxSave):
def create_group_by_chat_id(self, chat_id): def create_group_by_chat_id(self, chat_id):
return self.create_group_by_public_key(chat_id) return self.create_group_by_public_key(chat_id)
def create_group_by_public_key(self, public_key): def create_group_by_public_key(self, public_key):
group_number = self._get_group_number_by_chat_id(public_key) group_number = self._get_group_number_by_chat_id(public_key)
return self.create_group_by_number(group_number) return self.create_group_by_number(group_number)

View file

@ -1,16 +1,14 @@
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*- # -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
from contacts import basecontact
import random import random
import threading import threading
import common.tox_save as tox_save import common.tox_save as tox_save
from contacts import basecontact
from middleware.threads import invoke_in_main_thread from middleware.threads import invoke_in_main_thread
iUMAXINT = 4294967295 iUMAXINT = 4294967295
global LOG global LOG
import logging import logging
LOG = logging.getLogger('app.'+__name__) LOG = logging.getLogger('app.'+__name__)
class Profile(basecontact.BaseContact, tox_save.ToxSave): class Profile(basecontact.BaseContact, tox_save.ToxSave):

View file

@ -1,17 +1,14 @@
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*- # -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
from copy import deepcopy
from wrapper_tests.support_testing import assert_main_thread
import utils.util as util
from common.tox_save import ToxSave
from messenger.messages import * from messenger.messages import *
from ui.contact_items import * from ui.contact_items import *
import utils.util as util
from common.tox_save import ToxSave
from wrapper_tests.support_testing import assert_main_thread
from copy import deepcopy
# LOG=util.log # LOG=util.log
global LOG global LOG
import logging import logging
LOG = logging.getLogger('app.'+__name__) LOG = logging.getLogger('app.'+__name__)
log = lambda x: LOG.info(x) log = lambda x: LOG.info(x)

View file

@ -1,10 +1,9 @@
from messenger.messenger import *
import utils.util as util import utils.util as util
from file_transfers.file_transfers import * from file_transfers.file_transfers import *
from messenger.messenger import *
global LOG global LOG
import logging import logging
LOG = logging.getLogger('app.'+__name__) LOG = logging.getLogger('app.'+__name__)
def LOG_ERROR(l): print('ERROR_: '+l) def LOG_ERROR(l): print('ERROR_: '+l)

View file

@ -2,15 +2,14 @@
import common.tox_save as tox_save import common.tox_save as tox_save
import utils.ui as util_ui import utils.ui as util_ui
import wrapper.toxcore_enums_and_consts as constants
from groups.group_invite import GroupInvite
from groups.peers_list import PeersListGenerator from groups.peers_list import PeersListGenerator
from wrapper.tox import UINT32_MAX from groups.group_invite import GroupInvite
import wrapper.toxcore_enums_and_consts as constants
from wrapper.toxcore_enums_and_consts import * from wrapper.toxcore_enums_and_consts import *
from wrapper.tox import UINT32_MAX
global LOG global LOG
import logging import logging
LOG = logging.getLogger('app.'+'gs') LOG = logging.getLogger('app.'+'gs')
class GroupsService(tox_save.ToxSave): class GroupsService(tox_save.ToxSave):

View file

@ -1,6 +1,7 @@
from ui.group_peers_list import PeerItem, PeerTypeItem from ui.group_peers_list import PeerItem, PeerTypeItem
from ui.widgets import *
from wrapper.toxcore_enums_and_consts import * from wrapper.toxcore_enums_and_consts import *
from ui.widgets import *
# ----------------------------------------------------------------------------------------------------------------- # -----------------------------------------------------------------------------------------------------------------
# Builder # Builder

View file

@ -1,12 +1,10 @@
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*- # -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
import os.path
from sqlite3 import connect from sqlite3 import connect
import os.path
import utils.util as util import utils.util as util
global LOG global LOG
import logging import logging
LOG = logging.getLogger('app.db') LOG = logging.getLogger('app.db')
TIMEOUT = 11 TIMEOUT = 11

View file

@ -3,7 +3,6 @@ from history.history_logs_generators import *
global LOG global LOG
import logging import logging
LOG = logging.getLogger('app.db') LOG = logging.getLogger('app.db')
class History: class History:
@ -67,7 +66,7 @@ class History:
with open(file_name, 'wt') as fl: with open(file_name, 'wt') as fl:
fl.write(history) fl.write(history)
LOG.info(f"wrote history to {file_name}") LOG.info(f"wrote history to {file_name}")
def delete_message(self, message): def delete_message(self, message):
contact = self._contacts_manager.get_curr_contact() contact = self._contacts_manager.get_curr_contact()
if message.type in (MESSAGE_TYPE['TEXT'], MESSAGE_TYPE['ACTION']): if message.type in (MESSAGE_TYPE['TEXT'], MESSAGE_TYPE['ACTION']):

View file

@ -1,24 +1,21 @@
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*- # -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
import argparse
import faulthandler
import logging
import os
import signal
import sys import sys
import os
import app import app
import argparse
import logging
import signal
import faulthandler
faulthandler.enable() faulthandler.enable()
import warnings import warnings
warnings.filterwarnings('ignore') warnings.filterwarnings('ignore')
import wrapper_tests.support_testing as ts import wrapper_tests.support_testing as ts
try: try:
from trepan.api import debug
from trepan.interfaces import server as Mserver from trepan.interfaces import server as Mserver
from trepan.api import debug
except: except:
print('trepan3 TCP server NOT enabled.') print('trepan3 TCP server NOT enabled.')
else: else:
@ -28,11 +25,10 @@ else:
print('trepan3 TCP server enabled on port 6666.') print('trepan3 TCP server enabled on port 6666.')
except: pass except: pass
import utils.util as util
from user_data import settings
from user_data.settings import * from user_data.settings import *
from user_data.settings import Settings from user_data.settings import Settings
from user_data import settings
import utils.util as util
with ts.ignoreStderr(): with ts.ignoreStderr():
import pyaudio import pyaudio
@ -40,7 +36,6 @@ __maintainer__ = 'Ingvar'
__version__ = '0.5.0+' __version__ = '0.5.0+'
import time import time
sleep = time.sleep sleep = time.sleep
def reset(): def reset():
@ -358,14 +353,7 @@ def main(lArgs):
if getattr(default_ns, key) == getattr(oArgs, key): if getattr(default_ns, key) == getattr(oArgs, key):
delattr(oArgs, key) delattr(oArgs, key)
for key in ts.lBOOLEANS: ts.clean_booleans(oArgs)
if not hasattr(oArgs, key): continue
val = getattr(oArgs, key)
if type(val) == bool: continue
if val in ['False', 'false', '0']:
setattr(oArgs, key, False)
else:
setattr(oArgs, key, True)
aArgs = A() aArgs = A()
for key in oArgs.__dict__.keys(): for key in oArgs.__dict__.keys():

View file

@ -1,14 +1,13 @@
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*- # -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
from wrapper_tests.support_testing import assert_main_thread
import common.tox_save as tox_save import common.tox_save as tox_save
import utils.ui as util_ui import utils.ui as util_ui
from messenger.messages import * from messenger.messages import *
from wrapper_tests.support_testing import assert_main_thread
from wrapper.toxcore_enums_and_consts import TOX_MAX_MESSAGE_LENGTH from wrapper.toxcore_enums_and_consts import TOX_MAX_MESSAGE_LENGTH
global LOG global LOG
import logging import logging
LOG = logging.getLogger('app.'+__name__) LOG = logging.getLogger('app.'+__name__)
log = lambda x: LOG.info(x) log = lambda x: LOG.info(x)
@ -31,7 +30,7 @@ class Messenger(tox_save.ToxSave):
def __repr__(self): def __repr__(self):
return "<Messenger>" return "<Messenger>"
def get_last_message(self): def get_last_message(self):
contact = self._contacts_manager.get_curr_contact() contact = self._contacts_manager.get_curr_contact()
if contact is None: if contact is None:
@ -90,7 +89,7 @@ class Messenger(tox_save.ToxSave):
text = 'Error: ' + str(e) text = 'Error: ' + str(e)
assert_main_thread() assert_main_thread()
util_ui.message_box(text, title) util_ui.message_box(text, title)
def send_message_to_friend(self, text, message_type, friend_number=None): def send_message_to_friend(self, text, message_type, friend_number=None):
""" """
Send message Send message
@ -201,7 +200,7 @@ class Messenger(tox_save.ToxSave):
return return
if peer_id and peer_id < 0: if peer_id and peer_id < 0:
return return
assert_main_thread() assert_main_thread()
# FixMe: peer_id is None? # FixMe: peer_id is None?
group_peer_contact = self._contacts_manager.get_or_create_group_peer_contact(group_number, peer_id) group_peer_contact = self._contacts_manager.get_or_create_group_peer_contact(group_number, peer_id)

View file

@ -1,19 +1,17 @@
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*- # -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
import os
import sys import sys
import os
import threading import threading
from datetime import datetime
from PyQt5 import QtGui from PyQt5 import QtGui
from wrapper.toxcore_enums_and_consts import *
from wrapper.toxav_enums import *
from wrapper.tox import bin_to_string
import utils.ui as util_ui import utils.ui as util_ui
import utils.util as util import utils.util as util
from middleware.threads import execute, invoke_in_main_thread from middleware.threads import invoke_in_main_thread, execute
from notifications.sound import *
from notifications.tray import tray_notification from notifications.tray import tray_notification
from wrapper.tox import bin_to_string from notifications.sound import *
from wrapper.toxav_enums import * from datetime import datetime
from wrapper.toxcore_enums_and_consts import *
iMAX_INT32 = 4294967295 iMAX_INT32 = 4294967295
# callbacks can be called in any thread so were being careful # callbacks can be called in any thread so were being careful

View file

@ -1,23 +1,21 @@
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*- # -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
import queue
import sys import sys
import threading import threading
import time import queue
import wrapper_tests.support_testing as ts
from PyQt5 import QtCore from PyQt5 import QtCore
from bootstrap.bootstrap import * from bootstrap.bootstrap import *
from bootstrap.bootstrap import download_nodes_list from bootstrap.bootstrap import download_nodes_list
from wrapper.toxcore_enums_and_consts import TOX_USER_STATUS, TOX_CONNECTION
import wrapper_tests.support_testing as ts
from utils import util from utils import util
from wrapper.toxcore_enums_and_consts import TOX_CONNECTION, TOX_USER_STATUS
import time
sleep = time.sleep sleep = time.sleep
# LOG=util.log # LOG=util.log
global LOG global LOG
import logging import logging
LOG = logging.getLogger('app.'+'threads') LOG = logging.getLogger('app.'+'threads')
# log = lambda x: LOG.info(x) # log = lambda x: LOG.info(x)
@ -124,7 +122,7 @@ class ToxIterateThread(BaseQThread):
super().__init__() super().__init__()
self._tox = tox self._tox = tox
self._app = app self._app = app
def run(self): def run(self):
LOG_DEBUG('ToxIterateThread run: ') LOG_DEBUG('ToxIterateThread run: ')
while not self._stop_thread: while not self._stop_thread:
@ -136,15 +134,14 @@ class ToxIterateThread(BaseQThread):
LOG_ERROR(f"ToxIterateThread run: {e}") LOG_ERROR(f"ToxIterateThread run: {e}")
else: else:
sleep(iMsec / 1000.0) sleep(iMsec / 1000.0)
global iLAST_CONN global iLAST_CONN
if not iLAST_CONN: if not iLAST_CONN:
iLAST_CONN = time.time() iLAST_CONN = time.time()
# TRAC> TCP_common.c#203:read_TCP_packet recv buffer has 0 bytes, but requested 10 bytes # TRAC> TCP_common.c#203:read_TCP_packet recv buffer has 0 bytes, but requested 10 bytes
# and segv # and segv
if \ if time.time() - iLAST_CONN > iLAST_DELTA and \
time.time() - iLAST_CONN > iLAST_DELTA and \
ts.bAreWeConnected() and \ ts.bAreWeConnected() and \
self._tox.self_get_status() == TOX_USER_STATUS['NONE'] and \ self._tox.self_get_status() == TOX_USER_STATUS['NONE'] and \
self._tox.self_get_connection_status() == TOX_CONNECTION['NONE']: self._tox.self_get_connection_status() == TOX_CONNECTION['NONE']:
@ -152,7 +149,7 @@ class ToxIterateThread(BaseQThread):
LOG_INFO(f"ToxIterateThread calling test_net") LOG_INFO(f"ToxIterateThread calling test_net")
invoke_in_main_thread( invoke_in_main_thread(
self._app.test_net, oThread=self, iMax=2) self._app.test_net, oThread=self, iMax=2)
class ToxAVIterateThread(BaseQThread): class ToxAVIterateThread(BaseQThread):
def __init__(self, toxav): def __init__(self, toxav):

View file

@ -1,22 +1,18 @@
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*- # -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
import ctypes
import os
import traceback
import user_data.settings import user_data.settings
import wrapper.tox import wrapper.tox
import wrapper.toxcore_enums_and_consts as enums import wrapper.toxcore_enums_and_consts as enums
import ctypes
import traceback
import os
global LOG global LOG
import logging import logging
LOG = logging.getLogger('app.'+'tox_factory') LOG = logging.getLogger('app.'+'tox_factory')
from ctypes import * from ctypes import *
from utils import ui as util_ui
from utils import util from utils import util
from utils import ui as util_ui
# callbacks can be called in any thread so were being careful # callbacks can be called in any thread so were being careful
# tox.py can be called by callbacks # tox.py can be called by callbacks
@ -53,12 +49,12 @@ def tox_log_cb(iTox, level, file, line, func, message, *args):
except Exception as e: except Exception as e:
LOG_ERROR(f"tox_log_cb {e}") LOG_ERROR(f"tox_log_cb {e}")
#tox_log_handler (context=0x24763d0, #tox_log_handler (context=0x24763d0,
# level=LOGGER_LEVEL_TRACE, file=0x7fffe599fb99 "TCP_common.c", line=203, # level=LOGGER_LEVEL_TRACE, file=0x7fffe599fb99 "TCP_common.c", line=203,
# func=0x7fffe599fc50 <__func__.2> "read_TCP_packet", # func=0x7fffe599fc50 <__func__.2> "read_TCP_packet",
# message=0x7fffba7fabd0 "recv buffer has 0 bytes, but requested 10 bytes", # message=0x7fffba7fabd0 "recv buffer has 0 bytes, but requested 10 bytes",
# userdata=0x0) at /var/local/src/c-toxcore/toxcore/tox.c:78 # userdata=0x0) at /var/local/src/c-toxcore/toxcore/tox.c:78
def tox_factory(data=None, settings=None, args=None, app=None): def tox_factory(data=None, settings=None, args=None, app=None):
""" """
:param data: user data from .tox file. None = no saved data, create new profile :param data: user data from .tox file. None = no saved data, create new profile

View file

@ -1,11 +1,8 @@
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*- # -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
import json import json
import urllib.request import urllib.request
from PyQt5 import QtCore, QtNetwork
import utils.util as util import utils.util as util
from PyQt5 import QtNetwork, QtCore
try: try:
import requests import requests
except ImportError: except ImportError:
@ -13,7 +10,6 @@ except ImportError:
global LOG global LOG
import logging import logging
LOG = logging.getLogger('app.'+__name__) LOG = logging.getLogger('app.'+__name__)
class ToxDns: class ToxDns:

View file

@ -1,13 +1,10 @@
import os.path
import wave
import pyaudio
import utils.util import utils.util
import wave
import pyaudio
import os.path
global LOG global LOG
import logging import logging
LOG = logging.getLogger('app.'+__name__) LOG = logging.getLogger('app.'+__name__)
SOUND_NOTIFICATION = { SOUND_NOTIFICATION = {

View file

@ -1,16 +1,14 @@
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*- # -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
import utils.util as util
import os
import importlib import importlib
import inspect import inspect
import os
import sys
import plugins.plugin_super_class as pl import plugins.plugin_super_class as pl
import utils.util as util import sys
# LOG=util.log # LOG=util.log
global LOG global LOG
import logging import logging
LOG = logging.getLogger('plugin_support') LOG = logging.getLogger('plugin_support')
def trace(msg, *args, **kwargs): LOG._log(0, msg, []) def trace(msg, *args, **kwargs): LOG._log(0, msg, [])
LOG.trace = trace LOG.trace = trace

View file

@ -1,15 +1,12 @@
from utils import util
import json import json
import os import os
from collections import OrderedDict from collections import OrderedDict
from PyQt5 import QtCore from PyQt5 import QtCore
from utils import util
# LOG=util.log # LOG=util.log
global LOG global LOG
import logging import logging
LOG = logging.getLogger('app.'+__name__) LOG = logging.getLogger('app.'+__name__)
log = lambda x: LOG.info(x) log = lambda x: LOG.info(x)

View file

@ -1,5 +1,4 @@
import os import os
import utils.util as util import utils.util as util

View file

@ -1,16 +1,15 @@
import threading import threading
from PyQt5 import QtCore, QtGui, QtWidgets
import pyaudio
import wave import wave
import pyaudio
import wrapper_tests.support_testing as ts
from PyQt5 import QtCore, QtGui, QtWidgets
import utils.util as util
from ui import widgets from ui import widgets
import utils.util as util
import wrapper_tests.support_testing as ts
global LOG global LOG
import logging import logging
LOG = logging.getLogger('app.'+__name__) LOG = logging.getLogger('app.'+__name__)
class IncomingCallWidget(widgets.CenteredWidget): class IncomingCallWidget(widgets.CenteredWidget):

View file

@ -1,8 +1,7 @@
from PyQt5 import QtCore, QtGui, QtWidgets
from ui.widgets import DataLabel
from utils.util import *
from wrapper.toxcore_enums_and_consts import * from wrapper.toxcore_enums_and_consts import *
from PyQt5 import QtCore, QtGui, QtWidgets
from utils.util import *
from ui.widgets import DataLabel
class ContactItem(QtWidgets.QWidget): class ContactItem(QtWidgets.QWidget):

View file

@ -1,8 +1,7 @@
from PyQt5 import uic
import utils.ui as util_ui
import utils.util as util
from ui.widgets import * from ui.widgets import *
from PyQt5 import uic
import utils.util as util
import utils.ui as util_ui
class CreateProfileScreenResult: class CreateProfileScreenResult:

View file

@ -1,8 +1,7 @@
from PyQt5 import QtCore, QtWidgets, uic
import utils.ui as util_ui
import utils.util as util
from ui.widgets import CenteredWidget from ui.widgets import CenteredWidget
from PyQt5 import uic, QtWidgets, QtCore
import utils.util as util
import utils.ui as util_ui
class GroupBanItem(QtWidgets.QWidget): class GroupBanItem(QtWidgets.QWidget):

View file

@ -1,11 +1,9 @@
from PyQt5 import QtWidgets, uic from PyQt5 import uic, QtWidgets
import utils.util as util import utils.util as util
from ui.widgets import * from ui.widgets import *
global LOG global LOG
import logging import logging
LOG = logging.getLogger('app') LOG = logging.getLogger('app')
class GroupInviteItem(QtWidgets.QWidget): class GroupInviteItem(QtWidgets.QWidget):

View file

@ -1,9 +1,7 @@
from PyQt5 import uic
import utils.ui as util_ui
import utils.util as util
from ui.widgets import CenteredWidget from ui.widgets import CenteredWidget
from PyQt5 import uic
import utils.util as util
import utils.ui as util_ui
class GroupManagementScreen(CenteredWidget): class GroupManagementScreen(CenteredWidget):

View file

@ -1,5 +1,4 @@
from PyQt5 import uic from PyQt5 import uic
import utils.util as util import utils.util as util
from ui.widgets import * from ui.widgets import *
from wrapper.toxcore_enums_and_consts import * from wrapper.toxcore_enums_and_consts import *

View file

@ -44,7 +44,7 @@ class MessagesItemsFactory:
self._messages.setItemWidget(elem, item) self._messages.setItemWidget(elem, item)
return item return item
# File "/var/local/src/toxygen/toxygen/file_transfers/file_transfers_handler.py", line 216, in transfer_finished # File "/var/local/src/toxygen/toxygen/file_transfers/file_transfers_handler.py", line 216, in transfer_finished
# self._file_transfers_message_service.add_inline_message(transfer, index) # self._file_transfers_message_service.add_inline_message(transfer, index)
# File "/var/local/src/toxygen/toxygen/file_transfers/file_transfers_messages_service.py", line 47, in add_inline_message # File "/var/local/src/toxygen/toxygen/file_transfers/file_transfers_messages_service.py", line 47, in add_inline_message

View file

@ -1,10 +1,8 @@
import os.path
from PyQt5 import uic
import utils.ui as util_ui
import utils.util as util
from ui.widgets import * from ui.widgets import *
from PyQt5 import uic
import utils.util as util
import utils.ui as util_ui
import os.path
class LoginScreenResult: class LoginScreenResult:

View file

@ -1,17 +1,18 @@
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*- # -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
import logging
import os import os
from PyQt5 import QtGui, QtWidgets, uic from PyQt5 import uic
from qtpy.QtGui import QColor, QFont, QSyntaxHighlighter, QTextCharFormat from PyQt5 import QtWidgets, QtGui
from qtpy.QtGui import (QColor, QTextCharFormat, QFont, QSyntaxHighlighter)
import utils.ui as util_ui
import utils.util as util
from ui.contact_items import * from ui.contact_items import *
from ui.main_screen_widgets import *
from ui.widgets import MultilineEdit from ui.widgets import MultilineEdit
from ui.main_screen_widgets import *
import utils.util as util
import utils.ui as util_ui
from user_data.settings import Settings from user_data.settings import Settings
import logging
global LOG global LOG
LOG = logging.getLogger('app.'+'mains') LOG = logging.getLogger('app.'+'mains')
@ -19,8 +20,8 @@ iMAX = 70
try: try:
# https://github.com/pyqtconsole/pyqtconsole # https://github.com/pyqtconsole/pyqtconsole
import pyqtconsole.highlighter as hl
from pyqtconsole.console import PythonConsole from pyqtconsole.console import PythonConsole
import pyqtconsole.highlighter as hl
except Exception as e: except Exception as e:
LOG.warn(e) LOG.warn(e)
PythonConsole = None PythonConsole = None
@ -62,7 +63,7 @@ else:
else: else:
bg = 'black' bg = 'black'
def hl_format(color, style=''): def hl_format(color, style=''):
"""Return a QTextCharFormat with the given attributes. """Return a QTextCharFormat with the given attributes.
unused unused
""" """
@ -93,7 +94,6 @@ else:
'inprompt': hl_format('lightBlue', 'bold'), 'inprompt': hl_format('lightBlue', 'bold'),
'outprompt': hl_format('lightRed', 'bold'), 'outprompt': hl_format('lightRed', 'bold'),
} }
class QTextEditLogger(logging.Handler): class QTextEditLogger(logging.Handler):
def __init__(self, parent, app): def __init__(self, parent, app):
@ -176,6 +176,7 @@ class MainWindow(QtWidgets.QMainWindow):
iMAX = settings['width'] * 2/3 / settings['message_font_size'] iMAX = settings['width'] * 2/3 / settings['message_font_size']
self._me = LogDialog(self, app) self._me = LogDialog(self, app)
self._pe = None self._pe = None
self._we = None
def set_dependencies(self, widget_factory, tray, contacts_manager, messenger, profile, plugins_loader, def set_dependencies(self, widget_factory, tray, contacts_manager, messenger, profile, plugins_loader,
file_transfer_handler, history_loader, calls_manager, groups_service, toxes, app): file_transfer_handler, history_loader, calls_manager, groups_service, toxes, app):
@ -249,6 +250,8 @@ class MainWindow(QtWidgets.QMainWindow):
self.actionLog_console.setObjectName("actionLog_console") self.actionLog_console.setObjectName("actionLog_console")
self.actionPython_console = QtWidgets.QAction(window) self.actionPython_console = QtWidgets.QAction(window)
self.actionPython_console.setObjectName("actionLog_console") self.actionPython_console.setObjectName("actionLog_console")
self.actionWeechat_console = QtWidgets.QAction(window)
self.actionWeechat_console.setObjectName("actionLog_console")
self.updateSettings = QtWidgets.QAction(window) self.updateSettings = QtWidgets.QAction(window)
self.actionSettings = QtWidgets.QAction(window) self.actionSettings = QtWidgets.QAction(window)
self.actionSettings.setObjectName("actionSettings") self.actionSettings.setObjectName("actionSettings")
@ -289,6 +292,7 @@ class MainWindow(QtWidgets.QMainWindow):
self.menuPlugins.addAction(self.reloadToxchat) self.menuPlugins.addAction(self.reloadToxchat)
self.menuPlugins.addAction(self.actionLog_console) self.menuPlugins.addAction(self.actionLog_console)
self.menuPlugins.addAction(self.actionPython_console) self.menuPlugins.addAction(self.actionPython_console)
self.menuPlugins.addAction(self.actionWeechat_console)
self.menuAbout.addAction(self.actionAbout_program) self.menuAbout.addAction(self.actionAbout_program)
@ -306,6 +310,7 @@ class MainWindow(QtWidgets.QMainWindow):
self.actionAbout_program.triggered.connect(self.about_program) self.actionAbout_program.triggered.connect(self.about_program)
self.actionLog_console.triggered.connect(self.log_console) self.actionLog_console.triggered.connect(self.log_console)
self.actionPython_console.triggered.connect(self.python_console) self.actionPython_console.triggered.connect(self.python_console)
self.actionWeechat_console.triggered.connect(self.weechat_console)
self.actionNetwork.triggered.connect(self.network_settings) self.actionNetwork.triggered.connect(self.network_settings)
self.actionAdd_friend.triggered.connect(self.add_contact_triggered) self.actionAdd_friend.triggered.connect(self.add_contact_triggered)
self.createGC.triggered.connect(self.create_gc) self.createGC.triggered.connect(self.create_gc)
@ -360,6 +365,7 @@ class MainWindow(QtWidgets.QMainWindow):
self.actionAbout_program.setText(util_ui.tr("About program")) self.actionAbout_program.setText(util_ui.tr("About program"))
self.actionLog_console.setText(util_ui.tr("Console Log")) self.actionLog_console.setText(util_ui.tr("Console Log"))
self.actionPython_console.setText(util_ui.tr("Python Console")) self.actionPython_console.setText(util_ui.tr("Python Console"))
self.actionWeechat_console.setText(util_ui.tr("Weechat Console"))
self.actionTest_tox.setText(util_ui.tr("Bootstrap")) self.actionTest_tox.setText(util_ui.tr("Bootstrap"))
self.actionTest_nmap.setText(util_ui.tr("Test Nodes")) self.actionTest_nmap.setText(util_ui.tr("Test Nodes"))
self.actionTest_main.setText(util_ui.tr("Test Program")) self.actionTest_main.setText(util_ui.tr("Test Program"))
@ -654,44 +660,103 @@ class MainWindow(QtWidgets.QMainWindow):
self._me.show() self._me.show()
def python_console(self): def python_console(self):
if PythonConsole: if not PythonConsole: return
app = self._app app = self._app
if app and app._settings: if app and app._settings:
size = app._settings['message_font_size'] size = app._settings['message_font_size']
font_name = app._settings['font'] font_name = app._settings['font']
else: else:
size = 12 size = 12
font_name = "Courier New" font_name = "Courier New"
size = font_width = 10 size = font_width = 10
font_name = "DejaVu Sans Mono" font_name = "DejaVu Sans Mono"
try: try:
if not self._pe: if not self._pe:
self._pe = PythonConsole(formats=aFORMATS) self._pe = PythonConsole(formats=aFORMATS)
self._pe.setWindowTitle('variable: app is the application') self._pe.setWindowTitle('variable: app is the application')
# self._pe.edit.setStyleSheet('foreground: white; background-color: black;}') # self._pe.edit.setStyleSheet('foreground: white; background-color: black;}')
# Fix the pyconsole geometry # Fix the pyconsole geometry
font = self._pe.edit.document().defaultFont() font = self._pe.edit.document().defaultFont()
font.setFamily(font_name)
font.setBold(True)
if font_width is None:
font_width = QFontMetrics(font).width('M')
self._pe.setFont(font)
geometry = self._pe.geometry()
geometry.setWidth(font_width*80+20)
geometry.setHeight(font_width*40)
self._pe.setGeometry(geometry)
self._pe.resize(font_width*80+20, font_width*40)
self._pe.show()
self._pe.eval_queued()
# or self._pe.eval_in_thread()
return
except Exception as e:
LOG.debug(e)
def weechat_console(self):
try:
from qweechat.qweechat import MainWindow as MainWindow
LOG.info("Adding WeechatConsole")
except Exception as e:
LOG.exception(f"ERROR WeechatConsole {e} {sys.path}")
MainWindow = None
return
LOG.debug(f"calling {MainWindow}")
if not MainWindow: return
class WeechatConsole(MainWindow):
def __init__(self, *args):
MainWindow.__init__(self, *args)
def closeEvent(self, event):
"""Called when QWeeChat window is closed."""
self.network.disconnect_weechat()
if self.network.debug_dialog:
self.network.debug_dialog.close()
config.write(self.config)
app = self._app
if app and app._settings:
size = app._settings['message_font_size']
font_name = app._settings['font']
else:
size = 12
font_name = "Courier New"
size = font_width = 10
font_name = "DejaVu Sans Mono"
try:
if not self._we:
LOG.debug("creating WeechatConsole")
self._we = WeechatConsole()
# self._we.setWindowTitle('variable: app is the application')
# self._we.edit.setStyleSheet('foreground: white; background-color: black;}')
# Fix the pyconsole geometry
try:
font = self._we.buffers[0].widget.chat.defaultFont()
font.setFamily(font_name) font.setFamily(font_name)
font.setBold(True) font.setBold(True)
if font_width is None: if font_width is None:
font_width = QFontMetrics(font).width('M') font_width = QFontMetrics(font).width('M')
self._pe.setFont(font) self._we.setFont(font)
geometry = self._pe.geometry()
geometry.setWidth(font_width*80+20)
geometry.setHeight(font_width*40)
self._pe.setGeometry(geometry)
self._pe.resize(font_width*80+20, font_width*40)
self._pe.show()
self._pe.eval_queued()
# or self._pe.eval_in_thread()
return
except Exception as e: except Exception as e:
LOG.debug(e) LOG.debug(e)
self._me.show() font_width = size
geometry = self._we.geometry()
geometry.setWidth(font_width*80+20)
geometry.setHeight(font_width*40)
self._we.setGeometry(geometry)
self._we.resize(font_width*80+20, font_width*40)
self._we.show()
# or self._we.eval_in_thread()
return
except Exception as e:
LOG.exception(f"Error creating WeechatConsole {e}")
def about_program(self): def about_program(self):
# TODO: replace with window # TODO: replace with window

View file

@ -1,15 +1,14 @@
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*- # -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
import re
import urllib import urllib
import re
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
import utils.ui as util_ui from ui.widgets import RubberBandWindow, create_menu, QRightClickButton, CenteredWidget, LineEdit
import utils.util as util import utils.util as util
import utils.ui as util_ui
from stickers.stickers import load_stickers from stickers.stickers import load_stickers
from ui.widgets import (CenteredWidget, LineEdit, QRightClickButton,
RubberBandWindow, create_menu)
class MessageArea(QtWidgets.QPlainTextEdit): class MessageArea(QtWidgets.QPlainTextEdit):
@ -37,7 +36,7 @@ class MessageArea(QtWidgets.QPlainTextEdit):
self.pasteEvent(url.toString()) self.pasteEvent(url.toString())
else: else:
self.pasteEvent() self.pasteEvent()
elif event.key() in (QtCore.Qt.Key_Return, QtCore.Qt.Key_Enter): elif event.key() in (QtCore.Qt.Key_Return, QtCore.Qt.Key_Enter):
modifiers = event.modifiers() modifiers = event.modifiers()
if modifiers & QtCore.Qt.ControlModifier or modifiers & QtCore.Qt.ShiftModifier: if modifiers & QtCore.Qt.ControlModifier or modifiers & QtCore.Qt.ShiftModifier:
@ -52,10 +51,10 @@ class MessageArea(QtWidgets.QPlainTextEdit):
LOG.error(f"keyPressEvent ERROR send_message to {self._messenger}") LOG.error(f"keyPressEvent ERROR send_message to {self._messenger}")
util_ui.message_box(str(e), util_ui.message_box(str(e),
util_ui.tr(f"keyPressEvent ERROR send_message to {self._messenger}")) util_ui.tr(f"keyPressEvent ERROR send_message to {self._messenger}"))
elif event.key() == QtCore.Qt.Key_Up and not self.toPlainText(): elif event.key() == QtCore.Qt.Key_Up and not self.toPlainText():
self.appendPlainText(self._messenger.get_last_message()) self.appendPlainText(self._messenger.get_last_message())
elif event.key() == QtCore.Qt.Key_Tab and self._contacts_manager.is_active_a_group(): elif event.key() == QtCore.Qt.Key_Tab and self._contacts_manager.is_active_a_group():
text = self.toPlainText() text = self.toPlainText()
text_cursor = self.textCursor() text_cursor = self.textCursor()

View file

@ -1,18 +1,17 @@
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*- # -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
import pyaudio
import wrapper_tests.support_testing as ts
from PyQt5 import QtCore, QtGui, QtWidgets, uic from PyQt5 import QtCore, QtGui, QtWidgets, uic
import pyaudio
import updater.updater as updater
import utils.ui as util_ui
from ui.widgets import CenteredWidget, DataLabel, LineEdit, RubberBandWindow
from user_data import settings
from user_data.settings import * from user_data.settings import *
from utils.util import * from utils.util import *
from ui.widgets import CenteredWidget, DataLabel, LineEdit, RubberBandWindow
import updater.updater as updater
import utils.ui as util_ui
import wrapper_tests.support_testing as ts
from user_data import settings
global LOG global LOG
import logging import logging
LOG = logging.getLogger('app.'+__name__) LOG = logging.getLogger('app.'+__name__)
global oPYA global oPYA

View file

@ -1,13 +1,12 @@
import html as h from wrapper.toxcore_enums_and_consts import *
import re
import ui.menu as menu
import ui.widgets as widgets import ui.widgets as widgets
import utils.util as util import utils.util as util
from file_transfers.file_transfers import * import ui.menu as menu
from messenger.messages import MESSAGE_AUTHOR import html as h
import re
from ui.widgets import * from ui.widgets import *
from wrapper.toxcore_enums_and_consts import * from messenger.messages import MESSAGE_AUTHOR
from file_transfers.file_transfers import *
class MessageBrowser(QtWidgets.QTextBrowser): class MessageBrowser(QtWidgets.QTextBrowser):

View file

@ -1,11 +1,9 @@
from ui.widgets import CenteredWidget, LineEdit, DialogWithResult
from PyQt5 import QtCore, QtWidgets from PyQt5 import QtCore, QtWidgets
import utils.ui as util_ui import utils.ui as util_ui
from ui.widgets import CenteredWidget, DialogWithResult, LineEdit
global LOG global LOG
import logging import logging
LOG = logging.getLogger('app.'+__name__) LOG = logging.getLogger('app.'+__name__)
class PasswordArea(LineEdit): class PasswordArea(LineEdit):

View file

@ -1,10 +1,9 @@
from PyQt5 import uic
import utils.ui as util_ui
import utils.util as util
import wrapper.toxcore_enums_and_consts as consts
from ui.contact_items import *
from ui.widgets import CenteredWidget from ui.widgets import CenteredWidget
from PyQt5 import uic
import utils.util as util
import utils.ui as util_ui
from ui.contact_items import *
import wrapper.toxcore_enums_and_consts as consts
class PeerScreen(CenteredWidget): class PeerScreen(CenteredWidget):
@ -34,7 +33,7 @@ class PeerScreen(CenteredWidget):
self.statusCircle.update(self._peer.status) self.statusCircle.update(self._peer.status)
self.peerNameLabel.setText(self._peer.name) self.peerNameLabel.setText(self._peer.name)
self.ignorePeerCheckBox.setChecked(self._peer.is_muted) self.ignorePeerCheckBox.setChecked(self._peer.is_muted)
self.ignorePeerCheckBox.clicked.connect(self._toggle_ignore) self.ignorePeerCheckBox.clicked.connect(self._toggle_ignore)
self.sendPrivateMessagePushButton.clicked.connect(self._send_private_message) self.sendPrivateMessagePushButton.clicked.connect(self._send_private_message)
self.copyPublicKeyPushButton.clicked.connect(self._copy_public_key) self.copyPublicKeyPushButton.clicked.connect(self._copy_public_key)

View file

@ -1,9 +1,8 @@
from PyQt5 import QtCore, QtGui, uic
import utils.ui as util_ui
from ui.widgets import CenteredWidget from ui.widgets import CenteredWidget
import utils.ui as util_ui
from utils.util import join_path, get_images_directory, get_views_path
from user_data.settings import Settings from user_data.settings import Settings
from utils.util import get_images_directory, get_views_path, join_path from PyQt5 import QtGui, QtCore, uic
class ProfileSettings(CenteredWidget): class ProfileSettings(CenteredWidget):

View file

@ -1,9 +1,8 @@
from PyQt5 import uic
import utils.ui as util_ui
import utils.util as util
from ui.contact_items import *
from ui.widgets import CenteredWidget, LineEdit from ui.widgets import CenteredWidget, LineEdit
from PyQt5 import uic
import utils.util as util
import utils.ui as util_ui
from ui.contact_items import *
class SelfPeerScreen(CenteredWidget): class SelfPeerScreen(CenteredWidget):

View file

@ -1,10 +1,8 @@
import os.path from PyQt5 import QtWidgets, QtGui, QtCore
from PyQt5 import QtCore, QtGui, QtWidgets
from ui.password_screen import UnlockAppScreen
from utils.ui import tr from utils.ui import tr
from utils.util import * from utils.util import *
from ui.password_screen import UnlockAppScreen
import os.path
class SystemTrayIcon(QtWidgets.QSystemTrayIcon): class SystemTrayIcon(QtWidgets.QSystemTrayIcon):

View file

@ -1,9 +1,7 @@
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*- # -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
import logging
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
import utils.ui as util_ui import utils.ui as util_ui
import logging
global LOG global LOG
LOG = logging.getLogger('app') LOG = logging.getLogger('app')

View file

@ -1,14 +1,13 @@
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*- # -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
from ui.group_bans_widgets import *
from ui.group_invites_widgets import *
from ui.group_settings_widgets import *
from ui.groups_widgets import *
from ui.main_screen_widgets import * from ui.main_screen_widgets import *
from ui.menu import * from ui.menu import *
from ui.groups_widgets import *
from ui.peer_screen import * from ui.peer_screen import *
from ui.profile_settings_screen import ProfileSettings
from ui.self_peer_screen import * from ui.self_peer_screen import *
from ui.group_invites_widgets import *
from ui.group_settings_widgets import *
from ui.group_bans_widgets import *
from ui.profile_settings_screen import ProfileSettings
class WidgetsFactory: class WidgetsFactory:

View file

@ -1,17 +1,14 @@
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*- # -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
import utils.util as util
import utils.ui as util_ui
import os import os
import platform import platform
import subprocess
import urllib import urllib
from PyQt5 import QtNetwork, QtCore
from PyQt5 import QtCore, QtNetwork import subprocess
import utils.ui as util_ui
import utils.util as util
global LOG global LOG
import logging import logging
LOG = logging.getLogger('app.'+__name__) LOG = logging.getLogger('app.'+__name__)
log = lambda x: LOG.info(x) log = lambda x: LOG.info(x)

View file

@ -1,5 +1,4 @@
import os.path import os.path
from utils.util import get_profile_name_from_path, join_path from utils.util import get_profile_name_from_path, join_path

View file

@ -1,13 +1,13 @@
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*- # -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
import utils.util as util
import os import os
import utils.util as util from user_data.settings import Settings
from common.event import Event from common.event import Event
from user_data.settings import Settings, get_user_config_path from user_data.settings import get_user_config_path
global LOG global LOG
import logging import logging
LOG = logging.getLogger('app.'+__name__) LOG = logging.getLogger('app.'+__name__)

View file

@ -1,22 +1,20 @@
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*- # -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
import json
import os import os
from platform import system from platform import system
import json
from pprint import pprint from pprint import pprint
import wrapper_tests.support_testing as ts from utils.util import *
from utils.util import log, join_path
import user_data from common.event import Event
import utils.ui as util_ui import utils.ui as util_ui
import utils.util as util_utils import utils.util as util_utils
from common.event import Event import user_data
from utils.util import * import wrapper_tests.support_testing as ts
from utils.util import join_path, log
global LOG global LOG
import logging import logging
LOG = logging.getLogger('settings') LOG = logging.getLogger('settings')
def merge_args_into_settings(args, settings): def merge_args_into_settings(args, settings):

View file

@ -1,5 +1,4 @@
from PyQt5 import QtWidgets from PyQt5 import QtWidgets
import utils.util as util import utils.util as util