ui and docs update
This commit is contained in:
parent
30aa254d39
commit
b592ca3f00
@ -158,7 +158,7 @@ class MainWindow(QtGui.QMainWindow):
|
||||
self.sendMessageButton.setText(QtGui.QApplication.translate("Form", "Send", None, QtGui.QApplication.UnicodeUTF8))
|
||||
QtCore.QMetaObject.connectSlotsByName(Form)
|
||||
|
||||
def setup_left_center(self, Form):
|
||||
def setup_left_bottom(self, Form):
|
||||
Form.setObjectName("left_center")
|
||||
Form.resize(500, 80)
|
||||
self.online_contacts = QtGui.QCheckBox(Form)
|
||||
@ -231,7 +231,7 @@ class MainWindow(QtGui.QMainWindow):
|
||||
self.callButton.setText(QtGui.QApplication.translate("Form", "Start call", None, QtGui.QApplication.UnicodeUTF8))
|
||||
QtCore.QMetaObject.connectSlotsByName(Form)
|
||||
|
||||
def setup_left_bottom(self, widget):
|
||||
def setup_left_center(self, widget):
|
||||
# widget.setFixedWidth(250)
|
||||
# widget.setMinimumSize(QtCore.QSize(250, 500))
|
||||
# widget.setMaximumSize(QtCore.QSize(250, 500))
|
||||
@ -258,8 +258,8 @@ class MainWindow(QtGui.QMainWindow):
|
||||
main = QtGui.QWidget()
|
||||
grid = QtGui.QGridLayout()
|
||||
search = QtGui.QWidget()
|
||||
self.setup_left_center(search)
|
||||
grid.addWidget(search, 1, 0)
|
||||
self.setup_left_bottom(search)
|
||||
grid.addWidget(search, 2, 0)
|
||||
name = QtGui.QWidget()
|
||||
self.setup_left_top(name)
|
||||
grid.addWidget(name, 0, 0)
|
||||
@ -270,8 +270,8 @@ class MainWindow(QtGui.QMainWindow):
|
||||
self.setup_right_bottom(message)
|
||||
grid.addWidget(message, 2, 1)
|
||||
main_list = QtGui.QWidget()
|
||||
self.setup_left_bottom(main_list)
|
||||
grid.addWidget(main_list, 2, 0)
|
||||
self.setup_left_center(main_list)
|
||||
grid.addWidget(main_list, 1, 0)
|
||||
grid.setColumnMinimumWidth(1, 500)
|
||||
grid.setColumnMinimumWidth(0, 250)
|
||||
main.setLayout(grid)
|
||||
@ -335,6 +335,7 @@ class MainWindow(QtGui.QMainWindow):
|
||||
if self.profile.isActiveOnline() and text:
|
||||
num = self.profile.getActiveNumber()
|
||||
self.tox.friend_send_message(num, TOX_MESSAGE_TYPE['NORMAL'], text)
|
||||
self.messageEdit.clear()
|
||||
|
||||
# -----------------------------------------------------------------------------------------------------------------
|
||||
# Functions which called when user click somewhere else
|
||||
|
@ -7,7 +7,9 @@ from ctypes import *
|
||||
|
||||
|
||||
class ProfileHelper(object):
|
||||
|
||||
"""
|
||||
Class with static methods for search, load and save profiles
|
||||
"""
|
||||
@staticmethod
|
||||
def find_profiles():
|
||||
path = Settings.get_default_path()
|
||||
@ -46,8 +48,14 @@ class ProfileHelper(object):
|
||||
|
||||
|
||||
class Contact(object):
|
||||
"""
|
||||
Class encapsulating TOX contact
|
||||
Properties: name (alias of contact or name), status_message, status (connection status)
|
||||
number - unique number of friend in list, widget - widget for update
|
||||
"""
|
||||
|
||||
def __init__(self, name, status_message, number, widget):
|
||||
# TODO: remove number
|
||||
self._name, self._status_message, self._number = name, status_message, number
|
||||
self._status, self._widget = None, widget
|
||||
widget.name.setText(name)
|
||||
@ -81,6 +89,9 @@ class Contact(object):
|
||||
|
||||
|
||||
class Friend(Contact):
|
||||
"""
|
||||
Friend in list of friends. Can be hidden, unread messages added
|
||||
"""
|
||||
|
||||
def __init__(self, *args):
|
||||
super(Friend, self).__init__(*args)
|
||||
@ -101,14 +112,17 @@ class Friend(Contact):
|
||||
|
||||
|
||||
class Profile(Contact, Singleton):
|
||||
|
||||
"""
|
||||
Profile of current toxygen user. Contains friends list, tox instance
|
||||
"""
|
||||
# TODO: add slices
|
||||
def __init__(self, tox, widgets, widget):
|
||||
self._widget = widget
|
||||
self.tox = tox
|
||||
data = tox.self_get_friend_list()
|
||||
self.friends, num, self._active_friend = [], 0, -1
|
||||
for i in data:
|
||||
name = tox.friend_get_name(i)
|
||||
name = tox.friend_get_name(i) or 'Tox user' # tox.friend_get_public_key(i)
|
||||
status_message = tox.friend_get_status_message(i)
|
||||
self.friends.append(Friend(name, status_message, i, widgets[num]))
|
||||
num += 1
|
||||
@ -136,6 +150,11 @@ class Profile(Contact, Singleton):
|
||||
|
||||
|
||||
def tox_factory(data=None, settings=None):
|
||||
"""
|
||||
:param data: user data from .tox file. None = no saved data, create new profile
|
||||
:param settings: current application settings. None = defaults settings will be used
|
||||
:return: new tox instance
|
||||
"""
|
||||
if settings is None:
|
||||
settings = Settings.get_default_settings()
|
||||
tox_options = Tox.options_new()
|
||||
|
@ -1,4 +1,5 @@
|
||||
import os
|
||||
import time
|
||||
|
||||
program_version = '0.0.1 (alpha)'
|
||||
|
||||
@ -21,6 +22,10 @@ def curr_directory():
|
||||
return os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
|
||||
def curr_time():
|
||||
return time.strftime("%H:%M:")
|
||||
|
||||
|
||||
class Singleton(object):
|
||||
|
||||
def __new__(cls, *args):
|
||||
|
Loading…
Reference in New Issue
Block a user