Example #1
0
    def triggered_open_qt_about(self):
        """
        Opens the default dialog provided by Qt which contains information about Qt.
        This function is triggered by using the action "About Qt" in the toolbar menu "Help".

        :return:
        """

        QMessageBox.aboutQt(self)
 def on_bTest_clicked(self):
     """
     Private method to test the selected options.
     """
     if self.rAbout.isChecked():
         QMessageBox.about(None, self.eCaption.text(),
                           self.eMessage.toPlainText())
     elif self.rAboutQt.isChecked():
         QMessageBox.aboutQt(None, self.eCaption.text())
     else:
         self.__testQt42()
Example #3
0
 def make_toolbar(self, list_of_actions=None):
     """Make or Update the main Tool Bar."""
     self.toolbar = QToolBar(self)
     self.left_spacer, self.right_spacer = QWidget(self), QWidget(self)
     self.left_spacer.setSizePolicy(1 | 2, 1 | 2)  # Expanding, Expanding
     self.right_spacer.setSizePolicy(1 | 2, 1 | 2)  # Expanding, Expanding
     self.toolbar.addAction("Menu",
                            lambda: self.menubar.exec_(QCursor.pos()))
     self.toolbar.addWidget(self.left_spacer)
     self.toolbar.addSeparator()
     self.toolbar.addAction(QIcon.fromTheme("help-contents"),
                            "Help and Docs", lambda: open_new_tab(__url__))
     self.toolbar.addAction(QIcon.fromTheme("help-about"), "About Qt 5",
                            lambda: QMessageBox.aboutQt(self))
     self.toolbar.addAction(QIcon.fromTheme("help-about"), "About Python 3",
                            lambda: open_new_tab('http://python.org/about'))
     self.toolbar.addAction(QIcon.fromTheme("application-exit"),
                            "Quit", self.close)
     self.toolbar.addSeparator()
     if list_of_actions and len(list_of_actions):
         for action in list_of_actions:  # if list_of_actions, add actions.
             self.toolbar.addAction(action)
         self.toolbar.addSeparator()
     self.toolbar.addWidget(self.right_spacer)
     self.addToolBar(self.toolbar)
     if sys.platform.startswith("win"):
         self.toolbar.hide()  # windows dont have QIcon.fromTheme,so hide.
     return self.toolbar
Example #4
0
    def __init__(self):
        # Aufruf des Konstruktors für die Oberklasse QMainWindow
        super().__init__()
        # Festlegung der linken oberen Ecke (100,100) des Fensters in Bildschirmkoordinaten.
        # Festerbreite und -höhe betragen 600 x 600 Pixel.
        self.setGeometry(100, 100, 600, 600)

        # Erzeugung einer Menüleiste.
        menubar = self.menuBar()
        menubar.setNativeMenuBar(False)

        # Die Menüleiste enhält zwei Pulldown-Menüs: File + View
        fileMenu = menubar.addMenu('&File')
        # Das Pulldown-Menü 'File' besteht nur aus einem 'Exit' Eintrag. Wenn dieser
        # ausgewählt wird, wird die Anwendung verlassen (durch Aufruf der Memberfunktion close).
        fileMenu.addAction('Exit', self.close)
        # Das Pulldown-Menü 'View' besteht aus zwei Einträgen: 'Save' und 'About'.
        viewMenu = menubar.addMenu("&View")
        # Untermenü-Eintrag 'Save'. Bei Aktivierung wird die Memberfunktion saveTest aufgerufen.
        viewMenu.addAction('Save', lambda: self.saveTest())
        # Untermenü-Entrag 'About'. Bei Aktivierung wird eine MessageBox geöffnet.
        viewMenu.addAction('About Qt 5', lambda: QMessageBox.aboutQt(self))

        # Anlegen einer eigenen Zeichenfläche als zentrales Widget des QMainWindow.
        # Aufruf des Konstruktors für die von QWidget abgeleitete eigene Klasse MyRenderArea.
        renderarea = MyRenderArea(self)
        self.setCentralWidget(renderarea)

        # Anlegen einer Statuszeile am unteren Rand des QMainWindow.
        statusbar = self.statusBar()
        # Anzeigen eines Textes in der Statuszeile für eine Sekunde.
        statusbar.showMessage('Start', 1000)

        # Anzeigen des QMainWindow.
        self.show()
Example #5
0
 def make_toolbar(self, list_of_actions=None):
     """Make or Update the main Tool Bar."""
     self.toolbar = QToolBar(self)
     self.left_spacer, self.right_spacer = QWidget(self), QWidget(self)
     self.left_spacer.setSizePolicy(1 | 2, 1 | 2)  # Expanding, Expanding
     self.right_spacer.setSizePolicy(1 | 2, 1 | 2)  # Expanding, Expanding
     self.toolbar.addAction("Menu",
                            lambda: self.menubar.exec_(QCursor.pos()))
     self.toolbar.addWidget(self.left_spacer)
     self.toolbar.addSeparator()
     self.toolbar.addAction(QIcon.fromTheme("help-contents"),
                            "Help and Docs", lambda: open_new_tab(__url__))
     self.toolbar.addAction(QIcon.fromTheme("help-about"), "About Qt 5",
                            lambda: QMessageBox.aboutQt(self))
     self.toolbar.addAction(QIcon.fromTheme("help-about"), "About Python 3",
                            lambda: open_new_tab('http://python.org/about'))
     self.toolbar.addAction(QIcon.fromTheme("application-exit"), "Quit",
                            self.close)
     self.toolbar.addSeparator()
     if list_of_actions and len(list_of_actions):
         for action in list_of_actions:  # if list_of_actions, add actions.
             self.toolbar.addAction(action)
         self.toolbar.addSeparator()
     self.toolbar.addWidget(self.right_spacer)
     self.addToolBar(self.toolbar)
     if sys.platform.startswith("win"):
         self.toolbar.hide()  # windows dont have QIcon.fromTheme,so hide.
     return self.toolbar
Example #6
0
    def __init__(self, parent=None, file=None):
        super().__init__(parent)
        self.setupUi(self)
        self.actionNew.triggered.connect(self.newFile)
        self.actionOpen.triggered.connect(lambda: self.openFile(None))
        self.actionSave.triggered.connect(self.saveFile)
        self.actionChangeColor.triggered.connect(self.changeColor)

        self.actionAbout.triggered.connect(self.about)
        self.actionAboutQt.triggered.connect(lambda: QMessageBox.aboutQt(self, "About Qt"))
        self.textEdit.textChanged.connect(lambda: self.setWindowModified(True))

        self.textEdit.cursorPositionChanged.connect(self.updateLineCol)
        self.textEdit.cursorPositionChanged.connect(self.updateFont)
        self.statusbar.showMessage("Ln 1, Col 1")
        self.fontComboBox.setEditable(False)
        self.toolBar_2.addWidget(self.fontComboBox)
        self.toolBar_2.addWidget(self.doubleSpinBox)

        self.titleTemplate = "[*] -- ENES Editor"
        self.fileName = file

        if file is not None and not os.path.exists(self.fileName):
            self.fileName = None

        if self.fileName is None:
            self.newFile()
        else:
            self.openFile(self.fileName)
            self._baseFile = os.path.basename(self.fileName)
 def on_bTest_clicked(self):
     """
     Private method to test the selected options.
     """
     if self.rAbout.isChecked():
         QMessageBox.about(
             None,
             self.eCaption.text(),
             self.eMessage.toPlainText()
         )
     elif self.rAboutQt.isChecked():
         QMessageBox.aboutQt(
             None,
             self.eCaption.text()
         )
     else:
         self.__testQt42()
Example #8
0
    def create_actions(self):
        '''Creates actions.'''
        # === file actions ===
        self.action_open = QAction('&Open...',
                                   self,
                                   shortcut='Ctrl+O',
                                   triggered=self.open_images)
        self.action_save = QAction('&Save...',
                                   self,
                                   shortcut='Ctrl+S',
                                   triggered=self.save_images,
                                   enabled=False)

        # === edit actions ===
        self.action_incr_threshold = QAction(
            '&Increase Threshold',
            self,
            shortcut='Ctrl+Right',
            triggered=self.change_threshold_val(1),
            enabled=False)

        self.action_decr_threshold = QAction(
            '&Decrease Threshold',
            self,
            shortcut='Ctrl+Left',
            triggered=self.change_threshold_val(-1),
            enabled=False)
        self.action_incr_threshold_by_5 = QAction(
            'I&ncrease Threshold by 5%',
            self,
            shortcut='Ctrl+Shift+Right',
            triggered=self.change_threshold_val(5),
            enabled=False)
        self.action_decr_threshold_by_5 = QAction(
            'D&ecrease Threshold by 5%',
            self,
            shortcut='Ctrl+Shift+Left',
            triggered=self.change_threshold_val(-5),
            enabled=False)

        # === go actions ===
        self.action_next_image = QAction('&Next Image',
                                         self,
                                         shortcut='Right',
                                         triggered=self.next_image,
                                         enabled=False)
        self.action_prev_image = QAction('&Previous Image',
                                         self,
                                         shortcut='Left',
                                         triggered=self.prev_image,
                                         enabled=False)

        # === about actions ===
        self.action_show_about = QAction('&About',
                                         self,
                                         triggered=self.show_about)
        self.action_show_about_qt = QAction(
            'About &Qt', self, triggered=lambda: QMessageBox.aboutQt(self))
Example #9
0
    def __init__(self):
        QMainWindow.__init__(self)
        self.ui = PyQt5.uic.loadUi('gui/resources/ui/mainwindow.ui', self)
        # Restore window and docket windows location
        settings = QSettings("Retina", "AVEX")
        if settings.value("DOCK_LOCATIONS"):
            self.restoreState(settings.value("DOCK_LOCATIONS"), 1.2)

        # Set the main windows icon
        self.setWindowIcon(QIcon("gui/resources/icons/avex.ico"))

        # Create python shell
        self.python_shell = InternalShell(self.dockWidget_console, namespace=globals(), commands=[], message='',
                                          max_line_count=300, font=None, exitfunc=None, profile=False,
                                          multithreaded=False, light_background=False)
        self.dockWidget_console.setWidget(self.python_shell)
        self.dockWidget_console.setWindowTitle('Python '+platform.python_version()+ ' console')

        #Workspace toolbar
        for i in range(0, workspace.max_workspaces):
            button=QPushButton(str(i),self)
            button.setMaximumWidth(25)
            button.setCheckable(True)
            button.setFlat(True)
            button.setToolTip("Workspace "+str(i))
            workspace.buttons.append(button)
            self.toolBar_workspaces.addWidget(button)
        workspace.buttons[0].setChecked(True)
        workspace.buttons[0].clicked.connect(lambda: workspace.switch(0))
        workspace.buttons[1].clicked.connect(lambda: workspace.switch(1))
        workspace.buttons[2].clicked.connect(lambda: workspace.switch(2))
        workspace.buttons[3].clicked.connect(lambda: workspace.switch(3))


        # Connect up the buttons.
        #File menu
        self.actionOpen.triggered.connect(self.open_file)
        self.actionNew_Script.triggered.connect(self.open_python_editor)
        #Help menu
        self.actionGithub_Repository.triggered.connect(lambda : QDesktopServices.openUrl(QUrl("https://github.com/jromang/retina")))
        self.actionQt_Version.triggered.connect(lambda : QMessageBox.aboutQt(self))
        self.actionUser_Forum.triggered.connect(lambda : QDesktopServices.openUrl(QUrl("http://www.avex-asso.org/forum/viewforum.php?f=34")))

        # Set model
        #self.listView_images.setModel(cw.image_list_model)

        process_widget=ProcessIconWidget()
        self.mdiArea.addSubWindow(process_widget)
        workspace.add(process_widget)

        self.ui.show()
