How to use the qtpy.QtWidgets.QAction function in QtPy

To help you get started, we’ve selected a few QtPy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github avalentino / gsdview / tests / test_ogrqt.py View on Github external
def _setupHelpActions(self):
        actions = QtWidgets.QActionGroup(self)

        icon = QtGui.QIcon.fromTheme('dialog-information')
        QtWidgets.QAction(
            icon, self.tr('About'), actions,
            objectName='aboutAction',
            statusTip=self.tr('About'),
            triggered=self.about)

        icon = QtGui.QIcon(':qtlogo-64')
        QtWidgets.QAction(
            icon, self.tr('About Qt'), actions,
            objectName='aboutQtAction',
            statusTip=self.tr('About Qt'),
            triggered=QtWidgets.QApplication.aboutQt)

        return actions
github mantidproject / mantid / scripts / Interface / reduction_application.py View on Github external
saveAsAction = QAction("Save as...", self)
        saveAsAction.setStatusTip("Save the reduction parameters to XML")
        saveAsAction.triggered.connect(self._save_as)

        saveAction = QAction("&Save...", self)
        saveAction.setShortcut("Ctrl+S")
        saveAction.setStatusTip("Save the reduction parameters to XML")
        saveAction.triggered.connect(self._save)

        exportAction = QAction("&Export...", self)
        exportAction.setShortcut("Ctrl+E")
        exportAction.setStatusTip("Export to python script for Mantid")
        exportAction.triggered.connect(self._export)

        quitAction = QAction("&Quit", self)
        quitAction.setShortcut("Ctrl+Q")
        quitAction.triggered.connect(self.close)

        self.file_menu.addAction(newAction)
        self.file_menu.addAction(openAction)
        self.file_menu.addAction(saveAction)
        self.file_menu.addAction(saveAsAction)
        self.file_menu.addAction(exportAction)
        self.file_menu.addSeparator()

        if self.general_settings.debug:
            clearAction = QAction("&Clear settings and quit", self)
            clearAction.setStatusTip("Restore initial application settings and close the application")
            clearAction.triggered.connect(self._clear_and_close)
            self.file_menu.addAction(clearAction)
github QuTech-Delft / qtt / src / qtt / gui / dataviewer.py View on Github external
menuBar = self.menuBar()

        menuDict = {
            '&Data': {'&Reload Data': self.update_logs,
                      '&Preload all Info': self.load_info,
                      '&Quit': self.close},
            '&Folder': {'&Select Dir1': lambda: self.select_directory(index=0),
                        'Select &Dir2': lambda: self.select_directory(index=1),
                        '&Toggle Dirs': self.toggle_data_directory
                        },
            '&Help': {'&Info': self.show_help}
        }
        for (k, menu) in menuDict.items():
            mb = menuBar.addMenu(k)
            for (kk, action) in menu.items():
                act = QtWidgets.QAction(kk, self)
                mb.addAction(act)
                act.triggered.connect(action)

        if self.verbose >= 2:
            print('created gui...')

        # get logs from disk
        self.update_logs()
        self.datatag = None

        self.logtree.setColumnHidden(2, True)
        self.logtree.setColumnHidden(3, True)
        self.show()
github Ulm-IQO / qudi / qudi / core / gui / main_gui / mainwindow.py View on Github external
self.action_view_config.setToolTip('Show configuration dockwidget')
        self.action_view_remote = QtWidgets.QAction()
        self.action_view_remote.setCheckable(True)
        self.action_view_remote.setChecked(False)
        self.action_view_remote.setText('Show remote')
        self.action_view_remote.setToolTip('Show remote connections dockwidget')
        self.action_view_threads = QtWidgets.QAction()
        self.action_view_threads.setCheckable(True)
        self.action_view_threads.setChecked(False)
        self.action_view_threads.setText('Show threads')
        self.action_view_threads.setToolTip('Show threads dockwidget')
        self.action_view_default = QtWidgets.QAction()
        self.action_view_default.setText('Restore default')
        self.action_view_default.setToolTip('Restore default view')
        # Dialog actions
        self.action_console_settings = QtWidgets.QAction()
        self.action_console_settings.setIcon(
            QtGui.QIcon(os.path.join(icon_path, 'configure.png')))
        self.action_console_settings.setText('Console')
        self.action_console_settings.setToolTip('Open IPython console settings')
        self.action_about_qudi = QtWidgets.QAction()
        self.action_about_qudi.setIcon(
            QtGui.QIcon(os.path.join(icon_path, 'go-home.png')))
        self.action_about_qudi.setText('About qudi')
        self.action_about_qudi.setToolTip('Read up about qudi')
        self.action_about_qt = QtWidgets.QAction()
        self.action_about_qt.setIcon(
            QtGui.QIcon(os.path.join(icon_path, 'go-home.png')))
        self.action_about_qt.setText('About Qt')
        self.action_about_qt.setToolTip('Read up about Qt')

        # Create toolbar
