back to menu

This commit is contained in:
ingvar1995 2017-06-20 21:31:23 +03:00
parent 1b4c211c1d
commit 1b6b8e043a

View file

@ -22,52 +22,47 @@ class MainWindow(QtWidgets.QMainWindow, Singleton):
if settings.Settings.get_instance()['show_welcome_screen']:
self.ws = WelcomeScreen()
def setup_menu(self, Form):
box = QtWidgets.QHBoxLayout()
box.setContentsMargins(0, 0, 0, 0)
box.setAlignment(QtCore.Qt.AlignLeft)
self.profile_button = MainMenuButton(Form)
box.addWidget(self.profile_button)
self.settings_button = MainMenuButton(Form)
box.addWidget(self.settings_button)
self.plugins_button = MainMenuButton(Form)
box.addWidget(self.plugins_button)
self.about_button = MainMenuButton(Form)
box.addWidget(self.about_button)
box.setSpacing(0)
def setup_menu(self, window):
self.menubar = QtWidgets.QMenuBar(window)
self.menubar.setObjectName("menubar")
self.menubar.setNativeMenuBar(False)
self.menubar.setMinimumSize(self.width(), 25)
self.menubar.setMaximumSize(self.width(), 25)
self.menubar.setBaseSize(self.width(), 25)
self.menuProfile = QtWidgets.QMenu(self.menubar)
self.menuProfile = QtWidgets.QMenu()
self.menuProfile = QtWidgets.QMenu(self.menubar)
self.menuProfile.setObjectName("menuProfile")
self.menuSettings = QtWidgets.QMenu()
self.menuSettings = QtWidgets.QMenu(self.menubar)
self.menuSettings.setObjectName("menuSettings")
self.menuPlugins = QtWidgets.QMenu()
self.menuPlugins = QtWidgets.QMenu(self.menubar)
self.menuPlugins.setObjectName("menuPlugins")
self.menuAbout = QtWidgets.QMenu()
self.menuAbout = QtWidgets.QMenu(self.menubar)
self.menuAbout.setObjectName("menuAbout")
self.actionAdd_friend = QtWidgets.QAction(Form)
self.actionAdd_friend = QtWidgets.QAction(window)
self.actionAdd_friend.setObjectName("actionAdd_friend")
self.actionprofilesettings = QtWidgets.QAction(Form)
self.actionprofilesettings = QtWidgets.QAction(window)
self.actionprofilesettings.setObjectName("actionprofilesettings")
self.actionPrivacy_settings = QtWidgets.QAction(Form)
self.actionPrivacy_settings = QtWidgets.QAction(window)
self.actionPrivacy_settings.setObjectName("actionPrivacy_settings")
self.actionInterface_settings = QtWidgets.QAction(Form)
self.actionInterface_settings = QtWidgets.QAction(window)
self.actionInterface_settings.setObjectName("actionInterface_settings")
self.actionNotifications = QtWidgets.QAction(Form)
self.actionNotifications = QtWidgets.QAction(window)
self.actionNotifications.setObjectName("actionNotifications")
self.actionNetwork = QtWidgets.QAction(Form)
self.actionNetwork = QtWidgets.QAction(window)
self.actionNetwork.setObjectName("actionNetwork")
self.actionAbout_program = QtWidgets.QAction(Form)
self.actionAbout_program = QtWidgets.QAction(window)
self.actionAbout_program.setObjectName("actionAbout_program")
self.updateSettings = QtWidgets.QAction(Form)
self.actionSettings = QtWidgets.QAction(Form)
self.updateSettings = QtWidgets.QAction(window)
self.actionSettings = QtWidgets.QAction(window)
self.actionSettings.setObjectName("actionSettings")
self.audioSettings = QtWidgets.QAction(Form)
self.videoSettings = QtWidgets.QAction(Form)
self.pluginData = QtWidgets.QAction(Form)
self.importPlugin = QtWidgets.QAction(Form)
self.reloadPlugins = QtWidgets.QAction(Form)
self.lockApp = QtWidgets.QAction(Form)
self.audioSettings = QtWidgets.QAction(window)
self.videoSettings = QtWidgets.QAction(window)
self.pluginData = QtWidgets.QAction(window)
self.importPlugin = QtWidgets.QAction(window)
self.reloadPlugins = QtWidgets.QAction(window)
self.lockApp = QtWidgets.QAction(window)
self.menuProfile.addAction(self.actionAdd_friend)
self.menuProfile.addAction(self.actionSettings)
self.menuProfile.addAction(self.lockApp)
@ -83,10 +78,10 @@ class MainWindow(QtWidgets.QMainWindow, Singleton):
self.menuPlugins.addAction(self.reloadPlugins)
self.menuAbout.addAction(self.actionAbout_program)
self.profile_button.setMenu(self.menuProfile)
self.settings_button.setMenu(self.menuSettings)
self.plugins_button.setMenu(self.menuPlugins)
self.about_button.setMenu(self.menuAbout)
self.menubar.addAction(self.menuProfile.menuAction())
self.menubar.addAction(self.menuSettings.menuAction())
self.menubar.addAction(self.menuPlugins.menuAction())
self.menubar.addAction(self.menuAbout.menuAction())
self.actionAbout_program.triggered.connect(self.about_program)
self.actionNetwork.triggered.connect(self.network_settings)
@ -103,9 +98,6 @@ class MainWindow(QtWidgets.QMainWindow, Singleton):
self.importPlugin.triggered.connect(self.import_plugin)
self.reloadPlugins.triggered.connect(self.reload_plugins)
Form.setLayout(box)
QtCore.QMetaObject.connectSlotsByName(Form)
def languageChange(self, *args, **kwargs):
self.retranslateUi()
@ -117,11 +109,11 @@ class MainWindow(QtWidgets.QMainWindow, Singleton):
def retranslateUi(self):
self.lockApp.setText(QtWidgets.QApplication.translate("MainWindow", "Lock"))
self.plugins_button.setText(QtWidgets.QApplication.translate("MainWindow", "Plugins"))
self.menuPlugins.setTitle(QtWidgets.QApplication.translate("MainWindow", "Plugins"))
self.pluginData.setText(QtWidgets.QApplication.translate("MainWindow", "List of plugins"))
self.profile_button.setText(QtWidgets.QApplication.translate("MainWindow", "Profile"))
self.settings_button.setText(QtWidgets.QApplication.translate("MainWindow", "Settings"))
self.about_button.setText(QtWidgets.QApplication.translate("MainWindow", "About"))
self.menuProfile.setTitle(QtWidgets.QApplication.translate("MainWindow", "Profile"))
self.menuSettings.setTitle(QtWidgets.QApplication.translate("MainWindow", "Settings"))
self.menuAbout.setTitle(QtWidgets.QApplication.translate("MainWindow", "About"))
self.actionAdd_friend.setText(QtWidgets.QApplication.translate("MainWindow", "Add contact"))
self.actionprofilesettings.setText(QtWidgets.QApplication.translate("MainWindow", "Profile"))
self.actionPrivacy_settings.setText(QtWidgets.QApplication.translate("MainWindow", "Privacy"))
@ -383,12 +375,8 @@ class MainWindow(QtWidgets.QMainWindow, Singleton):
self.close()
def resizeEvent(self, *args, **kwargs):
if platform.system() == 'Windows':
self.messages.setGeometry(0, 0, self.width() - 270, self.height() - 155)
self.friends_list.setGeometry(0, 0, 270, self.height() - 125)
else:
self.messages.setGeometry(0, 0, self.width() - 270, self.height() - 159)
self.friends_list.setGeometry(0, 0, 270, self.height() - 129)
self.videocallButton.setGeometry(QtCore.QRect(self.width() - 330, 10, 50, 50))
self.callButton.setGeometry(QtCore.QRect(self.width() - 390, 10, 50, 50))