Ejemplo n.º 1
0
 def create_shortcut_action(self, name):
     a = getattr(all_actions(), name)
     sc = a.shortcut_action
     a = QAction(a.icon, a.text, self)
     connect_lambda(a.triggered, self,
                    lambda self: self.action_triggered.emit(sc))
     self.shortcut_actions[sc] = a
     return a
Ejemplo n.º 2
0
 def __init__(self, parent):
     QTableView.__init__(self, parent)
     self._menu = QMenu(self)
     self._copy_action = QAction(self.tr('Copy'), self)
     self._copy_action.triggered.connect(self.copy)
     self._copy_action.setShortcuts(QKeySequence.Copy)
     self._copy_with_headers_action = QAction(self.tr('Copy With Headers'), self)
     self._copy_with_headers_action.triggered.connect(self.copyWithHeaders)
     self._paste_action = QAction(self.tr('Paste'), self)
     self._paste_action.triggered.connect(self.paste)
     self._paste_action.setShortcuts(QKeySequence.Paste)
     self._menu.addAction(self._copy_action)
     self._menu.addAction(self._copy_with_headers_action)
     self._menu.addAction(self._paste_action)
     self.addAction(self._copy_action)
     self.addAction(self._copy_with_headers_action)
     self.addAction(self._paste_action)
Ejemplo n.º 3
0
 def clone_action(ac, parent):
     if ac.isSeparator():
         ans = QAction(parent)
         ans.setSeparator(True)
         return ans
     sc = ac.shortcut()
     sc = '' if sc.isEmpty() else sc.toString(
         QKeySequence.SequenceFormat.NativeText)
     text = ac.text()
     if '\t' not in text:
         text += '\t' + sc
     ans = QAction(ac.icon(), text, parent)
     ans.triggered.connect(ac.trigger)
     ans.setEnabled(ac.isEnabled())
     ans.setStatusTip(ac.statusTip())
     ans.setVisible(ac.isVisible())
     return ans
Ejemplo n.º 4
0
 def creat_tool(self):
     btn1 = QAction('打开文件', self)
     #exitAction.setShortcut('Ctrl+Q')
     btn1.triggered.connect(lambda: self.openfile())
     btn2 = QAction('保存文件', self)
     btn2.triggered.connect(lambda: self.savefile())
     btn3 = QAction('上传文件', self)
     btn3.triggered.connect(lambda: self.upfile())
     btn4 = QAction('成绩', self)
     #btn4.triggered.connect()
     btn5 = QAction('公告', self)
     btn5.triggered.connect(lambda: self.getannouncement())
     btn6 = QAction('更改密码', self)
     btn6.triggered.connect(lambda: self.change())
     btn7 = QAction('选择班级', self)
     btn7.triggered.connect(lambda: self.select())
     self.toolbar = QToolBar()
     self.addToolBar(Qt.LeftToolBarArea, self.toolbar)
     self.toolbar.addAction(btn1)
     self.toolbar.addAction(btn2)
     self.toolbar.addAction(btn3)
     self.toolbar.addAction(btn4)
     self.toolbar.addAction(btn5)
     self.toolbar.addAction(btn6)
     self.toolbar.addAction(btn7)
Ejemplo n.º 5
0
 def __init__(self, parent=None):
     QListWidget.__init__(self, parent)
     self.setDragEnabled(True)
     self.setDragDropMode(self.InternalMove)
     self.setDefaultDropAction(Qt.MoveAction)
     self.setAlternatingRowColors(True)
     self.setStyleSheet('QListView::item { padding: 0.5ex }')
     self.viewport().setAcceptDrops(True)
     self.setDropIndicatorShown(True)
     self.setContextMenuPolicy(Qt.ActionsContextMenu)
     self.ac_edit = ac = QAction(QIcon(I('edit_input.png')), _('Rename this bookmark'), self)
     self.addAction(ac)
     self.ac_delete = ac = QAction(QIcon(I('trash.png')), _('Remove this bookmark'), self)
     self.addAction(ac)
     self.ac_sort = ac = QAction(_('Sort by name'), self)
     self.addAction(ac)
     self.ac_sort_pos = ac = QAction(_('Sort by position in book'), self)
     self.addAction(ac)