github lneuhaus / pyrpl / pyrpl / widgets / pyrpl_widget.py View on Github external
def add_dock_widget(self, create_widget, name):
        dock_widget = MyDockWidget(create_widget,
                                   name + ' (%s)' % self.parent.name)
        self.dock_widgets[name] = dock_widget
        self.addDockWidget(QtCore.Qt.TopDockWidgetArea,
                           dock_widget)
        if self.last_docked is not None:
            self.tabifyDockWidget(self.last_docked, dock_widget)
        # put tabs on top
        self.setTabPosition(dock_widget.allowedAreas(),
                            QtWidgets.QTabWidget.North)
        self.last_docked = dock_widget
        self.last_docked.hide()  # by default no widget is created...

        action = QtWidgets.QAction(name, self.menu_modules)
        action.setCheckable(True)
        self.module_actions.append(action)
        self.menu_modules.addAction(action)

        # make sure menu and widget are in sync
        action.changed.connect(lambda: dock_widget.setVisible(action.isChecked()))
        dock_widget.visibilityChanged.connect(lambda:action.setChecked(dock_widget.isVisible()))
        dock_widget.visibilityChanged.connect(self.hide_centralbutton)
        self.set_background_color(dock_widget)
github glue-viz / glue / glue / app / qt / application.py View on Github external
menu = QtWidgets.QMenu(mbar)
        menu.setTitle("&Plugins")
        menu.addAction(self._actions['plugin_manager'])
        menu.addSeparator()

        if 'plugins' in self._actions:
            for plugin in self._actions['plugins']:
                menu.addAction(plugin)

        mbar.addMenu(menu)

        # trigger inclusion of Mac Native "Help" tool
        menu = mbar.addMenu("&Help")

        a = QtWidgets.QAction("&Online Documentation", menu)
        a.triggered.connect(nonpartial(webbrowser.open, DOCS_URL))
        menu.addAction(a)

        a = QtWidgets.QAction("Send &Feedback", menu)
        a.triggered.connect(nonpartial(submit_feedback))
        menu.addAction(a)

        menu.addSeparator()
        menu.addAction("Version information", show_glue_info)
github mantidproject / mantid / qt / python / mantidqt / widgets / workspacedisplay / table / view.py View on Github external
def make_separator(self, horizontalHeader):
        separator1 = QAction(horizontalHeader)
        separator1.setSeparator(True)
        return separator1
github mantidproject / mantid / scripts / Interface / reduction_application.py View on Github external
openAction = QAction("&Open...", self)
        openAction.setShortcut("Ctrl+O")
        openAction.setStatusTip("Open an XML file containing reduction parameters")
        openAction.triggered.connect(self._file_open)

        saveAsAction = QAction("Save as...", self)
        saveAsAction.setStatusTip("Save the reduction parameters to XML")
        saveAsAction.triggered.connect(self._save_as)

        saveAction = QAction("&Save...", self)
        saveAction.setShortcut("Ctrl+S")
        saveAction.setStatusTip("Save the reduction parameters to XML")
        saveAction.triggered.connect(self._save)

        exportAction = QAction("&Export...", self)
        exportAction.setShortcut("Ctrl+E")
        exportAction.setStatusTip("Export to python script for Mantid")
        exportAction.triggered.connect(self._export)

        quitAction = QAction("&Quit", self)
        quitAction.setShortcut("Ctrl+Q")
        quitAction.triggered.connect(self.close)

        self.file_menu.addAction(newAction)
        self.file_menu.addAction(openAction)
        self.file_menu.addAction(saveAction)
        self.file_menu.addAction(saveAsAction)
        self.file_menu.addAction(exportAction)
        self.file_menu.addSeparator()

        if self.general_settings.debug:
github hyperspy / hyperspyUI / hyperspyui / mainwindowutillayer.py View on Github external
def add_toolbar_button(self, category, action):
        """
        Add the supplied 'action' as a toolbar button. If the toolbar defined
        by 'cateogry' does not exist, it will be created in
        self.toolbars[category].
        """
        if category in self.toolbars:
            tb = self.toolbars[category]
        else:
            tb = QtWidgets.QToolBar(tr(category) + tr(" toolbar"), self)
            tb.setObjectName(category + "_toolbar")
            self.addToolBar(Qt.LeftToolBarArea, tb)
            self.toolbars[category] = tb

        if not isinstance(action, QtWidgets.QAction):
            action = self.actions[action]
        tb.addAction(action)
github jupyter / qtconsole / qtconsole / console_widget.py View on Github external
self,
                shortcut=QtGui.QKeySequence.ZoomIn,
                shortcutContext=QtCore.Qt.WidgetWithChildrenShortcut,
                statusTip="Increase the font size by one point",
                triggered=self._increase_font_size)
        self.addAction(self.increase_font_size)

        self.decrease_font_size = QtWidgets.QAction("Smaller Font",
                self,
                shortcut=QtGui.QKeySequence.ZoomOut,
                shortcutContext=QtCore.Qt.WidgetWithChildrenShortcut,
                statusTip="Decrease the font size by one point",
                triggered=self._decrease_font_size)
        self.addAction(self.decrease_font_size)

        self.reset_font_size = QtWidgets.QAction("Normal Font",
                self,
                shortcut="Ctrl+0",
                shortcutContext=QtCore.Qt.WidgetWithChildrenShortcut,
                statusTip="Restore the Normal font size",
                triggered=self.reset_font)
        self.addAction(self.reset_font_size)

        # Accept drag and drop events here. Drops were already turned off
        # in self._control when that widget was created.
        self.setAcceptDrops(True)