Example #10
0
def create_actions(MAIN):
    """Create all the possible actions."""
    actions = MAIN.action  # actions was already taken
    """ ------ OPEN SETTINGS ------ """
    actions['open_settings'] = QAction(QIcon(ICON['settings']), 'Settings',
                                       MAIN)
    actions['open_settings'].triggered.connect(MAIN.show_settings)
    """ ------ CLOSE WINDOW ------ """
    actions['close_wndw'] = QAction(QIcon(ICON['quit']), 'Quit', MAIN)
    actions['close_wndw'].triggered.connect(MAIN.close)
    """ ------ ABOUT ------ """
    actions['about'] = QAction('About WONAMBI', MAIN)
    actions['about'].triggered.connect(MAIN.about)

    actions['aboutqt'] = QAction('About Qt', MAIN)
    actions['aboutqt'].triggered.connect(lambda: QMessageBox.aboutQt(MAIN))
Example #11
0
    def setup(self):
        self.user = "******"
        #加载日志管理器
        self.log = Log()
        #加载设置器c
        self.cfg = config
        
        #设置菜单栏的Action,绑定方法
        self.exit_ac.triggered.connect(self.close)
        self.edit_plicy_ac.triggered.connect(self.showPolicyManager)
        self.edit_item_ac.triggered.connect(self.showItemManager)
        self.ab_qt_ac.triggered.connect(lambda _,s="关于qt":QMessageBox.aboutQt(self,s))
        self.ab_author_ac.triggered.connect(self.showAuthor)
        self.ab_version_ac.triggered.connect(self.showVersion)
        self.logout_ac.triggered.connect(self.logout)
        self.help_ac.triggered.connect(self.showHelp)

        #设置tabelwidgets表头的尺寸#
        self.tableWidget.setColumnWidth(0,140)
        self.tableWidget.setColumnWidth(1,120)
        self.tableWidget.setColumnWidth(2,200)   
        #设置表头的行高
        self.tableWidget.setRowHeight(0,20)
        
        #在客户栏中初始化列表
        self.combo_list=(self.custom_cb,self.module_cb,self.name_cb,self.pn_cb)
        self.custom_cb.addItems(self.cfg.policy_cfg.keys())
        
        #设置系统托盘
        self.tray = QSystemTrayIcon(self)
        self.tray.setIcon(QIcon(":/bo/resource/ico.png"))
        minimizeAction = QAction("最小化", self, triggered = self.hide)
        maximizeAction = QAction("最大化", self, triggered = self.showMaximized)
        restoreAction = QAction("恢复默认大小", self, triggered = self.showNormal)
        quitAction = QAction("退出", self, triggered = QApplication.instance().quit)  # 退出APP
        self.trayMenu = QMenu(self)
        self.trayMenu.addAction(minimizeAction)
        self.trayMenu.addAction(maximizeAction)
        self.trayMenu.addAction(restoreAction)
        self.trayMenu.addSeparator()
        self.trayMenu.addAction(quitAction)
        self.tray.setContextMenu(self.trayMenu)
        self.tray.setToolTip('条码检查标签在这!')
        self.tray.showMessage("条码", '托盘信息内容', icon=1) #icon的值  0没有图标  1是提示  2是警告  3是错误
        self.tray.show()
Example #12
0
    def __init__(self, parent=None, *args):
        CommonWindow.__init__(self, WINDOW_SIZE, parent, *args)
        label_image_ai_version = QLabel(NAME_LABEL_IMAGE_AI_VERSION)
        label_app_version = QLabel(NAME_LABEL_APP_VERSION)

        label_information_qt = ClickedLabel(NAME_LABEL_INFORMATION_QT)
        label_information_qt.clicked.connect(lambda: QMessageBox.aboutQt(self))

        btn_back = QPushButton(NAME_BTN_BACK)
        btn_back.clicked.connect(self.back)

        vbox = QVBoxLayout()
        for widget in [
                label_image_ai_version, label_app_version,
                label_information_qt, btn_back
        ]:
            vbox.addWidget(widget)

        self.setLayout(vbox)
Example #13
0
def create_actions(MAIN):
    """Create all the possible actions."""
    actions = MAIN.action  # actions was already taken

    """ ------ OPEN SETTINGS ------ """
    actions['open_settings'] = QAction(QIcon(ICON['settings']), 'Settings',
                                       MAIN)
    actions['open_settings'].triggered.connect(MAIN.show_settings)

    """ ------ CLOSE WINDOW ------ """
    actions['close_wndw'] = QAction(QIcon(ICON['quit']), 'Quit', MAIN)
    actions['close_wndw'].triggered.connect(MAIN.close)

    """ ------ ABOUT ------ """
    actions['about'] = QAction('About PHYPNO', MAIN)
    actions['about'].triggered.connect(MAIN.about)

    actions['aboutqt'] = QAction('About Qt', MAIN)
    actions['aboutqt'].triggered.connect(lambda: QMessageBox.aboutQt(MAIN))
Example #14
0
    def create_signal_slot(self):
        self.Com_Open_Button.clicked.connect(self.com_open_button_clicked)
        self.Com_Close_Button.clicked.connect(self.com_close_button_clicked)
        self.Send_Button.clicked.connect(self.send_button_clicked)
        self.Com_Refresh_Button.clicked.connect(
            self.com_refresh_button_clicked)
        self.uart.readyRead.connect(self.com_receive_data)  # 接收数据
        # self.uart.connectNotify.connect(lambda x: print("New connect"))
        self.hexSending_checkBox.stateChanged.connect(self.hex_showing_clicked)
        self.hexSending_checkBox.stateChanged.connect(self.hex_sending_clicked)
        # self.About_Button.clicked.connect(self.Goto_GitHub)
        self.pushButton_readMCU.clicked.connect(self.send_read_mcu)
        # self.checkBox_UseOpenCV.stateChanged.connect(self.on_open_cv_use_clicked)
        self.checkBox_showGrid.stateChanged.connect(self.on_show_grid_changed)
        self.pushButton_saveImg.clicked.connect(self.save_img)
        self.pushButton_clear_dict.clicked.connect(self.on_clear_dict)
        # self.comboBox_transpose.currentIndexChanged.connect(
        #     self.tab_piano.on_tranpose_change
        # )
        # self.textEdit_Recive.textChanged.connect(lambda: self.textEdit_Recive.moveCursor(QTextCursor.End))
        # self.textEdit_Recive.

        # 自定义信号槽
        self.uart.signal_update_standard_gui.connect(self.update_standard_gui)
        self.tabWidget_other.currentChanged.connect(self.update_standard_gui)
        self.tab_piano.send_msg.connect(self.uart.write)

        # Action
        self.action_uart.changed.connect(
            lambda: self.dockWidget_uart.setHidden(not self.action_uart.
                                                   isChecked()))
        self.dockWidget_uart.visibilityChanged.connect(
            lambda b: self.action_uart.setChecked(b))
        self.action_exit.triggered.connect(lambda: QApplication.exit())
        self.actionAbout_Qt.triggered.connect(
            lambda: QMessageBox.aboutQt(self, "About Qt"))
        self.actionAboutThis.triggered.connect(self.on_about_this)
        self.action_stop.triggered.connect(
            lambda: self.uart.write(b'\xc10 0\0'))
Example #15
0
 def init_corner_menus(self):
     self.menu_1, self.menu_0 = QToolButton(self), QToolButton(self)
     self.menu_1.setText(" ⚙ ")
     self.menu_1.setToolTip("<b>Options, Extras")
     self.menu_0.setText(" ? ")
     self.menu_0.setToolTip("<b>Help, Info")
     font = self.menu_1.font()
     font.setBold(True)
     self.menu_1.setFont(font)
     self.menu_0.setFont(font)
     self.menu_tool, self.menu_help = QMenu("Tools Extras"), QMenu("Help")
     self.menu_tool.addAction(" Tools & Extras ").setDisabled(True)
     self.menu_help.addAction(" Help & Info ").setDisabled(True)
     self.menu_0.setMenu(self.menu_help)
     self.menu_1.setMenu(self.menu_tool)
     self.menu_tool.addAction("Explain Unicode", self.make_explain_unicode)
     self.menu_tool.addAction("Alternate Case Clipboard",
                              self.alternate_clipboard)
     self.menu_tool.addSeparator()
     self.menu_tool.addAction("AutoCenter Window", self.center)
     self.menu_tool.addAction("Set Icon", self.set_icon)
     self.menu_tool.addAction(  # force recreate desktop file
         "Add Launcher to Desktop", lambda: set_desktop_launcher(
             "unicodemoticon", AUTOSTART_DESKTOP_FILE, True))
     self.menu_tool.addAction("Move to Mouse position",
                              self.move_to_mouse_position)
     self.menu_tool.addSeparator()
     self.menu_tool.addAction("Minimize", self.showMinimized)
     self.menu_tool.addAction("Hide", self.hide)
     self.menu_tool.addAction("Quit", exit)
     self.menu_help.addAction("About Qt 5",
                              lambda: QMessageBox.aboutQt(None))
     self.menu_help.addAction("About Unicodemoticon",
                              lambda: open_new_tab(__url__))
     self.setCornerWidget(self.menu_1, 1)
     self.setCornerWidget(self.menu_0, 0)
     self.currentChanged.connect(self.make_tabs_previews)
     self.currentChanged.connect(self.make_tabs_fade)
Example #16
0
    def createMenu(self):
        self.mainMenu = self.menuBar()

        fileMenu = self.mainMenu.addMenu("File")
        self.snapAction = Action(self, "Snap", self.on_snapAction, "Space",
                                 False)
        fileMenu.addAction(self.snapAction)
        self.saveAction = Action(self, "Save", self.on_saveAction, "Ctrl+S",
                                 False)
        fileMenu.addAction(self.saveAction)
        self.saveAsAction = Action(self, "Save As...", self.on_saveAsAction,
                                   "Ctrl+Shift+S", False)
        fileMenu.addAction(self.saveAsAction)
        fileMenu.addAction(Action(self, "Quit", lambda: self.close(),
                                  "Ctrl+Q"))

        toolsMenu = self.mainMenu.addMenu("Tools")
        toolsMenu.addAction(Action(self, "Options", self.options.show))

        helpMenu = self.mainMenu.addMenu("Help")
        helpMenu.addAction(Action(self, "About", self.on_aboutAction))
        helpMenu.addAction(
            Action(self, "About Qt", lambda: QMessageBox.aboutQt(self)))
Example #17
0
 def qt(self):
     x = QMessageBox()
     x.aboutQt(self, "关于Qt版本")
     print("11")
Example #18
0
 def QT_callback(self):
     # 设置帮助菜单中的关于QT的信息介绍
     QMessageBox.aboutQt(self, 'About QT')