Ejemplo n.º 6
0
    def _init_menu(self):
        menu = self.menuBar()
        filemenu = menu.addMenu('&File')

        save = QAction('Save Setup', self)
        save.setShortcut('Ctrl+S')
        save.triggered.connect(self.save_setup)

        recall = QAction('Recall Setup', self)
        recall.setShortcut('Ctrl+R')
        recall.triggered.connect(self.recall_setup)

        stop = QAction('Exit', self)
        stop.triggered.connect(self.exit)

        filemenu.addAction(save)
        filemenu.addAction(recall)
        filemenu.addAction(stop)
Ejemplo n.º 7
0
    def _initMenu(self):
        """初始化右键菜单"""

        self._menu = QMenu(self)

        showLogsAction = QAction('显示所有日志...', self)
        showLogsAction.triggered.connect(self._showLogs)

        self._menu.addAction(showLogsAction)
Ejemplo n.º 8
0
    def initialize(self, web_view):
        self.web_view = web_view
        shortcut_action = self.create_shortcut_action
        aa = all_actions()
        self.action_triggered.connect(web_view.trigger_shortcut)
        page = web_view.page()
        web_view.paged_mode_changed.connect(self.update_mode_action)
        web_view.reference_mode_changed.connect(self.update_reference_mode_action)
        web_view.standalone_misc_settings_changed.connect(self.update_visibility)
        web_view.autoscroll_state_changed.connect(self.update_autoscroll_action)
        web_view.customize_toolbar.connect(self.customize, type=Qt.QueuedConnection)

        self.back_action = page.action(QWebEnginePage.Back)
        self.back_action.setIcon(aa.back.icon)
        self.back_action.setText(aa.back.text)
        self.forward_action = page.action(QWebEnginePage.Forward)
        self.forward_action.setIcon(aa.forward.icon)
        self.forward_action.setText(aa.forward.text)

        self.open_action = a = QAction(aa.open.icon, aa.open.text, self)
        self.open_menu = m = QMenu(self)
        a.setMenu(m)
        m.aboutToShow.connect(self.populate_open_menu)
        connect_lambda(a.triggered, self, lambda self: self.open_book_at_path.emit(None))
        self.copy_action = a = page.action(QWebEnginePage.Copy)
        a.setIcon(aa.copy.icon), a.setText(aa.copy.text)
        self.increase_font_size_action = shortcut_action('increase_font_size')
        self.decrease_font_size_action = shortcut_action('decrease_font_size')
        self.fullscreen_action = shortcut_action('fullscreen')

        self.next_action = shortcut_action('next')
        self.previous_action = shortcut_action('previous')
        self.next_section_action = shortcut_action('next_section')
        self.previous_section_action = shortcut_action('previous_section')

        self.toc_action = a = shortcut_action('toc')
        a.setCheckable(True)
        self.bookmarks_action = a = shortcut_action('bookmarks')
        a.setCheckable(True)
        self.reference_action = a = shortcut_action('reference')
        a.setCheckable(True)
        self.lookup_action = a = shortcut_action('lookup')
        a.setCheckable(True)
        self.inspector_action = a = shortcut_action('inspector')
        a.setCheckable(True)
        self.autoscroll_action = a = shortcut_action('autoscroll')
        a.setCheckable(True)
        self.update_autoscroll_action(False)
        self.chrome_action = shortcut_action('chrome')

        self.mode_action = a = shortcut_action('mode')
        a.setCheckable(True)
        self.print_action = shortcut_action('print')
        self.preferences_action = shortcut_action('preferences')
        self.metadata_action = shortcut_action('metadata')
        self.update_mode_action()
        self.add_actions()
Ejemplo n.º 9
0
 def addColumnCategory(self, name, columns, visible=True):
     qa = QAction(name, self)
     qa.setCheckable(True)
     qa.setChecked(visible)
     if not visible:
         self._showColumnCategory(columns, False)
     qa.toggled[bool].connect(
         self._currier.curry(self._showColumnCategory, columns))
     self._column_views.append((name, qa, columns))
Ejemplo n.º 10
0
    def create_action(self, for_toolbar=True):
        ac = QAction(get_icons('icon/icon.png'), 'Access Aide', self.gui)

        if not for_toolbar:
            self.register_shortcut(ac, 'access-aide-tool',
                                   default_keys=('Ctrl+Shift+A',))

        ac.triggered.connect(self.main)
        return ac
