added menu to main screen, some bug fixes
This commit is contained in:
parent
70fba78c7b
commit
ae3e84e3d2
3 changed files with 61 additions and 31 deletions
|
@ -64,7 +64,7 @@ def main():
|
||||||
if not _login.t:
|
if not _login.t:
|
||||||
return
|
return
|
||||||
elif _login.t == 1: # create new profile
|
elif _login.t == 1: # create new profile
|
||||||
# TODO: add creation of new profile
|
# TODO: add possibility to create new profile
|
||||||
path = Settings.get_default_path()
|
path = Settings.get_default_path()
|
||||||
name = _login.name if _login.name else 'Toxygen User'
|
name = _login.name if _login.name else 'Toxygen User'
|
||||||
return
|
return
|
||||||
|
@ -81,19 +81,17 @@ def main():
|
||||||
ms = MainWindow()
|
ms = MainWindow()
|
||||||
# creating tox instance
|
# creating tox instance
|
||||||
tox = tox_factory(data, settings)
|
tox = tox_factory(data, settings)
|
||||||
|
ms.show()
|
||||||
# bootstrap
|
# bootstrap
|
||||||
for data in node_generator():
|
for data in node_generator():
|
||||||
tox.bootstrap(*data)
|
tox.bootstrap(*data)
|
||||||
# TODO: set all callbacks
|
# TODO: set all callbacks (create callback.py) and init it with ms
|
||||||
tox.callback_friend_message(message, 0)
|
tox.callback_friend_message(message, 0)
|
||||||
tox.callback_self_connection_status(status, 0)
|
tox.callback_self_connection_status(status, 0)
|
||||||
#tox.callback_friend_connection_status(friend_status, 0)
|
|
||||||
|
|
||||||
# starting thread for tox iterate
|
# starting thread for tox iterate
|
||||||
mainloop = ToxIterateThread(tox)
|
mainloop = ToxIterateThread(tox)
|
||||||
mainloop.start()
|
mainloop.start()
|
||||||
|
|
||||||
ms.show()
|
|
||||||
app.connect(app, QtCore.SIGNAL("lastWindowClosed()"), app, QtCore.SLOT("quit()"))
|
app.connect(app, QtCore.SIGNAL("lastWindowClosed()"), app, QtCore.SLOT("quit()"))
|
||||||
app.exec_()
|
app.exec_()
|
||||||
mainloop.stop = True
|
mainloop.stop = True
|
||||||
|
@ -115,4 +113,5 @@ class ToxIterateThread(QtCore.QThread):
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
# TODO: add command line options?
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -4,12 +4,63 @@ import sys
|
||||||
from PySide import QtGui, QtCore
|
from PySide import QtGui, QtCore
|
||||||
|
|
||||||
|
|
||||||
class MainWindow(QtGui.QWidget):
|
class MainWindow(QtGui.QMainWindow):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(MainWindow, self).__init__()
|
super(MainWindow, self).__init__()
|
||||||
self.initUI()
|
self.initUI()
|
||||||
|
|
||||||
|
def setup_menu(self, MainWindow):
|
||||||
|
self.menubar = QtGui.QMenuBar(MainWindow)
|
||||||
|
self.menubar.setObjectName("menubar")
|
||||||
|
self.menuProfile = QtGui.QMenu(self.menubar)
|
||||||
|
self.menuProfile.setObjectName("menuProfile")
|
||||||
|
self.menuSettings = QtGui.QMenu(self.menubar)
|
||||||
|
self.menuSettings.setObjectName("menuSettings")
|
||||||
|
self.menuAbout = QtGui.QMenu(self.menubar)
|
||||||
|
self.menuAbout.setObjectName("menuAbout")
|
||||||
|
self.statusbar = QtGui.QStatusBar(MainWindow)
|
||||||
|
self.statusbar.setObjectName("statusbar")
|
||||||
|
self.actionAdd_friend = QtGui.QAction(MainWindow)
|
||||||
|
self.actionAdd_friend.setObjectName("actionAdd_friend")
|
||||||
|
self.actionProfile_settings = QtGui.QAction(MainWindow)
|
||||||
|
self.actionProfile_settings.setObjectName("actionProfile_settings")
|
||||||
|
self.actionPrivacy_settings = QtGui.QAction(MainWindow)
|
||||||
|
self.actionPrivacy_settings.setObjectName("actionPrivacy_settings")
|
||||||
|
self.actionInterface_settings = QtGui.QAction(MainWindow)
|
||||||
|
self.actionInterface_settings.setObjectName("actionInterface_settings")
|
||||||
|
self.actionNotifications = QtGui.QAction(MainWindow)
|
||||||
|
self.actionNotifications.setObjectName("actionNotifications")
|
||||||
|
self.actionNetwork = QtGui.QAction(MainWindow)
|
||||||
|
self.actionNetwork.setObjectName("actionNetwork")
|
||||||
|
self.actionAbout_program = QtGui.QAction(MainWindow)
|
||||||
|
self.actionAbout_program.setObjectName("actionAbout_program")
|
||||||
|
self.actionSettings = QtGui.QAction(MainWindow)
|
||||||
|
self.actionSettings.setObjectName("actionSettings")
|
||||||
|
self.menuProfile.addAction(self.actionAdd_friend)
|
||||||
|
self.menuProfile.addAction(self.actionSettings)
|
||||||
|
self.menuSettings.addAction(self.actionPrivacy_settings)
|
||||||
|
self.menuSettings.addAction(self.actionInterface_settings)
|
||||||
|
self.menuSettings.addAction(self.actionNotifications)
|
||||||
|
self.menuSettings.addAction(self.actionNetwork)
|
||||||
|
self.menuAbout.addAction(self.actionAbout_program)
|
||||||
|
self.menubar.addAction(self.menuProfile.menuAction())
|
||||||
|
self.menubar.addAction(self.menuSettings.menuAction())
|
||||||
|
self.menubar.addAction(self.menuAbout.menuAction())
|
||||||
|
|
||||||
|
self.menuProfile.setTitle(QtGui.QApplication.translate("MainWindow", "Profile", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
|
self.menuSettings.setTitle(QtGui.QApplication.translate("MainWindow", "Settings", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
|
self.menuAbout.setTitle(QtGui.QApplication.translate("MainWindow", "About", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
|
self.actionAdd_friend.setText(QtGui.QApplication.translate("MainWindow", "Add contact", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
|
self.actionProfile_settings.setText(QtGui.QApplication.translate("MainWindow", "Profile", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
|
self.actionPrivacy_settings.setText(QtGui.QApplication.translate("MainWindow", "Privacy", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
|
self.actionInterface_settings.setText(QtGui.QApplication.translate("MainWindow", "Interface", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
|
self.actionNotifications.setText(QtGui.QApplication.translate("MainWindow", "Notifications", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
|
self.actionNetwork.setText(QtGui.QApplication.translate("MainWindow", "Network", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
|
self.actionAbout_program.setText(QtGui.QApplication.translate("MainWindow", "About program", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
|
self.actionSettings.setText(QtGui.QApplication.translate("MainWindow", "Settings", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||||
|
|
||||||
def setup_right_bottom(self, Form):
|
def setup_right_bottom(self, Form):
|
||||||
Form.setObjectName("right_bottom")
|
Form.setObjectName("right_bottom")
|
||||||
Form.resize(500, 150)
|
Form.resize(500, 150)
|
||||||
|
@ -109,6 +160,7 @@ class MainWindow(QtGui.QWidget):
|
||||||
QtCore.QMetaObject.connectSlotsByName(Form)
|
QtCore.QMetaObject.connectSlotsByName(Form)
|
||||||
|
|
||||||
def initUI(self):
|
def initUI(self):
|
||||||
|
main = QtGui.QWidget()
|
||||||
grid = QtGui.QGridLayout()
|
grid = QtGui.QGridLayout()
|
||||||
search = QtGui.QWidget()
|
search = QtGui.QWidget()
|
||||||
grid.setColumnStretch(1, 1)
|
grid.setColumnStretch(1, 1)
|
||||||
|
@ -123,11 +175,12 @@ class MainWindow(QtGui.QWidget):
|
||||||
message = QtGui.QWidget()
|
message = QtGui.QWidget()
|
||||||
self.setup_right_bottom(message)
|
self.setup_right_bottom(message)
|
||||||
grid.addWidget(message, 2, 1)
|
grid.addWidget(message, 2, 1)
|
||||||
self.setLayout(grid)
|
main.setLayout(grid)
|
||||||
|
self.setup_menu(main)
|
||||||
|
self.setCentralWidget(main)
|
||||||
self.setMinimumSize(800, 400)
|
self.setMinimumSize(800, 400)
|
||||||
self.setGeometry(400, 400, 800, 400)
|
self.setGeometry(400, 400, 800, 400)
|
||||||
self.setWindowTitle('Toxygen')
|
self.setWindowTitle('Toxygen')
|
||||||
self.show()
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app = QtGui.QApplication(sys.argv)
|
app = QtGui.QApplication(sys.argv)
|
||||||
|
|
|
@ -20,28 +20,6 @@ class TestSettings():
|
||||||
assert os.path.exists(path)
|
assert os.path.exists(path)
|
||||||
|
|
||||||
|
|
||||||
class TestTox():
|
|
||||||
|
|
||||||
def test_public_key(self):
|
|
||||||
settings = Settings()
|
|
||||||
data = Profile.open_profile(Settings.get_default_path(), 'tox_save')
|
|
||||||
try:
|
|
||||||
tox = Tox(data, settings)
|
|
||||||
except:
|
|
||||||
raise
|
|
||||||
assert 0
|
|
||||||
try:
|
|
||||||
key = tox.self_get_public_key()
|
|
||||||
except:
|
|
||||||
raise
|
|
||||||
assert 0
|
|
||||||
assert len(key.raw) == 32
|
|
||||||
try:
|
|
||||||
del tox
|
|
||||||
except:
|
|
||||||
raise
|
|
||||||
|
|
||||||
|
|
||||||
class TestProfile():
|
class TestProfile():
|
||||||
|
|
||||||
def test_search(self):
|
def test_search(self):
|
||||||
|
|
Loading…
Reference in a new issue