Example #19
0
 def make_menubar(self, list_of_actions=None):
     """Make or Update the main Tool Bar."""
     self.menuBar().addMenu("&File").addAction("Exit", self.close)
     self.menubar.addMenu("&File").addAction("Exit", self.close)
     viewMenu = self.menuBar().addMenu("&View")
     viewMenu.addAction(
         "Toggle ToolBar", lambda:
             self.toolbar.setVisible(not self.toolbar.isVisible()))
     viewMenu.addAction(
         "Toggle StatusBar", lambda:
             self.statusBar().setVisible(not self.statusBar().isVisible()))
     viewMenu.addAction(
         "Toggle MenuBar", lambda:
             self.menuBar().setVisible(not self.menuBar().isVisible()))
     viewMenu2 = self.menubar.addMenu("&View")
     for action in viewMenu.actions():
         viewMenu2.addAction(action)
     windowMenu = self.menuBar().addMenu("&Window")
     windowMenu.addAction("Minimize", lambda: self.showMinimized())
     windowMenu.addAction("Maximize", lambda: self.showMaximized())
     windowMenu.addAction("Restore", lambda: self.showNormal())
     windowMenu.addAction("Full-Screen", lambda: self.showFullScreen())
     windowMenu.addAction("Center", lambda: self.center())
     windowMenu.addAction("Top-Left", lambda: self.move(0, 0))
     windowMenu.addAction("To Mouse", lambda: self.move(QCursor.pos()))
     windowMenu.addSeparator()
     windowMenu.addAction("Increase size", lambda: self.resize(
         self.size().width() * 1.5, self.size().height() * 1.5))
     windowMenu.addAction("Decrease size", lambda: self.resize(
         self.size().width() // 1.5, self.size().height() // 1.5))
     windowMenu.addAction("Minimum size", lambda:
                          self.resize(self.minimumSize()))
     windowMenu.addAction("Maximum size", lambda:
                          self.resize(self.maximumSize()))
     windowMenu.addAction("Horizontal Wide", lambda: self.resize(
         self.maximumSize().width(), self.minimumSize().height()))
     windowMenu.addAction("Vertical Tall", lambda: self.resize(
         self.minimumSize().width(), self.maximumSize().height()))
     windowMenu.addSeparator()
     windowMenu.addAction("Disable Resize", lambda:
                          self.setFixedSize(self.size()))
     windowMenu2 = self.menubar.addMenu("&Window")
     for action in windowMenu.actions():
         windowMenu2.addAction(action)
     optionMenu = self.menuBar().addMenu("&Options")
     optionMenu.addAction("Set Interface Font...", lambda:
                          self.setFont(QFontDialog.getFont(self)[0]))
     optionMenu.addAction("Load CSS Skin...", lambda:
                          self.setStyleSheet(self.skin()))
     optionMenu.addAction("Take ScreenShoot...", lambda: self.grab().save(
         QFileDialog.getSaveFileName(self, "Save", os.path.expanduser("~"),
                                     "(*.png) PNG image file", "png")[0]))
     optionMenu2 = self.menubar.addMenu("&Options")
     for action in optionMenu.actions():
         optionMenu2.addAction(action)
     helpMenu = self.menuBar().addMenu("&Help")
     helpMenu.addAction("About Qt 5", lambda: QMessageBox.aboutQt(self))
     helpMenu.addAction("About Python 3", lambda:
                        open_new_tab('https://www.python.org/about'))
     helpMenu.addSeparator()
     if sys.platform.startswith('linux'):
         helpMenu.addAction("View Source Code",
                            lambda: open_new_tab(__file__))
     helpMenu.addAction("View GitHub Repo", lambda: open_new_tab(__url__))
     helpMenu.addAction("Report Bugs", lambda:
                        open_new_tab(__url__ + '/issues?state=open'))
     helpMenu2 = self.menubar.addMenu("&Help")
     for action in helpMenu.actions():
         helpMenu2.addAction(action)
     return self.menuBar()
Example #20
0
 def about(self):
     QMessageBox.aboutQt(None, self.tr("Acerca de Qt"))
Example #21
0
    def on_actionAbout_triggered(self):
        """
        Slot documentation goes here.
        """

        QMessageBox.aboutQt(self)
    def InitWindow(self):
        mainMenu = self.menuBar()
        mainMenu.setToolTip('This is a <b>MenuBar</b> widget')
        self.menuBarLayout.addWidget(mainMenu)
        fileMenu = mainMenu.addMenu('File')
        OpenFile = QAction('Open File', self)
        fileMenu.addAction(OpenFile)
        fileMenu.addAction('Open Folder')
        fileMenu.addAction('Save File')
        fileMenu.addAction('Save File as')
        fileMenu.addAction('Exit')

        editMenu = mainMenu.addMenu('Edit')
        editMenu.addAction('Cut')
        editMenu.addAction('Copy')
        editMenu.addAction('Paste')
        editMenu.addAction('Delete')
        editMenu.addAction('Preferences')

        viewMenu = mainMenu.addMenu('View')
        viewMenu.addAction('Rotate View')
        viewMenu.addAction('Page Navigation')
        viewMenu.addAction('Page Display')
        viewMenu.addAction('Zoom')
        viewMenu.addAction("Set Interface Font...",
                           lambda: self.setFont(QFontDialog.getFont(self)[0]))
        viewMenu.addAction(
            "Take ScreenShoot...", lambda: self.grab().save(
                QFileDialog.
                getSaveFileName(self, "Save", os.path.expanduser("~"),
                                "(*.png) PNG image file", "png")[0]))
        windowMenu = mainMenu.addMenu('Window')
        windowMenu.addAction('New Window', lambda: uuu())
        windowMenu.addAction('Minimize All')

        helpMenu = mainMenu.addMenu('Help')
        helpMenu.addAction('About App')
        helpMenu.addAction('About Developers')
        helpMenu.addAction("About Qt 5", lambda: QMessageBox.aboutQt(self))
        helpMenu.addAction(
            "About Python 3",
            lambda: open_new_tab('https://www.python.org/about'))

        self.setLayout(self.menuBarLayout)
        toolbar_layout = QVBoxLayout()

        self.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)
        self.setIconSize(QSize(50, 30))
        toolbar = self.addToolBar("File")
        toolbar.setMovable(False)
        openfile = QAction(self,
                           icon=QIcon("icons/File1.png"),
                           text="Open File ")
        openfile.triggered.connect(self.OpenFile)
        toolbar.addAction(openfile)
        openfolder = QAction(self,
                             icon=QIcon('icons/Folder1.png'),
                             text="Open Folder")
        openfolder.triggered.connect(self.OpenFolder)
        toolbar.addAction(openfolder)
        openwebpage = QAction(self,
                              icon=QIcon('icons/webpage.png'),
                              text="Open Webpage")
        # openwebpage.triggered.connect(self.OpenFolder)
        toolbar.addAction(openwebpage)
        analyse = QAction(self,
                          icon=QIcon('icons/Analyse1.png'),
                          text="Extract")
        toolbar.addAction(analyse)
        analyse.triggered.connect(self.Analyse_Text)
        exit = QAction(self, icon=QIcon('icons/Exit2.png'), text="Exit")
        toolbar.addAction(exit)
        exit.triggered.connect(self.CloseApp)
        restart = QAction(self,
                          icon=QIcon('icons/Restart1.png'),
                          text="Restart")
        toolbar.addAction(restart)
        # exit.triggered.connect(restartMe)
        spacer = QWidget()
        spacer.setSizePolicy(QSizePolicy.Expanding,
                             QSizePolicy.Expanding)  # Study this later
        toolbar.addWidget(spacer)
        setting = QAction(self,
                          icon=QIcon('icons/Support3.png'),
                          text="Preferences")
        toolbar.addAction(setting)
        help = QAction(self,
                       icon=QIcon('icons/Help1.png'),
                       text="Get Assistance")
        toolbar.addAction(help)
        self.setLayout(toolbar_layout)

        self.statusBar = QStatusBar()
        self.setStatusBar(self.statusBar)
        self.statusBar.showMessage(" This is My Status Bar's Message")

        self.setWindowTitle(self.title)
        self.setGeometry(self.top, self.left, self.width, self.height)
Example #23
0
 def show_about_qt(self):
     """Show About Qt Dialog."""
     QMessageBox.aboutQt(self, translations.TR_ABOUT_QT)
Example #24
0
 def onAboutQt(self):
     QMessageBox.aboutQt(self.defaultStyleWidget)
Example #25
0
 def selectAboutQt(self):
     QMessageBox.aboutQt(self,"About Qt")
     self.resultLabel.setText("About Qt")
 def on_actionAboutQt_triggered(self):
     QMessageBox.aboutQt(self, "About Qt")
Example #27
0
 def aboutQt(self):
     QMessageBox.aboutQt(self)
Example #28
0
 def onAboutQt(self):
     QMessageBox.aboutQt(self.defaultStyleWidget)
Example #29
0
 def __init__(self):
     """Init class."""
     super(MainWindow, self).__init__()
     self.statusBar().showMessage(getoutput(SYNCTHING + ' --version'))
     self.setWindowTitle(__doc__.strip().capitalize())
     self.setMinimumSize(640, 480)
     self.setMaximumSize(1280, 1024)
     self.resize(self.minimumSize())
     self.setWindowIcon(QIcon.fromTheme("text-x-python"))
     self.center()
     self.view = QWebView(self)
     self.view.loadFinished.connect(self.finishLoading)
     self.view.page().linkHovered.connect(
         lambda link_txt: self.statusBar().showMessage(link_txt[:99], 3000))
     QShortcut("Ctrl++", self, activated=lambda:
               self.view.setZoomFactor(self.view.zoomFactor() + 0.2))
     QShortcut("Ctrl+-", self, activated=lambda:
               self.view.setZoomFactor(self.view.zoomFactor() - 0.2))
     QShortcut("Ctrl+0", self, activated=lambda: self.view.setZoomFactor(1))
     QShortcut("Ctrl+q", self, activated=lambda: self.close())
     self.menuBar().addMenu("File").addAction("Exit", lambda: self.close())
     syncMenu = self.menuBar().addMenu("Sync")
     syncMenu.addAction("Stop Syncronization", lambda: self.process.kill())
     syncMenu.addAction("Start Syncronization", lambda: self.run())
     viewMenu = self.menuBar().addMenu("View")
     viewMenu.addAction(
         "Zoom In",
         lambda: self.view.setZoomFactor(self.view.zoomFactor() + .2))
     viewMenu.addAction(
         "Zoom Out",
         lambda: self.view.setZoomFactor(self.view.zoomFactor() - .2))
     viewMenu.addAction(
         "Zoom To...", lambda: self.view.setZoomFactor(QInputDialog.getInt(
             self, __doc__, "<b>Zoom factor ?:", 1, 1, 9)[0]))
     viewMenu.addAction("Zoom Reset", lambda: self.view.setZoomFactor(1))
     viewMenu.addSeparator()
     viewMenu.addAction("Page Source", self.viewSource)
     viewMenu.addAction("Open Web", lambda: open_new_tab(URL))
     windowMenu = self.menuBar().addMenu("&Window")
     windowMenu.addAction("Minimize", lambda: self.showMinimized())
     windowMenu.addAction("Maximize", lambda: self.showMaximized())
     windowMenu.addAction("Restore", lambda: self.showNormal())
     windowMenu.addAction("Center", lambda: self.center())
     windowMenu.addAction("Top-Left", lambda: self.move(0, 0))
     windowMenu.addAction("To Mouse", lambda: self.move_to_mouse_position())
     windowMenu.addAction("Fullscreen", lambda: self.showFullScreen())
     windowMenu.addSeparator()
     windowMenu.addAction("Increase size", lambda: self.resize(
         self.size().width() * 1.2, self.size().height() * 1.2))
     windowMenu.addAction("Decrease size", lambda: self.resize(
         self.size().width() // 1.2, self.size().height() // 1.2))
     windowMenu.addAction("Minimum size", lambda:
                          self.resize(self.minimumSize()))
     windowMenu.addAction("Maximum size", lambda:
                          self.resize(self.maximumSize()))
     windowMenu.addAction("Horizontal Wide", lambda: self.resize(
         self.maximumSize().width(), self.minimumSize().height()))
     windowMenu.addAction("Vertical Tall", lambda: self.resize(
         self.minimumSize().width(), self.maximumSize().height()))
     windowMenu.addSeparator()
     windowMenu.addAction("Disable Resize",
                          lambda: self.setFixedSize(self.size()))
     helpMenu = self.menuBar().addMenu("&Help")
     helpMenu.addAction("Support Forum", lambda: open_new_tab(HELP_URL_0))
     helpMenu.addAction("Lastest Release", lambda: open_new_tab(HELP_URL_1))
     helpMenu.addAction("Documentation", lambda: open_new_tab(HELP_URL_2))
     helpMenu.addAction("Bugs", lambda: open_new_tab(HELP_URL_3))
     helpMenu.addAction("Source Code", lambda: open_new_tab(HELP_URL_4))
     helpMenu.addSeparator()
     helpMenu.addAction("About Qt 5", lambda: QMessageBox.aboutQt(self))
     helpMenu.addAction("About Python 3",
                        lambda: open_new_tab('https://www.python.org'))
     helpMenu.addAction("About" + __doc__,
                        lambda: QMessageBox.about(self, __doc__, HELPMSG))
     helpMenu.addSeparator()
     helpMenu.addAction("Keyboard Shortcuts", lambda:
                        QMessageBox.information(self, __doc__, SHORTCUTS))
     helpMenu.addAction("View GitHub Repo", lambda: open_new_tab(__url__))
     if not sys.platform.startswith("win"):
         helpMenu.addAction("Show Source Code", lambda: call(
             ('xdg-open ' if sys.platform.startswith("linux") else 'open ')
             + __file__, shell=True))
     helpMenu.addSeparator()
     helpMenu.addAction("Check Updates", lambda: self.check_for_updates())
     # process
     self.process = QProcess()
     self.process.error.connect(self._process_failed)
     # backend options
     self.chrt = QCheckBox("Smooth CPU ", checked=True)
     self.ionice = QCheckBox("Smooth HDD ", checked=True)
     self.chrt.setToolTip("Use Smooth CPUs priority (recommended)")
     self.ionice.setToolTip("Use Smooth HDDs priority (recommended)")
     self.chrt.setStatusTip(self.chrt.toolTip())
     self.ionice.setStatusTip(self.ionice.toolTip())
     # main toolbar
     self.toolbar = self.addToolBar("SyncthinGUI Toolbar")
     self.toolbar.addAction(QIcon.fromTheme("media-playback-stop"),
                            "Stop Sync", lambda: self.process.kill())
     self.toolbar.addAction(QIcon.fromTheme("media-playback-start"),
                            "Restart Sync", lambda: self.run())
     self.toolbar.addSeparator()
     self.toolbar.addWidget(self.chrt)
     self.toolbar.addWidget(self.ionice)
     self.setCentralWidget(self.view)
     # Tray Icon
     tray = QSystemTrayIcon(QIcon.fromTheme("text-x-python"), self)
     tray.setToolTip(__doc__.strip().capitalize())
     traymenu = QMenu(self)
     traymenu.addAction(__doc__).setDisabled(True)
     traymenu.addSeparator()
     traymenu.addAction("Stop Sync", lambda: self.process.kill())
     traymenu.addAction("Restart Sync", lambda: self.run())
     traymenu.addSeparator()
     traymenu.addAction("Show", lambda: self.show_gui())
     traymenu.addAction("Hide", lambda: self.hide())
     traymenu.addSeparator()
     traymenu.addAction("Open Web", lambda: open_new_tab(URL))
     traymenu.addAction("Quit All", lambda: self.close())
     tray.setContextMenu(traymenu)
     tray.show()
     self.run()
Example #30
0
 def helpAboutQt(self):
     QMessageBox.aboutQt(self)
Example #31
0
    def __init__(self, parent=None):
        """Init class."""
        super(MainWindow, self).__init__()
        QNetworkProxyFactory.setUseSystemConfiguration(True)
        self.statusBar().showMessage(get_blender_version())
        self.setWindowTitle(__doc__.strip().capitalize())
        self.setMinimumSize(400, 200)
        self.setMaximumSize(1024, 800)
        self.resize(self.minimumSize())
        self.setWindowIcon(QIcon.fromTheme("blender"))
        self.center()
        QShortcut("Ctrl+q", self, activated=lambda: self.close())
        self.menuBar().addMenu("&File").addAction("Exit", exit)
        windowMenu = self.menuBar().addMenu("&Window")
        windowMenu.addAction("Minimize", lambda: self.showMinimized())
        windowMenu.addAction("Maximize", lambda: self.showMaximized())
        windowMenu.addAction("Restore", lambda: self.showNormal())
        windowMenu.addAction("FullScreen", lambda: self.showFullScreen())
        windowMenu.addAction("Center", lambda: self.center())
        windowMenu.addAction("Top-Left", lambda: self.move(0, 0))
        windowMenu.addAction("To Mouse", lambda: self.move_to_mouse_position())
        windowMenu.addSeparator()
        windowMenu.addAction(
            "Increase size", lambda:
            self.resize(self.size().width() * 1.4, self.size().height() * 1.4))
        windowMenu.addAction("Decrease size", lambda: self.resize(
            self.size().width() // 1.4, self.size().height() // 1.4))
        windowMenu.addAction("Minimum size", lambda:
                             self.resize(self.minimumSize()))
        windowMenu.addAction("Maximum size", lambda:
                             self.resize(self.maximumSize()))
        windowMenu.addAction("Horizontal Wide", lambda: self.resize(
            self.maximumSize().width(), self.minimumSize().height()))
        windowMenu.addAction("Vertical Tall", lambda: self.resize(
            self.minimumSize().width(), self.maximumSize().height()))
        windowMenu.addSeparator()
        windowMenu.addAction("Disable Resize", lambda:
                             self.setFixedSize(self.size()))
        windowMenu.addAction("Set Interface Font...", lambda:
                             self.setFont(QFontDialog.getFont()[0]))
        windowMenu.addAction(
            "Load .qss Skin", lambda: self.setStyleSheet(self.skin()))
        helpMenu = self.menuBar().addMenu("&Help")
        helpMenu.addAction("About Qt 5", lambda: QMessageBox.aboutQt(self))
        helpMenu.addAction("About Python 3",
                           lambda: open_new_tab('https://www.python.org'))
        helpMenu.addAction("About" + __doc__,
                           lambda: QMessageBox.about(self, __doc__, HELP))
        helpMenu.addSeparator()
        helpMenu.addAction(
            "Keyboard Shortcut",
            lambda: QMessageBox.information(self, __doc__, "<b>Quit = CTRL+Q"))
        if sys.platform.startswith('linux'):
            helpMenu.addAction(
                "View Source Code",
                lambda: call('xdg-open ' + __file__, shell=True))
        helpMenu.addAction("View GitHub Repo", lambda: open_new_tab(__url__))
        helpMenu.addAction("Report Bugs", lambda: open_new_tab(
            'https://github.com/juancarlospaco/bgelauncher/issues?state=open'))
        helpMenu.addAction("Check Updates", lambda: Downloader(self))
        # process
        self.process = QProcess()
        self.process.readyReadStandardOutput.connect(self._read_output)
        self.process.readyReadStandardError.connect(self._read_errors)
        self.process.finished.connect(self._process_finished)
        self.process.error.connect(self._process_failed)

        # widgets
        self.group0, self.group1 = QGroupBox("BGE"), QGroupBox("Resolutions")
        self.group2, self.group3 = QGroupBox("AntiAlias"), QGroupBox("3DViews")
        self.group4, self.group5 = QGroupBox("Dome mode"), QGroupBox("Misc")
        g0grid, g1vlay = QGridLayout(self.group0), QVBoxLayout(self.group1)
        g5vlay, g4vlay = QVBoxLayout(self.group5), QVBoxLayout(self.group4)
        g2vlay, g3vlay = QVBoxLayout(self.group2), QVBoxLayout(self.group3)

        # group 0 the game engine options
        self.fixedti = QCheckBox("Force frames")
        self.mipmaps = QCheckBox("No MipMaps")
        self.showfps = QCheckBox("Show F.P.S.")
        self.propert = QCheckBox("Debug properties")
        self.profile = QCheckBox("Debug profilings")
        self.materia = QCheckBox("OpenGL Materials")
        self.depreca = QCheckBox("Debug Deprecations")
        self.nosound = QCheckBox("No Audio")
        g0grid.addWidget(self.showfps, 0, 0)
        g0grid.addWidget(self.fixedti, 0, 1)
        g0grid.addWidget(self.propert, 0, 2)
        g0grid.addWidget(self.mipmaps, 0, 3)
        g0grid.addWidget(self.profile, 1, 0)
        g0grid.addWidget(self.materia, 1, 1)
        g0grid.addWidget(self.depreca, 1, 2)
        g0grid.addWidget(self.nosound, 1, 3)

        # group 1 screen resolutions
        self.fullscreen = QCheckBox("FullScreen")
        self.autodetect = QCheckBox("AutoDetect")
        self.width, self.heigt = QComboBox(), QComboBox()
        self.bpp = QComboBox()
        resols = [
            "240", "600", "640", "400", "480", "600", "640", "768", "800",
            "840", "1024", "1080", "1150", "1280", "1680", "1920", "2048"]
        self.width.addItems([str(self.get_half_of_resolution()[0])] + resols)
        self.heigt.addItems([str(self.get_half_of_resolution()[1])] + resols)
        self.bpp.addItems(["32", "16", "8"])
        _container1, _container2 = QWidget(), QWidget()
        _res_lay, _mis_lay = QHBoxLayout(_container1), QHBoxLayout(_container2)
        _res_lay.addWidget(self.width)
        _res_lay.addWidget(QLabel("Pixels Width"))
        _res_lay.addWidget(self.heigt)
        _res_lay.addWidget(QLabel("Pixels Heigth"))
        _mis_lay.addWidget(self.fullscreen)
        _mis_lay.addWidget(self.autodetect)
        _mis_lay.addWidget(self.bpp)
        _mis_lay.addWidget(QLabel("Bits per Pixel"))
        g1vlay.addWidget(_container1)
        g1vlay.addWidget(_container2)

        # group 2 antialiasing
        self.aaa, self.aas = QCheckBox("AntiAliasing"), QSpinBox()
        self.aas.setToolTip("Maximum anti-aliasing samples")
        self.aaa.setChecked(True)
        self.aas.setRange(2, 16)
        self.aas.setValue(16)
        self.aas.setSingleStep(2)
        g2vlay.addWidget(self.aaa)
        g2vlay.addWidget(QLabel("Maximum Samples"))
        g2vlay.addWidget(self.aas)

        # group 3 the 3d stereo view mode
        self.stereos, self.smode = QCheckBox("3D View"), QComboBox()
        self.smode.addItems([
            "NoStereo", "Anaglyph", "SideBySide", "SyncDoubling",
            "3DTVTopBottom", "Interlace", "VInterlace", "HWPageFlip"])
        g3vlay.addWidget(self.stereos)
        g3vlay.addWidget(QLabel("Stereoscopy"))
        g3vlay.addWidget(self.smode)
        g3vlay.addWidget(QLabel("<small><i>Requires 3D<br>capable hardware!"))

        # group 4 the dome view mode
        self.dome, self.dmode = QCheckBox("Dome View"), QComboBox()
        self.dmode.addItems(["Fisheye", "TruncatedFront", "TruncatedRear",
                             "CubeMap", "SphericalPanoramic"])
        self.dangle, self.dtilt = QSpinBox(), QSpinBox()
        self.dangle.setToolTip("Field of view in degrees")
        self.dtilt.setToolTip("Tilt angle in degrees")
        self.dangle.setRange(10, 360)
        self.dangle.setValue(10)
        self.dtilt.setRange(10, 360)
        self.dtilt.setValue(10)
        g4vlay.addWidget(self.dome)
        g4vlay.addWidget(QLabel("Field of view"))
        g4vlay.addWidget(self.dangle)
        g4vlay.addWidget(QLabel("Tilt angle"))
        g4vlay.addWidget(self.dtilt)

        # group 5 miscelaneous stuff
        self.debug, self.log = QCheckBox("Use Debug"), QCheckBox("Save Logs")
        self.chrt, self.ionice = QCheckBox("Slow CPU"), QCheckBox("Slow HDD")
        self.minimi = QCheckBox("Auto Minimize")
        self.embeds = QCheckBox("Wallpaper mode")
        self.chrt.setToolTip("Use Low CPU speed priority (Linux only)")
        self.ionice.setToolTip("Use Low HDD speed priority (Linux only)")
        self.debug.setToolTip("Use BGE Verbose logs,ideal for Troubleshooting")
        self.minimi.setToolTip("Automatically Minimize Launcher after launch")
        self.embeds.setToolTip("Embed Game as interactive Desktop Wallpaper")
        self.minimi.setChecked(True)
        if not sys.platform.startswith('linux'):
            self.chrt.setDisabled(True)
            self.ionice.setDisabled(True)
        g5vlay.addWidget(self.debug)
        g5vlay.addWidget(self.log)
        g5vlay.addWidget(self.chrt)
        g5vlay.addWidget(self.ionice)
        g5vlay.addWidget(self.embeds)
        g5vlay.addWidget(self.minimi)

        # option to show or hide some widgets on the gui
        self.guimode = QComboBox()
        self.guimode.addItems(('Full UX / UI', 'Simple UX / UI'))
        self.guimode.setCurrentIndex(1)
        self._set_guimode()
        self.guimode.setStyleSheet(
            """QComboBox{background:transparent;border:0;
            margin-left:25px;color:gray;text-decoration:underline}""")
        self.guimode.currentIndexChanged.connect(self._set_guimode)

        # buttons from bottom to close or proceed
        self.bt = QDialogButtonBox(self)
        self.bt.setStandardButtons(QDialogButtonBox.Ok |
                                   QDialogButtonBox.Close)
        self.bt.rejected.connect(self.close)
        self.bt.accepted.connect(self.run)

        # container for all groups of widgets
        container = QWidget()
        container_layout = QGridLayout(container)  # Y, X
        container_layout.addWidget(self.guimode, 0, 1)
        container_layout.addWidget(self.group2, 1, 0)
        container_layout.addWidget(self.group3, 2, 0)
        container_layout.addWidget(self.group0, 1, 1)
        container_layout.addWidget(self.group1, 2, 1)
        container_layout.addWidget(self.group4, 1, 2)
        container_layout.addWidget(self.group5, 2, 2)
        container_layout.addWidget(self.bt, 3, 1)
        self.setCentralWidget(container)
Example #32
0
 def showAboutQt(self):
     QMessageBox.aboutQt(self, "About Qt")
Example #33
0
 def on_actionAboutQt_triggered(self):
     QMessageBox.aboutQt(self, "About Qt")
Example #34
0
 def __init__(self, parent=None):
     """Init class."""
     super(MainWindow, self).__init__()
     # self.statusBar().showMessage(__doc__.strip().capitalize())
     self.setWindowTitle(__doc__.strip().capitalize())
     self.setMinimumSize(600, 200)
     self.setMaximumSize(800, 400)
     self.resize(self.minimumSize())
     self.setWindowIcon(QIcon.fromTheme("preferences-system"))
     self.center()
     QShortcut("Ctrl+q", self, activated=lambda: self.close())
     self.menuBar().addMenu("&File").addAction("Exit", exit)
     windowMenu = self.menuBar().addMenu("&Window")
     windowMenu.addAction("Minimize", lambda: self.showMinimized())
     windowMenu.addAction("Maximize", lambda: self.showMaximized())
     windowMenu.addAction("FullScreen", lambda: self.showFullScreen())
     windowMenu.addAction("Restore", lambda: self.showNormal())
     windowMenu.addAction("Center", lambda: self.center())
     windowMenu.addAction("Top-Left", lambda: self.move(0, 0))
     windowMenu.addAction("To Mouse", lambda: self.move_to_mouse_position())
     windowMenu.addSeparator()
     windowMenu.addAction(
         "Increase size", lambda:
         self.resize(self.size().width() * 1.4, self.size().height() * 1.4))
     windowMenu.addAction("Decrease size", lambda: self.resize(
         self.size().width() // 1.4, self.size().height() // 1.4))
     windowMenu.addAction("Minimum size", lambda:
                          self.resize(self.minimumSize()))
     windowMenu.addAction("Maximum size", lambda:
                          self.resize(self.maximumSize()))
     windowMenu.addAction("Horizontal Wide", lambda: self.resize(
         self.maximumSize().width(), self.minimumSize().height()))
     windowMenu.addAction("Vertical Tall", lambda: self.resize(
         self.minimumSize().width(), self.maximumSize().height()))
     windowMenu.addSeparator()
     windowMenu.addAction("Disable Resize", lambda:
                          self.setFixedSize(self.size()))
     windowMenu.addAction("Set Interface Font...", lambda:
                          self.setFont(QFontDialog.getFont()[0]))
     helpMenu = self.menuBar().addMenu("&Help")
     helpMenu.addAction("About Qt 5", lambda: QMessageBox.aboutQt(self))
     helpMenu.addAction("About Python 3",
                        lambda: open_new_tab('https://www.python.org'))
     helpMenu.addAction("About" + __doc__,
                        lambda: QMessageBox.about(self, __doc__, HELP))
     helpMenu.addSeparator()
     helpMenu.addAction(
         "Keyboard Shortcut",
         lambda: QMessageBox.information(self, __doc__, "<b>Quit = CTRL+Q"))
     helpMenu.addAction("View Source Code",
                        lambda: call('xdg-open ' + __file__, shell=True))
     helpMenu.addAction("View GitHub Repo", lambda: open_new_tab(__url__))
     helpMenu.addAction("Check Updates", lambda: Downloader(self))
     container = QWidget()
     container_layout = QVBoxLayout(container)
     self.setCentralWidget(container)
     # widgets
     group0, group1 = QGroupBox("Message to QR Code"), QGroupBox("Options")
     container_layout.addWidget(group0)
     container_layout.addWidget(group1)
     # message
     self.message = QLineEdit()
     self.message.setPlaceholderText("{} type a message!".format(getuser()))
     self.message.setToolTip("Message Text to encode as QR Code Image")
     QHBoxLayout(group0).addWidget(self.message)
     # options
     self.background, self.foreground = QComboBox(), QComboBox()
     self.qrcodesize, self.qrerrorlvl = QSpinBox(), QSpinBox()
     self.background.setToolTip("Background Color")
     self.foreground.setToolTip("Foreground Color")
     self.qrcodesize.setToolTip("QR Code Size")
     self.qrerrorlvl.setToolTip("QR Code Error Tolerance Level")
     self.background.addItems(STANDARD_NAMED_COLORS)
     self.foreground.addItems(STANDARD_NAMED_COLORS)
     self.foreground.setCurrentIndex(randint(0, self.background.count()))
     self.qrcodesize.setRange(2, 20)
     self.qrcodesize.setValue(2)
     self.qrcodesize.setSingleStep(2)
     self.qrerrorlvl.setRange(0, 3)
     self.qrerrorlvl.setValue(1)
     self.qrerrorlvl.setSingleStep(1)
     opt_layout = QHBoxLayout(group1)
     opt_layout.addWidget(QLabel("<b>Background"))
     opt_layout.addWidget(self.background)
     opt_layout.addWidget(QLabel("<b>Foreground"))
     opt_layout.addWidget(self.foreground)
     opt_layout.addWidget(QLabel("<b>Size"))
     opt_layout.addWidget(self.qrcodesize)
     opt_layout.addWidget(QLabel("<b>Error Tolerance"))
     opt_layout.addWidget(self.qrerrorlvl)
     self.bt = QDialogButtonBox(self)
     self.bt.setStandardButtons(QDialogButtonBox.Ok |
                                QDialogButtonBox.Close)
     self.bt.rejected.connect(exit)
     self.bt.accepted.connect(self.run)
     container_layout.addWidget(self.bt)
Example #35
0
 def on_pushButton_14_clicked(self):
     reply = QMessageBox.aboutQt(self, "介绍Qt")
     print(reply)
Example #36
0
File: main.py Project: dani-l/PaPI
 def triggered_papi_about_qt(self):
     QMessageBox.aboutQt(self)
Example #37
0
 def on_about_qt(self):
     QMessageBox.aboutQt(self)
Example #38
0
 def showAboutDialogSlot(self):
     """显示关于对话框"""
     if self.sender().objectName() == "about":
         QMessageBox.about(self, self.tr("Checker"), self.description)
     else:
         QMessageBox.aboutQt(self, self.tr("Checker"))
Example #39
0
    def __init__(self, parent=None):
        super(MainWindow, self).__init__()
        QNetworkProxyFactory.setUseSystemConfiguration(True)
        self.statusBar().showMessage(__doc__ + get_nuitka_version())
        self.setWindowTitle(__doc__.strip().capitalize())
        self.setMinimumSize(480, 400)
        self.setMaximumSize(1024, 800)
        self.resize(self.minimumSize())
        self.setWindowIcon(QIcon.fromTheme("python"))
        self.center()
        QShortcut("Ctrl+q", self, activated=lambda: self.close())
        self.menuBar().addMenu("&File").addAction("Exit", lambda: self.close())
        windowMenu = self.menuBar().addMenu("&Window")
        windowMenu.addAction("Minimize", lambda: self.showMinimized())
        windowMenu.addAction("Maximize", lambda: self.showMaximized())
        windowMenu.addAction("Restore", lambda: self.showNormal())
        windowMenu.addAction("FullScreen", lambda: self.showFullScreen())
        windowMenu.addAction("Center", lambda: self.center())
        windowMenu.addAction("Top-Left", lambda: self.move(0, 0))
        windowMenu.addAction("To Mouse", lambda: self.move_to_mouse_position())
        windowMenu.addSeparator()
        windowMenu.addAction(
            "Increase size", lambda:
            self.resize(self.size().width() * 1.4, self.size().height() * 1.4))
        windowMenu.addAction("Decrease size", lambda: self.resize(
            self.size().width() // 1.4, self.size().height() // 1.4))
        windowMenu.addAction("Minimum size", lambda:
                             self.resize(self.minimumSize()))
        windowMenu.addAction("Maximum size", lambda:
                             self.resize(self.maximumSize()))
        windowMenu.addAction("Horizontal Wide", lambda: self.resize(
            self.maximumSize().width(), self.minimumSize().height()))
        windowMenu.addAction("Vertical Tall", lambda: self.resize(
            self.minimumSize().width(), self.maximumSize().height()))
        windowMenu.addSeparator()
        windowMenu.addAction("Disable Resize", lambda:
                             self.setFixedSize(self.size()))
        windowMenu.addAction("Set Interface Font...", lambda:
                             self.setFont(QFontDialog.getFont()[0]))
        windowMenu.addAction(
            "Load .qss Skin", lambda: self.setStyleSheet(self.skin()))
        helpMenu = self.menuBar().addMenu("&Help")
        helpMenu.addAction("About Qt 5", lambda: QMessageBox.aboutQt(self))
        helpMenu.addAction("About Python 3",
                           lambda: open_new_tab('https://www.python.org'))
        helpMenu.addAction("About " + __doc__,
                           lambda: QMessageBox.about(self, __doc__, HELP))
        helpMenu.addSeparator()
        helpMenu.addAction(
            "Keyboard Shortcut",
            lambda: QMessageBox.information(self, __doc__, "<b>Quit = CTRL+Q"))
        if sys.platform.startswith('linux'):
            helpMenu.addAction("View Source Code", lambda:
                               call('xdg-open ' + __file__, shell=True))
        helpMenu.addAction("View GitHub Repo", lambda: open_new_tab(__url__))
        helpMenu.addAction("Check Updates", lambda: Downloader(self))
        # process
        self.process = QProcess()
        self.process.readyReadStandardOutput.connect(self._read_output)
        self.process.readyReadStandardError.connect(self._read_errors)
        self.process.finished.connect(self._process_finished)
        self.process.error.connect(self._process_failed)
        # widgets
        self.group0, self.group1 = QGroupBox("Options"), QGroupBox("Paths")
        self.group4, self.group5 = QGroupBox("Details"), QGroupBox("Miscs")
        g0grid, g1vlay = QGridLayout(self.group0), QGridLayout(self.group1)
        g5vlay, g4vlay = QVBoxLayout(self.group5), QVBoxLayout(self.group4)
        # group 0 the options
        self.module = QCheckBox("Create compiled extension module")
        self.standalone = QCheckBox("Standalone executable binary output")
        self.nofreeze = QCheckBox("No freeze all modules of standard library")
        self.python_debug = QCheckBox("Use Python Debug")
        self.warning = QCheckBox("Warnings for implicit exceptions at compile")
        self.recurse_std = QCheckBox("Recursive compile the standard library")
        self.recurse_not = QCheckBox("Force No recursive compiling")
        self.execute = QCheckBox("Execute the created binary after compiling")
        self.pythonpath = QCheckBox("Keep pythonpath when executing")
        self.enhaced = QCheckBox("Enhaced compile, Not CPython compatible")
        self.nolineno = QCheckBox("No Statements line numbers on compile")
        self.rmbuilddir = QCheckBox("Remove build directory after compile.")
        self.nuitka_debug = QCheckBox("Use Nuitka Debug")
        self.keep_debug = QCheckBox("Keep debug info on compile for GDB")
        self.traced = QCheckBox("Traced execution output")
        self.plusplus = QCheckBox("Compile C++ Only on generated source files")
        self.experimental = QCheckBox("Experimental features")
        self.force_clang = QCheckBox("Force use of CLang")
        self.force_mingw = QCheckBox("Force use of MinGW on MS Windows")
        self.force_lto = QCheckBox("Use link time optimizations LTO")
        self.show_scons = QCheckBox("Show Scons executed commands")
        self.show_progress = QCheckBox("Show progress info and statistics")
        self.show_summary = QCheckBox("Show final summary of included modules")
        self.disable_console = QCheckBox("Disable the Console on MS Windows")
        for i, widget in enumerate((
            self.module, self.standalone, self.nofreeze, self.python_debug,
            self.warning, self.recurse_std, self.recurse_not, self.execute,
            self.pythonpath, self.enhaced, self.nolineno, self.rmbuilddir,
            self.nuitka_debug, self.keep_debug, self.traced, self.plusplus,
            self.experimental, self.force_clang, self.force_mingw,
            self.force_lto, self.show_scons, self.show_progress,
                self.show_summary, self.disable_console)):
            widget.setToolTip(widget.text())
            g0grid.addWidget(widget, i if i < i + 1 else i - (i - 1), i % 2)
        # group 1 paths
        self.target = QLineEdit()
        self.outdir = QLineEdit(os.path.expanduser("~"))
        self.t_icon = QLineEdit()
        self.target.setToolTip("Python App file you want to Compile to Binary")
        self.outdir.setToolTip("Folder to write Compiled Output Binary files")
        self.t_icon.setToolTip("Icon image file to embed for your Python App")
        self.target.setPlaceholderText("/full/path/to/target/python_app.py")
        self.outdir.setPlaceholderText("/full/path/to/output/folder/")
        self.t_icon.setPlaceholderText("/full/path/to/python_app/icon.png")
        self.completer, self.dirs = QCompleter(self), QDirModel(self)
        self.completer.setModel(self.dirs)
        self.completer.setCaseSensitivity(Qt.CaseInsensitive)
        self.completer.setCompletionMode(QCompleter.PopupCompletion)
        self.completer.popup().setStyleSheet("border: 1px solid gray")
        self.completer.popup().setVerticalScrollBarPolicy(
            Qt.ScrollBarAlwaysOff)
        self.outdir.setCompleter(self.completer)
        self.t_icon.setCompleter(self.completer)
        self.target.setCompleter(self.completer)
        self.clear_1 = QPushButton(QIcon.fromTheme("edit-clear"), "", self,
                                   clicked=lambda: self.target.clear())
        self.clear_2 = QPushButton(QIcon.fromTheme("edit-clear"), "", self,
                                   clicked=lambda: self.t_icon.clear())
        self.clear_3 = QPushButton(QIcon.fromTheme("edit-clear"), "", self,
                                   clicked=lambda: self.outdir.clear())
        self.open_1 = QPushButton(
            QIcon.fromTheme("folder-open"), "", self, clicked=lambda:
                self.target.setText(str(QFileDialog.getOpenFileName(
                    self, __doc__, os.path.expanduser("~"), """Python (*.py);;
                    Python for Windows (*.pyw);;All (*.*)""")[0])))
        self.open_2 = QPushButton(
            QIcon.fromTheme("folder-open"), "", self, clicked=lambda:
                self.t_icon.setText(str(QFileDialog.getOpenFileName(
                    self, __doc__, os.path.expanduser("~"),
                    "PNG (*.png);;JPG (*.jpg);;ICO (*.ico);;All (*.*)")[0])))
        self.open_3 = QPushButton(
            QIcon.fromTheme("folder-open"), "", self, clicked=lambda:
                self.outdir.setText(str(QFileDialog.getExistingDirectory(
                    self, __doc__, os.path.expanduser("~")))))
        self.l_icon = QLabel("Target Icon")
        g1vlay.addWidget(QLabel("<b>Target Python"), 0, 0)
        g1vlay.addWidget(self.target, 0, 1)
        g1vlay.addWidget(self.clear_1, 0, 2)
        g1vlay.addWidget(self.open_1, 0, 3)
        g1vlay.addWidget(self.l_icon, 1, 0)
        g1vlay.addWidget(self.t_icon, 1, 1)
        g1vlay.addWidget(self.clear_2, 1, 2)
        g1vlay.addWidget(self.open_2, 1, 3)
        g1vlay.addWidget(QLabel("<b>Output Folder"), 2, 0)
        g1vlay.addWidget(self.outdir, 2, 1)
        g1vlay.addWidget(self.clear_3, 2, 2)
        g1vlay.addWidget(self.open_3, 2, 3)

        # group 4 the dome view mode
        self.jobs = QSpinBox()
        self.jobs.setRange(1, cpu_count())
        self.jobs.setValue(cpu_count())
        self.jobs.setToolTip("Backend Worker Jobs Processes")
        self.python_version = QComboBox()
        self.python_version.addItems(["2.7", "3.2", "3.3", "3.4"])
        self.python_version.setToolTip("Python version to use with Nuitka")
        self.display_tree = QPushButton("Display Tree")
        self.display_tree.clicked.connect(
            lambda: call(NUITKA + " --display-tree {}".format(
                self.target.text()), shell=True))
        self.dump_tree = QPushButton(
            "View Docs", clicked=lambda:
                open_new_tab("http://nuitka.net/doc/user-manual.html"))
        self.open_log = QPushButton("View Logs")
        _log = os.path.join(gettempdir(), "nuitka-gui.log")
        _open = "xdg-open " if sys.platform.startswith("lin") else "open "
        self.open_log.clicked.connect(lambda: call(_open + _log, shell=True))
        self.open_folder = QPushButton("Open Build Folder")
        self.open_folder.clicked.connect(lambda: call(
            _open + str(self.outdir.text()).strip(), shell=True))

        # self.display_tree.clicked.connect(self._display_tree)
        g4vlay.addWidget(QLabel("<b>Worker Jobs"))
        g4vlay.addWidget(self.jobs)
        g4vlay.addWidget(QLabel("<b>Python Version"))
        g4vlay.addWidget(self.python_version)
        g4vlay.addWidget(QLabel("<b>Actions"))
        g4vlay.addWidget(self.display_tree)
        g4vlay.addWidget(self.dump_tree)
        g4vlay.addWidget(self.open_log)
        g4vlay.addWidget(self.open_folder)
        self.debug, self.scr = QCheckBox("Use Debug"), QCheckBox("Make Script")
        self.chrt, self.ionice = QCheckBox("Slow CPU"), QCheckBox("Slow HDD")
        self.minimi = QCheckBox("Auto Minimize")
        self.chrt.setToolTip("Use Low CPU speed priority (Linux only)")
        self.ionice.setToolTip("Use Low HDD speed priority (Linux only)")
        self.scr.setToolTip("Generate a Bash Script to Compile with Nuitka")
        self.debug.setToolTip("Use Debug Verbose mode")
        self.minimi.setToolTip("Automatically Minimize when compiling starts")
        self.scr.setChecked(True)
        self.chrt.setChecked(True)
        self.ionice.setChecked(True)
        self.minimi.setChecked(True)
        g5vlay.addWidget(self.debug)
        g5vlay.addWidget(self.scr)
        g5vlay.addWidget(self.chrt)
        g5vlay.addWidget(self.ionice)
        g5vlay.addWidget(self.minimi)
        self.guimode = QComboBox()
        self.guimode.addItems(('Full UX / UI', 'Simple UX / UI'))
        self.guimode.setCurrentIndex(1)
        self._set_guimode()
        self.guimode.setStyleSheet("""QComboBox{background:transparent;
            margin-left:25px;color:gray;text-decoration:underline;border:0}""")
        self.guimode.currentIndexChanged.connect(self._set_guimode)
        self.bt = QDialogButtonBox(self)
        self.bt.setStandardButtons(
            QDialogButtonBox.Ok | QDialogButtonBox.Close)
        self.bt.rejected.connect(self.close)
        self.bt.accepted.connect(self.run)

        if not sys.platform.startswith('lin'):
            self.scr.setChecked(False)
            self.chrt.setChecked(False)
            self.ionice.setChecked(False)
            self.scr.hide()
            self.chrt.hide()
            self.ionice.hide()
        if not sys.platform.startswith('win'):
            self.l_icon.hide()
            self.t_icon.hide()
            self.clear_2.hide()
            self.open_2.hide()
        if sys.platform.startswith('win'):
            self.display_tree.hide()
        container = QWidget()
        container_layout = QGridLayout(container)  # Y, X
        container_layout.addWidget(self.guimode, 0, 1)
        container_layout.addWidget(self.group0, 1, 1)
        container_layout.addWidget(self.group1, 2, 1)
        container_layout.addWidget(self.group4, 1, 2)
        container_layout.addWidget(self.group5, 2, 2)
        container_layout.addWidget(self.bt, 3, 1)
        self.setCentralWidget(container)
Example #40
0
File: main.py Project: rhoef/afw
 def onAboutQt(self):
     QMessageBox.aboutQt(self, "about Qt")
Example #41
0
 def aboutqt(self):
     QMessageBox.aboutQt(self, appname + version + "Qt is the best !")
Example #42
0
 def about_qt(self):
     QMessageBox.aboutQt(self, "about Qt")
Example #43
0
 def show_about_qt(self):
     """Show About Qt Dialog."""
     QMessageBox.aboutQt(self, translations.TR_ABOUT_QT)
Example #44
0
 def _about_qt(self):
     # show Qt information
     QMessageBox.aboutQt(self)
Example #45
0
 def __init__(self, parent=None):
     """Init class."""
     super(MainWindow, self).__init__()
     self.setWindowTitle(__doc__.strip().capitalize())
     self.statusBar().showMessage(" Choose one App and move the sliders !")
     self.setMinimumSize(480, 240)
     self.setMaximumSize(640, 2048)
     self.setWindowIcon(QIcon.fromTheme("preferences-system"))
     self.center()
     QShortcut("Ctrl+q", self, activated=lambda: self.close())
     self.menuBar().addMenu("&File").addAction("Exit", exit)
     windowMenu = self.menuBar().addMenu("&Window")
     windowMenu.addAction("Minimize", lambda: self.showMinimized())
     windowMenu.addAction("Maximize", lambda: self.showMaximized())
     windowMenu.addAction("Restore", lambda: self.showNormal())
     windowMenu.addAction("FullScreen", lambda: self.showFullScreen())
     windowMenu.addAction("Center", lambda: self.center())
     windowMenu.addAction("Top-Left", lambda: self.move(0, 0))
     windowMenu.addAction("To Mouse", lambda: self.move_to_mouse_position())
     windowMenu.addSeparator()
     windowMenu.addAction(
         "Increase size", lambda:
         self.resize(self.size().width() * 1.4, self.size().height() * 1.4))
     windowMenu.addAction("Decrease size", lambda: self.resize(
         self.size().width() // 1.4, self.size().height() // 1.4))
     windowMenu.addAction("Minimum size", lambda:
                          self.resize(self.minimumSize()))
     windowMenu.addAction("Maximum size", lambda:
                          self.resize(self.maximumSize()))
     windowMenu.addAction("Horizontal Wide", lambda: self.resize(
         self.maximumSize().width(), self.minimumSize().height()))
     windowMenu.addAction("Vertical Tall", lambda: self.resize(
         self.minimumSize().width(), self.maximumSize().height()))
     windowMenu.addSeparator()
     windowMenu.addAction("Disable Resize", lambda:
                          self.setFixedSize(self.size()))
     windowMenu.addAction("Set Interface Font...", lambda:
                          self.setFont(QFontDialog.getFont()[0]))
     helpMenu = self.menuBar().addMenu("&Help")
     helpMenu.addAction("About Qt 5", lambda: QMessageBox.aboutQt(self))
     helpMenu.addAction("About Python 3",
                        lambda: open_new_tab('https://www.python.org'))
     helpMenu.addAction("About" + __doc__,
                        lambda: QMessageBox.about(self, __doc__, HELP))
     helpMenu.addSeparator()
     helpMenu.addAction(
         "Keyboard Shortcut",
         lambda: QMessageBox.information(self, __doc__, "<b>Quit = CTRL+Q"))
     helpMenu.addAction("View Source Code",
                        lambda: call('xdg-open ' + __file__, shell=True))
     helpMenu.addAction("View GitHub Repo", lambda: open_new_tab(__url__))
     helpMenu.addAction("Report Bugs", lambda: open_new_tab(
         'https://github.com/juancarlospaco/pyority/issues?state=open'))
     helpMenu.addAction("Check Updates", lambda: Downloader(self))
     container, child_container = QWidget(), QWidget()
     container_layout = QVBoxLayout(container)
     child_layout = QHBoxLayout(child_container)
     self.setCentralWidget(container)
     # widgets
     group0 = QGroupBox("My Apps")
     group1, group2 = QGroupBox("CPU Priority"), QGroupBox("HDD Priority")
     child_layout.addWidget(group0)
     child_layout.addWidget(group1)
     child_layout.addWidget(group2)
     container_layout.addWidget(child_container)
     # table
     self.table = QTableWidget()
     self.table.setColumnCount(1)
     self.table.verticalHeader().setVisible(True)
     self.table.horizontalHeader().setVisible(False)
     self.table.setShowGrid(False)
     self.table.setAlternatingRowColors(True)
     self.table.setIconSize(QSize(64, 64))
     self.table.setSelectionMode(QAbstractItemView.SingleSelection)
     self.table.setEditTriggers(QAbstractItemView.NoEditTriggers)
     # Graphic effect
     glow = QGraphicsDropShadowEffect(self)
     glow.setOffset(0)
     glow.setBlurRadius(9)
     glow.setColor(QColor(99, 255, 255))
     self.table.setGraphicsEffect(glow)
     glow.setEnabled(True)
     processes = self.generate_process_list()
     self.table.setRowCount(len(processes))
     for index, process in enumerate(processes):
         item = QTableWidgetItem(
             QIcon.fromTheme(process.name().split()[0].split('/')[0]),
             process.name().split()[0].split('/')[0].strip())
         item.setData(Qt.UserRole, process)
         item.setToolTip("{}, {}, {}, {}".format(
             process.name(), process.nice(),
             process.ionice()[1], process.pid))
         self.table.setItem(index, 0, item)
     self.table.clicked.connect(lambda: self.sliderhdd.setDisabled(False))
     self.table.clicked.connect(lambda: self.slidercpu.setDisabled(False))
     self.table.clicked.connect(lambda: self.slidercpu.setValue(
         int(tuple(self.table.currentItem().toolTip().split(","))[1])))
     self.table.clicked.connect(lambda: self.sliderhdd.setValue(
         int(tuple(self.table.currentItem().toolTip().split(","))[2])))
     self.table.resizeColumnsToContents()
     # self.table.resizeRowsToContents()
     # sliders
     self.slidercpu = QSlider()
     self.slidercpu.setRange(0, 19)
     self.slidercpu.setSingleStep(1)
     self.slidercpu.setTickPosition(3)
     self.slidercpu.setDisabled(True)
     self.slidercpu.setInvertedAppearance(True)
     self.slidercpu.setInvertedControls(True)
     self.slidercpu.valueChanged.connect(self.set_cpu_value)
     self.slidercpu.valueChanged.connect(
         lambda: self.slidercpu.setToolTip(str(self.slidercpu.value())))
     # Timer to start
     self.slidercpu_timer = QTimer(self)
     self.slidercpu_timer.setSingleShot(True)
     self.slidercpu_timer.timeout.connect(self.on_slidercpu_timer_timeout)
     QLabel(self.slidercpu).setPixmap(
         QIcon.fromTheme("list-add").pixmap(16))
     QVBoxLayout(group1).addWidget(self.slidercpu)
     self.sliderhdd = QSlider()
     self.sliderhdd.setRange(0, 7)
     self.sliderhdd.setSingleStep(1)
     self.sliderhdd.setTickPosition(3)
     self.sliderhdd.setDisabled(True)
     self.sliderhdd.setInvertedAppearance(True)
     self.sliderhdd.setInvertedControls(True)
     self.sliderhdd.valueChanged.connect(self.set_hdd_value)
     self.sliderhdd.valueChanged.connect(
         lambda: self.sliderhdd.setToolTip(str(self.sliderhdd.value())))
     # Timer to start
     self.sliderhdd_timer = QTimer(self)
     self.sliderhdd_timer.setSingleShot(True)
     self.sliderhdd_timer.timeout.connect(self.on_sliderhdd_timer_timeout)
     QLabel(self.sliderhdd).setPixmap(
         QIcon.fromTheme("list-add").pixmap(16))
     QVBoxLayout(group2).addWidget(self.sliderhdd)
     QVBoxLayout(group0).addWidget(self.table)
Example #46
0
 def aboutQt(self):
     QMessageBox.aboutQt(self)
Example #47
0
 def display_about_qt(self,):
     """
     displays the about qt dialog
     """
     QMessageBox.aboutQt(self,)
Example #48
0
    def about_qt(self):
        """ Show about qt dialog """

        QMessageBox.aboutQt(self)
Example #49
0
    def show_about_qt_dialog(self):
        """ Show about Qt dialog """

        QMessageBox.aboutQt(self)
Example #50
0
 def _show_about_qt(self):
     QMessageBox.aboutQt(main_container.MainContainer(),
         _translate("MenuAbout", "About Qt"))
Example #51
0
 def aboutqt(self):
     QMessageBox.aboutQt(self, '关于Qt')
Example #52
0
 def aboutQtMsg(self):
     QMessageBox.aboutQt(self, self.tr("About Qt"))
Example #53
0
 def on_aboutQt(self):
     QMessageBox.aboutQt(self, "关于Qt")
Example #54
0
 def showAboutQt(self):
     """
     Launches the "About Qt" informational dialog.
     """
     QMessageBox.aboutQt(self)
Example #55
0
    def __init__(self, parent=None):
        """Init class."""
        super(MainWindow, self).__init__()
        QNetworkProxyFactory.setUseSystemConfiguration(True)
        self.statusBar().showMessage(__doc__ + get_nuitka_version())
        self.setWindowTitle(__doc__.strip().capitalize())
        self.setMinimumSize(480, 400)
        self.setMaximumSize(1024, 800)
        self.resize(self.minimumSize())
        self.setWindowIcon(QIcon.fromTheme("python"))
        self.center()
        QShortcut("Ctrl+q", self, activated=lambda: self.close())
        self.menuBar().addMenu("&File").addAction("Exit", lambda: self.close())
        windowMenu = self.menuBar().addMenu("&Window")
        windowMenu.addAction("Minimize", lambda: self.showMinimized())
        windowMenu.addAction("Maximize", lambda: self.showMaximized())
        windowMenu.addAction("Restore", lambda: self.showNormal())
        windowMenu.addAction("FullScreen", lambda: self.showFullScreen())
        windowMenu.addAction("Center", lambda: self.center())
        windowMenu.addAction("Top-Left", lambda: self.move(0, 0))
        windowMenu.addAction("To Mouse", lambda: self.move_to_mouse_position())
        windowMenu.addSeparator()
        windowMenu.addAction(
            "Increase size", lambda:
            self.resize(self.size().width() * 1.4, self.size().height() * 1.4))
        windowMenu.addAction("Decrease size", lambda: self.resize(
            self.size().width() // 1.4, self.size().height() // 1.4))
        windowMenu.addAction("Minimum size", lambda:
                             self.resize(self.minimumSize()))
        windowMenu.addAction("Maximum size", lambda:
                             self.resize(self.maximumSize()))
        windowMenu.addAction("Horizontal Wide", lambda: self.resize(
            self.maximumSize().width(), self.minimumSize().height()))
        windowMenu.addAction("Vertical Tall", lambda: self.resize(
            self.minimumSize().width(), self.maximumSize().height()))
        windowMenu.addSeparator()
        windowMenu.addAction("Disable Resize", lambda:
                             self.setFixedSize(self.size()))
        windowMenu.addAction("Set Interface Font...", lambda:
                             self.setFont(QFontDialog.getFont()[0]))
        windowMenu.addAction(
            "Load .qss Skin", lambda: self.setStyleSheet(self.skin()))
        helpMenu = self.menuBar().addMenu("&Help")
        helpMenu.addAction("About Qt 5", lambda: QMessageBox.aboutQt(self))
        helpMenu.addAction("About Python 3",
                           lambda: open_new_tab('https://www.python.org'))
        helpMenu.addAction("About " + __doc__,
                           lambda: QMessageBox.about(self, __doc__, HELP))
        helpMenu.addSeparator()
        helpMenu.addAction(
            "Keyboard Shortcut",
            lambda: QMessageBox.information(self, __doc__, "<b>Quit = CTRL+Q"))
        if sys.platform.startswith('linux'):
            helpMenu.addAction("View Source Code", lambda:
                               call('xdg-open ' + __file__, shell=True))
        helpMenu.addAction("View GitHub Repo", lambda: open_new_tab(__url__))
        helpMenu.addAction("Check Updates", lambda: Downloader(self))
        # process
        self.process = QProcess()
        self.process.readyReadStandardOutput.connect(self._read_output)
        self.process.readyReadStandardError.connect(self._read_errors)
        self.process.finished.connect(self._process_finished)
        self.process.error.connect(self._process_failed)
        # widgets
        self.group0, self.group1 = QGroupBox("Options"), QGroupBox("Paths")
        self.group4, self.group5 = QGroupBox("Details"), QGroupBox("Miscs")
        g0grid, g1vlay = QGridLayout(self.group0), QGridLayout(self.group1)
        g5vlay, g4vlay = QVBoxLayout(self.group5), QVBoxLayout(self.group4)
        # group 0 the options
        self.module = QCheckBox("Create compiled extension module")
        self.standalone = QCheckBox("Standalone executable binary output")
        self.nofreeze = QCheckBox("No freeze all modules of standard library")
        self.python_debug = QCheckBox("Use Python Debug")
        self.warning = QCheckBox("Warnings for implicit exceptions at compile")
        self.recurse_std = QCheckBox("Recursive compile the standard library")
        self.recurse_not = QCheckBox("Force No recursive compiling")
        self.execute = QCheckBox("Execute the created binary after compiling")
        self.pythonpath = QCheckBox("Keep pythonpath when executing")
        self.enhaced = QCheckBox("Enhaced compile, Not CPython compatible")
        self.nolineno = QCheckBox("No Statements line numbers on compile")
        self.rmbuilddir = QCheckBox("Remove build directory after compile.")
        self.nuitka_debug = QCheckBox("Use Nuitka Debug")
        self.keep_debug = QCheckBox("Keep debug info on compile for GDB")
        self.traced = QCheckBox("Traced execution output")
        self.plusplus = QCheckBox("Compile C++ Only on generated source files")
        self.experimental = QCheckBox("Experimental features")
        self.force_clang = QCheckBox("Force use of CLang")
        self.force_mingw = QCheckBox("Force use of MinGW on MS Windows")
        self.force_lto = QCheckBox("Use link time optimizations LTO")
        self.show_scons = QCheckBox("Show Scons executed commands")
        self.show_progress = QCheckBox("Show progress info and statistics")
        self.show_summary = QCheckBox("Show final summary of included modules")
        self.disable_console = QCheckBox("Disable the Console on MS Windows")
        for i, widget in enumerate((
            self.module, self.standalone, self.nofreeze, self.python_debug,
            self.warning, self.recurse_std, self.recurse_not, self.execute,
            self.pythonpath, self.enhaced, self.nolineno, self.rmbuilddir,
            self.nuitka_debug, self.keep_debug, self.traced, self.plusplus,
            self.experimental, self.force_clang, self.force_mingw,
            self.force_lto, self.show_scons, self.show_progress,
                self.show_summary, self.disable_console)):
            widget.setToolTip(widget.text())
            g0grid.addWidget(widget, i if i < i + 1 else i - (i - 1), i % 2)
        # group 1 paths
        self.target = QLineEdit()
        self.outdir = QLineEdit(os.path.expanduser("~"))
        self.t_icon = QLineEdit()
        self.target.setToolTip("Python App file you want to Compile to Binary")
        self.outdir.setToolTip("Folder to write Compiled Output Binary files")
        self.t_icon.setToolTip("Icon image file to embed for your Python App")
        self.target.setPlaceholderText("/full/path/to/target/python_app.py")
        self.outdir.setPlaceholderText("/full/path/to/output/folder/")
        self.t_icon.setPlaceholderText("/full/path/to/python_app/icon.png")
        self.completer, self.dirs = QCompleter(self), QDirModel(self)
        self.completer.setModel(self.dirs)
        self.completer.setCaseSensitivity(Qt.CaseInsensitive)
        self.completer.setCompletionMode(QCompleter.PopupCompletion)
        self.completer.popup().setStyleSheet("border: 1px solid gray")
        self.completer.popup().setVerticalScrollBarPolicy(
            Qt.ScrollBarAlwaysOff)
        self.outdir.setCompleter(self.completer)
        self.t_icon.setCompleter(self.completer)
        self.target.setCompleter(self.completer)
        self.clear_1 = QPushButton(QIcon.fromTheme("edit-clear"), "", self,
                                   clicked=lambda: self.target.clear())
        self.clear_2 = QPushButton(QIcon.fromTheme("edit-clear"), "", self,
                                   clicked=lambda: self.t_icon.clear())
        self.clear_3 = QPushButton(QIcon.fromTheme("edit-clear"), "", self,
                                   clicked=lambda: self.outdir.clear())
        self.open_1 = QPushButton(
            QIcon.fromTheme("folder-open"), "", self, clicked=lambda:
                self.target.setText(str(QFileDialog.getOpenFileName(
                    self, __doc__, os.path.expanduser("~"), """Python (*.py);;
                    Python for Windows (*.pyw);;All (*.*)""")[0])))
        self.open_2 = QPushButton(
            QIcon.fromTheme("folder-open"), "", self, clicked=lambda:
                self.t_icon.setText(str(QFileDialog.getOpenFileName(
                    self, __doc__, os.path.expanduser("~"),
                    "PNG (*.png);;JPG (*.jpg);;ICO (*.ico);;All (*.*)")[0])))
        self.open_3 = QPushButton(
            QIcon.fromTheme("folder-open"), "", self, clicked=lambda:
                self.outdir.setText(str(QFileDialog.getExistingDirectory(
                    self, __doc__, os.path.expanduser("~")))))
        self.l_icon = QLabel("Target Icon")
        g1vlay.addWidget(QLabel("<b>Target Python"), 0, 0)
        g1vlay.addWidget(self.target, 0, 1)
        g1vlay.addWidget(self.clear_1, 0, 2)
        g1vlay.addWidget(self.open_1, 0, 3)
        g1vlay.addWidget(self.l_icon, 1, 0)
        g1vlay.addWidget(self.t_icon, 1, 1)
        g1vlay.addWidget(self.clear_2, 1, 2)
        g1vlay.addWidget(self.open_2, 1, 3)
        g1vlay.addWidget(QLabel("<b>Output Folder"), 2, 0)
        g1vlay.addWidget(self.outdir, 2, 1)
        g1vlay.addWidget(self.clear_3, 2, 2)
        g1vlay.addWidget(self.open_3, 2, 3)

        # group 4 the dome view mode
        self.jobs = QSpinBox()
        self.jobs.setRange(1, cpu_count())
        self.jobs.setValue(cpu_count())
        self.jobs.setToolTip("Backend Worker Jobs Processes")
        self.python_version = QComboBox()
        self.python_version.addItems(["2.7", "3.2", "3.3", "3.4"])
        self.python_version.setToolTip("Python version to use with Nuitka")
        self.display_tree = QPushButton("Display Tree")
        self.display_tree.clicked.connect(
            lambda: call(NUITKA + " --display-tree {}".format(
                self.target.text()), shell=True))
        self.dump_tree = QPushButton(
            "View Docs", clicked=lambda:
                open_new_tab("http://nuitka.net/doc/user-manual.html"))
        self.open_log = QPushButton("View Logs")
        _log = os.path.join(gettempdir(), "nuitka-gui.log")
        _open = "xdg-open " if sys.platform.startswith("lin") else "open "
        self.open_log.clicked.connect(lambda: call(_open + _log, shell=True))
        self.open_folder = QPushButton("Open Build Folder")
        self.open_folder.clicked.connect(lambda: call(
            _open + str(self.outdir.text()).strip(), shell=True))

        # self.display_tree.clicked.connect(self._display_tree)
        g4vlay.addWidget(QLabel("<b>Worker Jobs"))
        g4vlay.addWidget(self.jobs)
        g4vlay.addWidget(QLabel("<b>Python Version"))
        g4vlay.addWidget(self.python_version)
        g4vlay.addWidget(QLabel("<b>Actions"))
        g4vlay.addWidget(self.display_tree)
        g4vlay.addWidget(self.dump_tree)
        g4vlay.addWidget(self.open_log)
        g4vlay.addWidget(self.open_folder)

        # group 5 miscelaneous stuff
        self.debug, self.scr = QCheckBox("Use Debug"), QCheckBox("Make Script")
        self.chrt, self.ionice = QCheckBox("Slow CPU"), QCheckBox("Slow HDD")
        self.minimi = QCheckBox("Auto Minimize")
        self.chrt.setToolTip("Use Low CPU speed priority (Linux only)")
        self.ionice.setToolTip("Use Low HDD speed priority (Linux only)")
        self.scr.setToolTip("Generate a Bash Script to Compile with Nuitka")
        self.debug.setToolTip("Use Debug Verbose mode")
        self.minimi.setToolTip("Automatically Minimize when compiling starts")
        self.scr.setChecked(True)
        self.chrt.setChecked(True)
        self.ionice.setChecked(True)
        self.minimi.setChecked(True)
        g5vlay.addWidget(self.debug)
        g5vlay.addWidget(self.scr)
        g5vlay.addWidget(self.chrt)
        g5vlay.addWidget(self.ionice)
        g5vlay.addWidget(self.minimi)

        # option to show or hide some widgets on the gui
        self.guimode = QComboBox()
        self.guimode.addItems(('Full UX / UI', 'Simple UX / UI'))
        self.guimode.setCurrentIndex(1)
        self._set_guimode()
        self.guimode.setStyleSheet("""QComboBox{background:transparent;
            margin-left:25px;color:gray;text-decoration:underline;border:0}""")
        self.guimode.currentIndexChanged.connect(self._set_guimode)

        # buttons from bottom to close or proceed
        self.bt = QDialogButtonBox(self)
        self.bt.setStandardButtons(
            QDialogButtonBox.Ok | QDialogButtonBox.Close)
        self.bt.rejected.connect(self.close)
        self.bt.accepted.connect(self.run)

        if not sys.platform.startswith('lin'):
            self.scr.setChecked(False)
            self.chrt.setChecked(False)
            self.ionice.setChecked(False)
            self.scr.hide()
            self.chrt.hide()
            self.ionice.hide()
        if not sys.platform.startswith('win'):
            self.l_icon.hide()
            self.t_icon.hide()
            self.clear_2.hide()
            self.open_2.hide()
        if sys.platform.startswith('win'):
            self.display_tree.hide()

        # container for all groups of widgets
        container = QWidget()
        container_layout = QGridLayout(container)  # Y, X
        container_layout.addWidget(self.guimode, 0, 1)
        container_layout.addWidget(self.group0, 1, 1)
        container_layout.addWidget(self.group1, 2, 1)
        container_layout.addWidget(self.group4, 1, 2)
        container_layout.addWidget(self.group5, 2, 2)
        container_layout.addWidget(self.bt, 3, 1)
        self.setCentralWidget(container)
Example #56
0
    def init_menu(self):
        """init menu setup"""
        # file menu
        file_menu = self.menuBar().addMenu("File")
        # TODO: setting menu item
        file_menu.addAction("Exit", lambda: self.close())
        # Syncthing menu
        sync_menu = self.menuBar().addMenu("Syncthing")
        sync_menu.addAction("Start Syncronization", lambda: self.run())
        sync_menu.addAction("Stop Syncronization",
                            lambda: self.syncthing_stop())
        # TODO: restart
        # TODO: reflash F5
        sync_menu.addAction("Open in external browser",
                            lambda: open_new_tab(URL))

        # view menu
        view_menu = self.menuBar().addMenu("View")
        # TODO: syncthing console menu
        view_menu.addAction("syncthing console", lambda: self.show_console)
        #
        zoom_menu = view_menu.addMenu("Zoom browser")
        zoom_menu.addAction(
            "Zoom In",
            lambda: self.view.setZoomFactor(self.view.zoomFactor() + .2))
        zoom_menu.addAction(
            "Zoom Out",
            lambda: self.view.setZoomFactor(self.view.zoomFactor() - .2))
        zoom_menu.addAction(
            "Zoom To...",
            lambda: self.view.setZoomFactor(QInputDialog.getInt(
                self, __doc__, "<b>Zoom factor ?:", 1, 1, 9)[0]))
        zoom_menu.addAction("Zoom Reset", lambda: self.view.setZoomFactor(1))
        view_menu.addSeparator()
        act = view_menu.addAction("View Page Source",
                                  lambda: self.view_syncthing_source)
        act.setDisabled(True)

        # window menu
        window_menu = self.menuBar().addMenu("&Window")
        window_menu.addAction("Minimize", lambda: self.showMinimized())
        window_menu.addAction("Maximize", lambda: self.showMaximized())
        window_menu.addAction("Restore", lambda: self.showNormal())
        window_menu.addAction("Center", lambda: self.center())
        window_menu.addAction("Top-Left", lambda: self.move(0, 0))
        window_menu.addAction("To Mouse",
                              lambda: self.move_to_mouse_position())
        window_menu.addAction("Fullscreen", lambda: self.showFullScreen())
        window_menu.addSeparator()
        window_menu.addAction("Increase size", lambda: self.resize(
            self.size().width() * 1.2, self.size().height() * 1.2))
        window_menu.addAction("Decrease size", lambda: self.resize(
            self.size().width() // 1.2, self.size().height() // 1.2))
        window_menu.addAction("Minimum size", lambda:
                              self.resize(self.minimumSize()))
        window_menu.addAction("Maximum size", lambda:
                              self.resize(self.maximumSize()))
        window_menu.addAction("Horizontal Wide", lambda: self.resize(
            self.maximumSize().width(), self.minimumSize().height()))
        window_menu.addAction("Vertical Tall", lambda: self.resize(
            self.minimumSize().width(), self.maximumSize().height()))
        window_menu.addSeparator()
        window_menu.addAction("Disable Resize",
                              lambda: self.setFixedSize(self.size()))
        # help menu
        help_menu = self.menuBar().addMenu("&Help")
        help_menu.addAction("Support Forum", lambda: open_new_tab(HELP_URL_0))
        help_menu.addAction("Lastest Release",
                            lambda: open_new_tab(HELP_URL_1))
        help_menu.addAction("Documentation", lambda: open_new_tab(HELP_URL_2))
        help_menu.addAction("Bugs", lambda: open_new_tab(HELP_URL_3))
        help_menu.addAction("Source Code", lambda: open_new_tab(HELP_URL_4))
        help_menu.addSeparator()
        help_menu.addAction("About Qt 5", lambda: QMessageBox.aboutQt(self))
        help_menu.addAction("About Python 3",
                            lambda: open_new_tab('https://www.python.org'))
        help_menu.addAction("About " + __doc__,
                            lambda: QMessageBox.about(self, __doc__, HELPMSG))
        help_menu.addSeparator()
        help_menu.addAction("Keyboard Shortcuts", lambda:
                            QMessageBox.information(self, __doc__, SHORTCUTS))
        help_menu.addAction("View GitHub Repo", lambda: open_new_tab(__url__))
        if not sys.platform.startswith("win"):
            help_menu.addAction("Show Source Code", lambda: self.view_source())
        help_menu.addSeparator()
        help_menu.addAction("Check Updates", lambda: self.check_for_updates())
Example #57
0
File: main.py Project: sergeqwe/vk
 def about_qt(self):
     QMessageBox.aboutQt(window)
Example #58
0
 def on_actionAbout_Qt_triggered(self, checked):
     msgbox = QMessageBox.aboutQt(self)
Example #59
0
 def show_about_qt(self):
     """Show About Qt dialog."""
     QMessageBox.aboutQt(self, "About Qt")
Example #60
0
 def on_centeredPushButton_clicked(self):
     msgbox = QMessageBox.aboutQt(self)