コード例 #1
0
ファイル: main_window.py プロジェクト: mike-perdide/gitbuster
    def connect_slots(self):
        """
            Connect the slots to the objects.
        """
        gui = self._ui
        # Bottom bar connections
        _connect_button(gui.applyButton, self.apply)
        _connect_button(gui.refreshButton, self.refresh)

        # Connecting actions
        self.connect(gui.actionChange_repository,
                     SIGNAL("triggered(bool)"),
                     self.change_directory)

        action_shortcuts = (
            (gui.actionUndo, QKeySequence.Undo, self.undo_history),
            (gui.actionRedo, QKeySequence.Redo, self.redo_history),
            (gui.actionQuit, QKeySequence.Quit, self.quit),
            (gui.actionShow_modifications, None, self.show_modifications),
            (gui.actionHide_modifications, None, self.hide_modifications),
            (gui.actionNew_branch, None, self.new_remote_branch),
            (gui.actionApply, None, self.apply),
            (gui.actionAbout_Gitbuster, None, self.about_box))
        for action, shortcut, slot in action_shortcuts:
            if shortcut:
                action.setShortcut(shortcut)
            QObject.connect(action, SIGNAL("triggered()"), slot)

        self.connect(self.rebase_main_class, SIGNAL("newHistAction"),
                     self.add_history_action)
        self.connect(self.rebase_main_class, SIGNAL("newBranchFromCommit"),
                     self.create_new_branch_from_model)

        shortcut = QShortcut(QKeySequence(QKeySequence.Delete), self)
        QObject.connect(shortcut, SIGNAL("activated()"), self.remove_rows)
コード例 #2
0
    def connect_slots(self):
        """
            Connect the slots to the objects.
        """
        connect = QObject.connect

        connect(self.gui.mergeCheckBox, SIGNAL("stateChanged(int)"),
                self.merge_clicked)

        # This can't be done using edit triggers : edit when enter is pressed
        connect(self.gui.tableView,
                SIGNAL("activated(const QModelIndex&)"),
                self.gui.tableView.edit)

        # Change current branch when the currentBranchComboBox current index is
        # changed.
        connect(self.gui.currentBranchComboBox,
                SIGNAL("currentIndexChanged(const QString&)"),
                self.current_branch_changed)

        # Apply filters when filter edit widgets are edited or when the filter
        # checkboxes are ticked.
        for signal, widgets in _FILTER_WIDGETS.iteritems():
            for widgetname in widgets.split():
                widget = getattr(self.gui, widgetname)
                connect(widget, SIGNAL(signal), self.apply_filters)

        # Connecting the re-order push button to the re-order method.
        _connect_button(self.gui.reOrderPushButton, self.reorder_pushed)