Ejemplo n.º 11
0
    def __setupUi(self, mainWindow):
        mainWindow.setObjectName("MainWindow")
        self.centralwidget = QWidget(mainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.horizontalLayout = QHBoxLayout(self.centralwidget)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.scrollArea = QScrollArea(self.centralwidget)
        self.scrollArea.setWidgetResizable(True)
        self.scrollArea.setObjectName("scrollArea")
        self.scrollAreaWidgetContents = QWidget()
        self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
        self.gridLayout = QGridLayout(self.scrollAreaWidgetContents)
        self.gridLayout.setObjectName("gridLayout")
        self.__show_form()
        self.scrollArea.setWidget(self.scrollAreaWidgetContents)
        self.horizontalLayout.addWidget(self.scrollArea)
        mainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QMenuBar(mainWindow)
        self.menubar.setObjectName("menubar")
        self.menu = QMenu(self.menubar)
        self.menu.setObjectName("menu")
        mainWindow.setMenuBar(self.menubar)
        self.statusbar = QStatusBar(mainWindow)
        self.statusbar.setObjectName("statusbar")
        mainWindow.setStatusBar(self.statusbar)
        self.action_1 = QAction(mainWindow)
        self.action_1.setObjectName("action")
        self.action_1.triggered.connect(self.send)
        self.action = QAction(mainWindow)
        self.action.setObjectName("action")
        self.action.triggered.connect(self.on_action_triggered)
        self.action_2 = QAction(mainWindow)
        self.action_2.setObjectName("action_2")
        self.action_3 = QAction(mainWindow)
        self.action_3.setObjectName("action_3")
        self.action_3.triggered.connect(self.get_response)
        self.menu.addAction(self.action)
        self.menubar.addAction(self.action_1)
        self.menubar.addAction(self.action_2)
        self.menubar.addAction(self.action_3)
        self.menubar.addAction(self.menu.menuAction())

        self.__retranslateUi(mainWindow)
        QMetaObject.connectSlotsByName(mainWindow)
Ejemplo n.º 12
0
 def __init__(self, gui):
     sc = 'Shift+Alt+G'
     LayoutButton.__init__(self, I('grid.png'), _('Cover Grid'), parent=gui, shortcut=sc)
     self.set_state_to_show()
     self.action_toggle = QAction(self.icon(), _('Toggle') + ' ' + self.label, self)
     gui.addAction(self.action_toggle)
     gui.keyboard.register_shortcut('grid view toggle' + self.label, unicode(self.action_toggle.text()),
                                 default_keys=(sc,), action=self.action_toggle)
     self.action_toggle.triggered.connect(self.toggle)
     self.toggled.connect(self.update_state)
Ejemplo n.º 13
0
    def init_search_box_mixin(self):
        self.search.initialize(
            'main_search_history',
            colorize=True,
            help_text=_(
                'Search (For advanced search click the button to the left)'))
        self.search.cleared.connect(self.search_box_cleared)
        # Queued so that search.current_text will be correct
        self.search.changed.connect(self.search_box_changed,
                                    type=Qt.QueuedConnection)
        self.search.focus_to_library.connect(self.focus_to_library)
        self.clear_button.clicked.connect(self.search.clear_clicked)
        self.advanced_search_button.clicked[bool].connect(
            self.do_advanced_search)

        self.search.clear()
        self.search.setMaximumWidth(self.width() - 150)
        self.action_focus_search = QAction(self)
        shortcuts = list(
            map(lambda x: unicode(x.toString(QKeySequence.PortableText)),
                QKeySequence.keyBindings(QKeySequence.Find)))
        shortcuts += ['/', 'Alt+S']
        self.keyboard.register_shortcut('start search',
                                        _('Start search'),
                                        default_keys=shortcuts,
                                        action=self.action_focus_search)
        self.action_focus_search.triggered.connect(self.focus_search_box)
        self.addAction(self.action_focus_search)
        self.search.setStatusTip(
            re.sub(r'<\w+>', ' ', unicode(self.search.toolTip())))
        self.advanced_search_button.setStatusTip(
            self.advanced_search_button.toolTip())
        self.clear_button.setStatusTip(self.clear_button.toolTip())
        self.set_highlight_only_button_icon()
        self.highlight_only_button.clicked.connect(self.highlight_only_clicked)
        tt = _('Enable or disable search highlighting.') + '<br><br>'
        tt += config.help('highlight_search_matches')
        self.highlight_only_button.setToolTip(tt)
        self.highlight_only_action = ac = QAction(self)
        self.addAction(ac), ac.triggered.connect(self.highlight_only_clicked)
        self.keyboard.register_shortcut('highlight search results',
                                        _('Highlight search results'),
                                        action=self.highlight_only_action)
Ejemplo n.º 14
0
    def genesis(self):
        self.gui.keyboard.register_shortcut(
            'Toggle Quickview',
            _('Toggle Quickview'),
            description=_('Open/close the Quickview panel/window'),
            default_keys=('Q', ),
            action=self.qaction,
            group=self.action_spec[0])
        self.focus_action = QAction(self.gui)
        self.gui.addAction(self.focus_action)
        self.gui.keyboard.register_shortcut(
            'Focus To Quickview',
            _('Focus to Quickview'),
            description=_('Move the focus to the Quickview panel/window'),
            default_keys=('Shift+Q', ),
            action=self.focus_action,
            group=self.action_spec[0])
        self.focus_action.triggered.connect(self.focus_quickview)

        self.focus_bl_action = QAction(self.gui)
        self.gui.addAction(self.focus_bl_action)
        self.gui.keyboard.register_shortcut(
            'Focus from Quickview',
            _('Focus from Quickview to the book list'),
            description=_('Move the focus from Quickview to the book list'),
            default_keys=('Shift+Alt+Q', ),
            action=self.focus_bl_action,
            group=self.action_spec[0])
        self.focus_bl_action.triggered.connect(self.focus_booklist)

        self.search_action = QAction(self.gui)
        self.gui.addAction(self.search_action)
        self.gui.keyboard.register_shortcut(
            'Search from Quickview',
            _('Search from Quickview'),
            description=_('Search for the currently selected Quickview item'),
            default_keys=('Shift+S', ),
            action=self.search_action,
            group=self.action_spec[0])
        self.search_action.triggered.connect(self.search_quickview)
        self.search_action.changed.connect(self.set_search_shortcut)
        self.menuless_qaction.changed.connect(self.set_search_shortcut)
        self.qv_button = QuickviewButton(self.gui, self)
Ejemplo n.º 15
0
    def initActions(self):
        """initalization of actions for main windows"""

        self.help_action = QAction("&Help", self)
        self.help_action.setShortcut("F1")
        self.help_action.setStatusTip('Help')
        self.help_action.triggered.connect(lambda: HelpDialog(self))

        self.about_action = QAction("&About", self)
        self.about_action.setStatusTip('About')
        self.about_action.triggered.connect(self.showAboutMessage)        

        self.new_db_action = QAction("New DB", self)
        self.new_db_action.setShortcut("Ctrl+N")
        self.new_db_action.triggered.connect(self.openNewDB)

        self.delete_сoncept_action = QAction("&Delete", self)
        self.delete_сoncept_action.setShortcut("DEL")
        self.delete_сoncept_action.setStatusTip("Delete")
        self.delete_сoncept_action.triggered.connect(lambda: self.delete(Concept))

        self.delete_subcategory_action = QAction("&Delete subcategory", self)
        self.delete_subcategory_action.triggered.connect(lambda: self.delete(Subcategory))

        self.edit_concept_action = QAction("&Edit", self)
        self.edit_concept_action.setShortcut("F2")
        self.edit_concept_action.triggered.connect(self.editConcept)

        self.edit_relation_action = QAction("&Edit", self)
        self.edit_relation_action.setShortcut("Ctrl+F2")
        self.edit_relation_action.triggered.connect(self.editRelation)

        self.exit_action = QAction("&Exit", self)
        self.exit_action.setShortcut("ESC")
        self.exit_action.triggered.connect(self.close)

        self.select_relation_action = QAction("&Select relation", self)
        self.select_relation_action.triggered.connect(self.setRelationDescription)

        self.delete_relation_action = QAction("&Delete", self)
        self.delete_relation_action.setShortcut("Ctrl+DEL")
        self.delete_relation_action.triggered.connect(lambda: self.delete(Relation))
Ejemplo n.º 16
0
 def create_action(self, for_toolbar=True):
     # Create an action, this will be added to the plugins toolbar and
     # the plugins menu
     ac = QAction(get_icons('images/persian.png'), 'افزودن زبان فارسی و جهت ورق خوردن', self.gui)
     if not for_toolbar:
         # Register a keyboard shortcut for this toolbar action. We only
         # register it for the action created for the menu, not the toolbar,
         # to avoid a double trigger
         self.register_shortcut(ac, 'edit-spans-divs', default_keys=('Ctrl+Shift+Alt+E',))
     ac.triggered.connect(self.add_persian_and_page_direction)
     return ac
Ejemplo n.º 17
0
 def _set_top_ui(self):
     up_frame = QFrame()
     self.up_layout = QHBoxLayout(up_frame)
     self.layout.addWidget(up_frame)
     self.toolbar = QToolBar()
     self.up_layout.addWidget(self.toolbar)
     self.action_back = QAction(QIcon(back_icon), '')
     self.action_forward = QAction(QIcon(forward_icon), '')
     self.action_reload = QAction(QIcon(reload_icon), '')
     self.action_stop = QAction(QIcon(stop_icon), '')
     self.toolbar.addAction(self.action_back)
     self.toolbar.addAction(self.action_forward)
     self.toolbar.addAction(self.action_stop)
     self.toolbar.addAction(self.action_reload)
     self.action_stop.setVisible(False)
     self.action_reload.setVisible(True)
     self.toolbar.addSeparator()
     self.lnt_addr = QLineEdit('http://localhost:10086')
     self.lnt_addr.returnPressed.connect(self.load)
     self.toolbar.addWidget(self.lnt_addr)
Ejemplo n.º 18
0
 def create_action(self, for_toolbar=True):
     # Create an action, this will be added to the plugins toolbar and
     # the plugins menu
     ac = QAction(get_icons('images/space.png'), _('کپی کردن نیم فاصله'), self.gui)
     if not for_toolbar:
         # Register a keyboard shortcut for this toolbar action. We only
         # register it for the action created for the menu, not the toolbar,
         # to avoid a double trigger
         self.register_shortcut(ac, 'css-cms-to-ems', default_keys=('Shift+Space',))
     ac.triggered.connect(self.copy_to_clipboard)
     return ac
Ejemplo n.º 19
0
 def create_action(self, for_toolbar=True):
     # Create an action, this will be added to the plugins toolbar and
     # the plugins menu
     ac = QAction(get_icons('images/center_images.png'), 'وسط چین کردن عکس ها', self.gui)
     if not for_toolbar:
         # Register a keyboard shortcut for this toolbar action. We only
         # register it for the action created for the menu, not the toolbar,
         # to avoid a double trigger
         self.register_shortcut(ac, 'images-centralizer', default_keys=('Ctrl+Shift+W',))
     ac.triggered.connect(self.images_centraler)
     return ac
Ejemplo n.º 20
0
    def __init__(self):
        super(MainWindow, self).__init__()

        self.gamethread = None

        # Quando un utente chiude la finestra di gioco, invia un segnale di chiusura socket
        uscire = QAction("Quit")
        uscire.triggered.connect(lambda: self.closeEvent())

        self.changeScreen("mainWin.ui", self.mainWin)
        self.show()
Ejemplo n.º 21
0
 def __init__(self, gui):
     sc = 'Alt+Shift+F'
     LayoutButton.__init__(self, I('search.png'), _('Search bar'), parent=gui, shortcut=sc)
     self.set_state_to_hide()
     self.action_toggle = QAction(self.icon(), _('Toggle') + ' ' + self.label, self)
     gui.addAction(self.action_toggle)
     gui.keyboard.register_shortcut('search bar toggle' + self.label, unicode_type(self.action_toggle.text()),
                                 default_keys=(sc,), action=self.action_toggle)
     self.action_toggle.triggered.connect(self.toggle)
     self.action_toggle.changed.connect(self.update_shortcut)
     self.toggled.connect(self.update_state)
Ejemplo n.º 22
0
    def __init__(self,
                 name,
                 label,
                 icon,
                 initial_show=True,
                 initial_side_size=120,
                 connect_button=True,
                 orientation=Qt.Orientation.Horizontal,
                 side_index=0,
                 parent=None,
                 shortcut=None,
                 hide_handle_on_single_panel=True):
        QSplitter.__init__(self, parent)
        self.reapply_sizes.connect(self.setSizes,
                                   type=Qt.ConnectionType.QueuedConnection)
        self.hide_handle_on_single_panel = hide_handle_on_single_panel
        if hide_handle_on_single_panel:
            self.state_changed.connect(self.update_handle_width)
        self.original_handle_width = self.handleWidth()
        self.resize_timer = QTimer(self)
        self.resize_timer.setSingleShot(True)
        self.desired_side_size = initial_side_size
        self.desired_show = initial_show
        self.resize_timer.setInterval(5)
        self.resize_timer.timeout.connect(self.do_resize)
        self.setOrientation(orientation)
        self.side_index = side_index
        self._name = name
        self.label = label
        self.initial_side_size = initial_side_size
        self.initial_show = initial_show
        self.splitterMoved.connect(self.splitter_moved,
                                   type=Qt.ConnectionType.QueuedConnection)
        self.button = LayoutButton(icon, label, self, shortcut=shortcut)
        if connect_button:
            self.button.clicked.connect(self.double_clicked)

        if shortcut is not None:
            self.action_toggle = QAction(QIcon(icon),
                                         _('Toggle') + ' ' + label, self)
            self.action_toggle.changed.connect(self.update_shortcut)
            self.action_toggle.triggered.connect(self.toggle_triggered)
            if parent is not None:
                parent.addAction(self.action_toggle)
                if hasattr(parent, 'keyboard'):
                    parent.keyboard.register_shortcut(
                        'splitter %s %s' % (name, label),
                        unicode_type(self.action_toggle.text()),
                        default_keys=(shortcut, ),
                        action=self.action_toggle)
                else:
                    self.action_toggle.setShortcut(shortcut)
            else:
                self.action_toggle.setShortcut(shortcut)
Ejemplo n.º 23
0
 def create_action(self, for_toolbar=True):
     # Create an action, this will be added to the plugins toolbar and
     # the plugins menu
     ac = QAction(get_icons('images/icon.png'), 'Magnify fonts', self.gui)  # noqa
     if not for_toolbar:
         # Register a keyboard shortcut for this toolbar action. We only
         # register it for the action created for the menu, not the toolbar,
         # to avoid a double trigger
         self.register_shortcut(ac, 'magnify-fonts-tool', default_keys=('Ctrl+Shift+Alt+D',))
     ac.triggered.connect(self.ask_user)
     return ac
Ejemplo n.º 24
0
    def initUI(self, masternode_list, imgDir):
        # Set title and geometry
        self.setWindowTitle(self.title)
        self.resize(self.cache.get("window_width"),
                    self.cache.get("window_height"))
        # Set Icons
        self.spmtIcon = QIcon(os.path.join(imgDir, 'spmtLogo_shield.png'))
        self.pivx_icon = QIcon(os.path.join(imgDir, 'icon_pivx.png'))
        self.script_icon = QIcon(os.path.join(imgDir, 'icon_script.png'))
        self.setWindowIcon(self.spmtIcon)
        # Add RPC server menu
        mainMenu = self.menuBar()
        confMenu = mainMenu.addMenu('Setup')
        self.rpcConfMenu = QAction(self.pivx_icon, 'RPC Servers config...',
                                   self)
        self.rpcConfMenu.triggered.connect(self.onEditRPCServer)
        confMenu.addAction(self.rpcConfMenu)
        self.loadMNConfAction = QAction(self.script_icon,
                                        'Import "masternode.conf" file', self)
        self.loadMNConfAction.triggered.connect(self.loadMNConf)
        confMenu.addAction(self.loadMNConfAction)

        # Sort masternode list (by alias if no previous order set)
        if self.cache.get('mnList_order') != {} and (len(
                self.cache.get('mnList_order')) == len(masternode_list)):
            try:
                masternode_list.sort(key=self.extract_order)
            except Exception as e:
                print(e)
                masternode_list.sort(key=self.extract_name)

        else:
            masternode_list.sort(key=self.extract_name)

        # Create main window
        self.mainWindow = MainWindow(self, masternode_list, imgDir)
        self.setCentralWidget(self.mainWindow)

        # Show
        self.show()
        self.activateWindow()
Ejemplo n.º 25
0
    def _create_context_menu(self):
        self.plugin_view.setContextMenuPolicy(Qt.ActionsContextMenu)
        self.install_action = QAction(QIcon(I('plugins/plugin_upgrade_ok.png')), _('&Install'), self)
        self.install_action.setToolTip(_('Install the selected plugin'))
        self.install_action.triggered.connect(self._install_clicked)
        self.install_action.setEnabled(False)
        self.plugin_view.addAction(self.install_action)
        self.forum_action = QAction(QIcon(I('plugins/mobileread.png')), _('Plugin &forum thread'), self)
        self.forum_action.triggered.connect(self._forum_label_activated)
        self.forum_action.setEnabled(False)
        self.plugin_view.addAction(self.forum_action)

        sep1 = QAction(self)
        sep1.setSeparator(True)
        self.plugin_view.addAction(sep1)

        self.toggle_enabled_action = QAction(_('Enable/&disable plugin'), self)
        self.toggle_enabled_action.setToolTip(_('Enable or disable this plugin'))
        self.toggle_enabled_action.triggered.connect(self._toggle_enabled_clicked)
        self.toggle_enabled_action.setEnabled(False)
        self.plugin_view.addAction(self.toggle_enabled_action)
        self.uninstall_action = QAction(_('&Remove plugin'), self)
        self.uninstall_action.setToolTip(_('Uninstall the selected plugin'))
        self.uninstall_action.triggered.connect(self._uninstall_clicked)
        self.uninstall_action.setEnabled(False)
        self.plugin_view.addAction(self.uninstall_action)

        sep2 = QAction(self)
        sep2.setSeparator(True)
        self.plugin_view.addAction(sep2)

        self.donate_enabled_action = QAction(QIcon(I('donate.png')), _('Donate to developer'), self)
        self.donate_enabled_action.setToolTip(_('Donate to the developer of this plugin'))
        self.donate_enabled_action.triggered.connect(self._donate_clicked)
        self.donate_enabled_action.setEnabled(False)
        self.plugin_view.addAction(self.donate_enabled_action)

        sep3 = QAction(self)
        sep3.setSeparator(True)
        self.plugin_view.addAction(sep3)

        self.configure_action = QAction(QIcon(I('config.png')), _('&Customize plugin'), self)
        self.configure_action.setToolTip(_('Customize the options for this plugin'))
        self.configure_action.triggered.connect(self._configure_clicked)
        self.configure_action.setEnabled(False)
        self.plugin_view.addAction(self.configure_action)
Ejemplo n.º 26
0
    def __init__(self, parent, cover_flow):
        QDialog.__init__(self, parent)
        self._layout = QStackedLayout()
        self.setLayout(self._layout)
        self.setWindowTitle(_('Browse by covers'))
        self.layout().addWidget(cover_flow)

        geom = gprefs.get('cover_browser_dialog_geometry', None)
        if not geom or not QApplication.instance().safe_restore_geometry(
                self, geom):
            h, w = available_height() - 60, int(available_width() / 1.5)
            self.resize(w, h)
        self.action_fs_toggle = a = QAction(self)
        self.addAction(a)
        a.setShortcuts([
            QKeySequence('F11', QKeySequence.SequenceFormat.PortableText),
            QKeySequence('Ctrl+Shift+F',
                         QKeySequence.SequenceFormat.PortableText)
        ])
        a.triggered.connect(self.toggle_fullscreen)
        self.action_esc_fs = a = QAction(self)
        a.triggered.connect(self.show_normal)
        self.addAction(a)
        a.setShortcuts(
            [QKeySequence('Esc', QKeySequence.SequenceFormat.PortableText)])

        self.pre_fs_geom = None
        cover_flow.setFocus(Qt.FocusReason.OtherFocusReason)
        self.view_action = a = QAction(self)
        iactions = parent.iactions
        self.addAction(a)
        a.setShortcuts(
            list(iactions['View'].menuless_qaction.shortcuts()) +
            [QKeySequence(Qt.Key.Key_Space)])
        a.triggered.connect(iactions['View'].menuless_qaction.trigger)
        self.sd_action = a = QAction(self)
        self.addAction(a)
        a.setShortcuts(
            list(iactions['Send To Device'].menuless_qaction.shortcuts()))
        a.triggered.connect(
            iactions['Send To Device'].menuless_qaction.trigger)
Ejemplo n.º 27
0
 def create_action(self, for_toolbar=True):
     # Create an action, this will be added to the plugins toolbar and
     # the plugins menu
     ac = QAction(get_icons('images/momayez.png'), 'درست کردن تاریخ و ممیز فارسی', self.gui)
     # self.restore_prefs()
     if not for_toolbar:
         # Register a keyboard shortcut for this toolbar action. We only
         # register it for the action created for the menu, not the toolbar,
         # to avoid a double trigger
         self.register_shortcut(ac, 'smarter-punctuation', default_keys=('Ctrl+Shift+Alt+S',))
     ac.triggered.connect(self.brows_html_files)
     return ac
Ejemplo n.º 28
0
        def __init__(self, location_manager, parent):
            QMenuBar.__init__(self, parent)
            parent.setMenuBar(self)
            self.gui = parent

            self.location_manager = location_manager
            self.added_actions = []

            self.donate_action = QAction(_('Donate'), self)
            self.donate_menu = QMenu()
            self.donate_menu.addAction(self.gui.donate_action)
            self.donate_action.setMenu(self.donate_menu)
Ejemplo n.º 29
0
    def __init__(self,
                 text=None,
                 color_caption="#F0F0FF",
                 icon="",
                 config=None):
        """
        text - text in caption and tooltip
        icon - filename for icon of button
        list_colors - list colors for select
        """
        QToolButton.__init__(self, None)
        self.setAutoRaise(True)

        self._text = self.tr("Color") if text is None else text
        self._color_caption = color_caption

        # --- list of colors -----------------------------------
        lst = []
        if config:
            lst = [
                c for c in config.get("TextEditor/Colors", "").split(";") if c
            ]

        if not lst:
            lst = [
                "#99cc00", "#e2fbfe", "#fee5e2", "#fa8072", "#f5f7a8",
                "#fef65b", "#ff9a00", "#ff00f4", "#f6f900", "#914285",
                "#c0d6e4", "#f5f5dc", "#3d40a2", "#acd2cd", "#ff9966",
                "#a4c73c", "#ff7373", "#50d4ee", "#8d5959", "#104022",
                "#000000", "#160042", "#6e57d2", "#4c9828", "#444193",
                "#0000ff", "#ff0000", "white", "#AA0000", "#00AA00", "#0040C2",
                "#550000", "#004100", "#BF4040"
            ]
        if config:
            config["TextEditor/Colors"] = ";".join(lst)

        lst.append(color_caption)  # the list must contain a background color
        self._colors = lst
        # ------------------------------------------------------

        self._colors_widget = ColorsWidget(text=self._text,
                                           colors=self._colors,
                                           color_caption=color_caption)
        self._colors_widget.select_color.connect(self.select_color_)
        self._colors_widget.hide_form.connect(self.hide_color_form)
        self._colors_widget.other_color.connect(self.other_color)

        self._action = QAction(self._text, None)
        self._action.setIcon(QIcon(img(icon)))
        self._action.triggered.connect(self.show_form_colors)

        self.setDefaultAction(self._action)
Ejemplo n.º 30
0
 def genesis(self):
     self.menu = m = self.qaction.menu()
     m.aboutToShow.connect(self.about_to_show_menu)
     self.qs_action = QAction(self.gui)
     self.gui.addAction(self.qs_action)
     self.qs_action.triggered.connect(self.gui.choose_vl_triggerred)
     self.gui.keyboard.register_shortcut(
         self.unique_name + ' - ' + 'quick-select-vl',
         _('Quick select Virtual library'),
         default_keys=('Ctrl+T', ),
         action=self.qs_action,
         description=_('Quick select a Virtual library'),
         group=self.action_spec[0])