当前位置: 首页>>代码示例>>Python>>正文


Python standard.MainWindow类代码示例

本文整理汇总了Python中cola.widgets.standard.MainWindow的典型用法代码示例。如果您正苦于以下问题:Python MainWindow类的具体用法?Python MainWindow怎么用?Python MainWindow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MainWindow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: apply_state

 def apply_state(self, state):
     """Imports data for save/restore"""
     # 1 is the widget version; change when widgets are added/removed
     MainWindow.apply_state(self, state)
     qtutils.apply_window_state(self, state, 1)
     for widget in self.dockwidgets:
         widget.titleBarWidget().update_tooltips()
开发者ID:HonestQiao,项目名称:git-cola,代码行数:7,代码来源:view.py

示例2: closeEvent

    def closeEvent(self, event):
        """Save state in the settings manager."""
        s = settings.Settings()
        s.add_recent(core.decode(os.getcwd()))
        qtutils.save_state(self, handler=s)

        commit_msg = self.commitmsgeditor.commit_message(raw=True)
        self.model.save_commitmsg(commit_msg)

        MainWindow.closeEvent(self, event)
开发者ID:yjpark,项目名称:git-cola,代码行数:10,代码来源:view.py

示例3: apply_state

    def apply_state(self, state):
        """Imports data for save/restore"""
        result = MainWindow.apply_state(self, state)
        self.lock_layout_action.setChecked(state.get('lock_layout', False))

        show_status_filter = state.get('show_status_filter', False)
        self.statuswidget.filter_widget.setVisible(show_status_filter)
        return result
开发者ID:kewelinho,项目名称:git-cola,代码行数:8,代码来源:main.py

示例4: apply_state

 def apply_state(self, state):
     result = MainWindow.apply_state(self, state)
     try:
         count = state['count']
         if self.dag.overridden('count'):
             count = self.dag.count
     except:
         count = self.dag.count
         result = False
     self.dag.set_count(count)
     self.lock_layout_action.setChecked(state.get('lock_layout', False))
     return result
开发者ID:B-Rich,项目名称:git-cola,代码行数:12,代码来源:dag.py

示例5: closeEvent

 def closeEvent(self, event):
     self.revtext.close_popup()
     self.thread.stop()
     MainWindow.closeEvent(self, event)
开发者ID:B-Rich,项目名称:git-cola,代码行数:4,代码来源:dag.py

示例6: show

 def show(self):
     MainWindow.show(self)
     self.treewidget.adjust_columns()
开发者ID:B-Rich,项目名称:git-cola,代码行数:3,代码来源:dag.py

示例7: export_state

 def export_state(self):
     state = MainWindow.export_state(self)
     state['count'] = self.dag.count
     return state
开发者ID:B-Rich,项目名称:git-cola,代码行数:4,代码来源:dag.py

示例8: __init__

    def __init__(self, model, parent=None):
        MainWindow.__init__(self, parent)
        self.setAttribute(Qt.WA_MacMetalStyle)

        # Default size; this is thrown out when save/restore is used
        self.resize(987, 610)
        self.model = model
        self.prefs_model = prefs_model = prefs.PreferencesModel()

        # The widget version is used by import/export_state().
        # Change this whenever dockwidgets are removed.
        self.widget_version = 2

        # Keeps track of merge messages we've seen
        self.merge_message_hash = ""

        cfg = gitcfg.instance()
        self.browser_dockable = cfg.get("cola.browserdockable") or cfg.get("cola.classicdockable")
        if self.browser_dockable:
            self.browserdockwidget = create_dock(N_("Browser"), self)
            self.browserwidget = worktree_browser_widget(self)
            self.browserdockwidget.setWidget(self.browserwidget)

        # "Actions" widget
        self.actionsdockwidget = create_dock(N_("Actions"), self)
        self.actionsdockwidgetcontents = action.ActionButtons(self)
        self.actionsdockwidget.setWidget(self.actionsdockwidgetcontents)
        self.actionsdockwidget.toggleViewAction().setChecked(False)
        self.actionsdockwidget.hide()

        # "Repository Status" widget
        self.statuswidget = StatusWidget(self)
        self.statusdockwidget = create_dock(N_("Status"), self)
        self.statusdockwidget.setWidget(self.statuswidget)

        # "Commit Message Editor" widget
        self.position_label = QtGui.QLabel()
        font = qtutils.default_monospace_font()
        font.setPointSize(int(font.pointSize() * 0.8))
        self.position_label.setFont(font)
        self.commitdockwidget = create_dock(N_("Commit"), self)
        titlebar = self.commitdockwidget.titleBarWidget()
        titlebar.add_corner_widget(self.position_label)

        self.commitmsgeditor = CommitMessageEditor(model, self)
        self.commitdockwidget.setWidget(self.commitmsgeditor)

        # "Console" widget
        self.logwidget = LogWidget()
        self.logdockwidget = create_dock(N_("Console"), self)
        self.logdockwidget.setWidget(self.logwidget)
        self.logdockwidget.toggleViewAction().setChecked(False)
        self.logdockwidget.hide()

        # "Diff Viewer" widget
        self.diffdockwidget = create_dock(N_("Diff"), self)
        self.diffeditor = DiffEditor(self.diffdockwidget)
        self.diffdockwidget.setWidget(self.diffeditor)

        # "Diff Options" tool menu
        self.diff_ignore_space_at_eol_action = add_action(
            self, N_("Ignore changes in whitespace at EOL"), self._update_diff_opts
        )
        self.diff_ignore_space_at_eol_action.setCheckable(True)

        self.diff_ignore_space_change_action = add_action(
            self, N_("Ignore changes in amount of whitespace"), self._update_diff_opts
        )
        self.diff_ignore_space_change_action.setCheckable(True)

        self.diff_ignore_all_space_action = add_action(self, N_("Ignore all whitespace"), self._update_diff_opts)
        self.diff_ignore_all_space_action.setCheckable(True)

        self.diff_function_context_action = add_action(
            self, N_("Show whole surrounding functions of changes"), self._update_diff_opts
        )
        self.diff_function_context_action.setCheckable(True)

        self.diffopts_button = create_toolbutton(text=N_("Options"), icon=options_icon(), tooltip=N_("Diff Options"))
        self.diffopts_menu = create_menu(N_("Diff Options"), self.diffopts_button)

        self.diffopts_menu.addAction(self.diff_ignore_space_at_eol_action)
        self.diffopts_menu.addAction(self.diff_ignore_space_change_action)
        self.diffopts_menu.addAction(self.diff_ignore_all_space_action)
        self.diffopts_menu.addAction(self.diff_function_context_action)
        self.diffopts_button.setMenu(self.diffopts_menu)
        self.diffopts_button.setPopupMode(QtGui.QToolButton.InstantPopup)

        titlebar = self.diffdockwidget.titleBarWidget()
        titlebar.add_corner_widget(self.diffopts_button)

        # All Actions
        self.unstage_all_action = add_action(self, N_("Unstage All"), cmds.run(cmds.UnstageAll))
        self.unstage_all_action.setIcon(qtutils.icon("remove.svg"))

        self.unstage_selected_action = add_action(self, N_("Unstage From Commit"), cmds.run(cmds.UnstageSelected))
        self.unstage_selected_action.setIcon(qtutils.icon("remove.svg"))

        self.show_diffstat_action = add_action(self, N_("Diffstat"), cmds.run(cmds.Diffstat), "Alt+D")

#.........这里部分代码省略.........
开发者ID:pwr,项目名称:git-cola,代码行数:101,代码来源:main.py

示例9: closeEvent

 def closeEvent(self, event):
     """Save state in the settings manager."""
     commit_msg = self.commitmsgeditor.commit_message(raw=True)
     self.model.save_commitmsg(commit_msg)
     MainWindow.closeEvent(self, event)
开发者ID:kewelinho,项目名称:git-cola,代码行数:5,代码来源:main.py

示例10: export_state

 def export_state(self):
     """Exports data for save/restore"""
     state = MainWindow.export_state(self)
     return qtutils.export_window_state(self, state, self.widget_version)
开发者ID:yjpark,项目名称:git-cola,代码行数:4,代码来源:view.py

示例11: __init__

    def __init__(self, model, parent):
        MainWindow.__init__(self, parent)
        # Default size; this is thrown out when save/restore is used
        self.resize(987, 610)
        self.model = model
        self.prefs_model = prefs_model = PreferencesModel()

        # Internal field used by import/export_state().
        # Change this whenever dockwidgets are removed.
        self.widget_version = 1

        # Keeps track of merge messages we've seen
        self.merge_message_hash = ''

        self.setAcceptDrops(True)
        self.setAttribute(Qt.WA_MacMetalStyle)

        # Dockwidget options
        qtcompat.set_common_dock_options(self)

        cfg = gitcfg.instance()
        self.classic_dockable = (cfg.get('cola.browserdockable') or
                                 cfg.get('cola.classicdockable'))
        if self.classic_dockable:
            self.classicdockwidget = create_dock('Browser', self)
            self.classicwidget = classic_widget(self)
            self.classicdockwidget.setWidget(self.classicwidget)

        # "Actions" widget
        self.actionsdockwidget = create_dock('Action', self)
        self.actionsdockwidgetcontents = qt.QFlowLayoutWidget(self)
        layout = self.actionsdockwidgetcontents.layout()
        self.stage_button = create_button(text='Stage', layout=layout)
        self.unstage_button = create_button(text='Unstage', layout=layout)
        self.rescan_button = create_button(text='Rescan', layout=layout)
        self.fetch_button = create_button(text='Fetch...', layout=layout)
        self.push_button = create_button(text='Push...', layout=layout)
        self.pull_button = create_button(text='Pull...', layout=layout)
        self.stash_button = create_button(text='Stash...', layout=layout)
        layout.addStretch()
        self.actionsdockwidget.setWidget(self.actionsdockwidgetcontents)

        # "Repository Status" widget
        self.statusdockwidget = create_dock('Status', self)
        self.statusdockwidget.setWidget(StatusWidget(self))

        # "Commit Message Editor" widget
        self.position_label = QtGui.QLabel()
        font = qtutils.default_monospace_font()
        font.setPointSize(int(font.pointSize() * 0.8))
        self.position_label.setFont(font)
        self.commitdockwidget = create_dock('Commit', self)
        titlebar = self.commitdockwidget.titleBarWidget()
        titlebar.add_corner_widget(self.position_label)

        self.commitmsgeditor = CommitMessageEditor(model, self)
        relay_signal(self, self.commitmsgeditor, SIGNAL(signals.amend_mode))
        relay_signal(self, self.commitmsgeditor, SIGNAL(signals.signoff))
        relay_signal(self, self.commitmsgeditor,
                     SIGNAL(signals.load_previous_message))
        self.commitdockwidget.setWidget(self.commitmsgeditor)

        # "Console" widget
        self.logwidget = LogWidget()
        self.logdockwidget = create_dock('Console', self)
        self.logdockwidget.setWidget(self.logwidget)
        cola.notifier().connect(signals.log_cmd, self.logwidget.log)

        # "Diff Viewer" widget
        self.diffdockwidget = create_dock('Diff', self)
        self.diffeditor = DiffEditor(self.diffdockwidget)
        self.diffdockwidget.setWidget(self.diffeditor)

        # All Actions
        self.menu_unstage_all = add_action(self,
                'Unstage All', emit(self, signals.unstage_all))
        self.menu_unstage_all.setIcon(qtutils.icon('remove.svg'))

        self.menu_unstage_selected = add_action(self,
                'Unstage From Commit', emit(self, signals.unstage_selected))
        self.menu_unstage_selected.setIcon(qtutils.icon('remove.svg'))

        self.menu_show_diffstat = add_action(self,
                'Diffstat', emit(self, signals.diffstat), 'Alt+D')

        self.menu_stage_modified = add_action(self,
                'Stage Changed Files To Commit',
                emit(self, signals.stage_modified), 'Alt+A')
        self.menu_stage_modified.setIcon(qtutils.icon('add.svg'))

        self.menu_stage_untracked = add_action(self,
                'Stage All Untracked', emit(self, signals.stage_untracked), 'Alt+U')
        self.menu_stage_untracked.setIcon(qtutils.icon('add.svg'))

        self.menu_export_patches = add_action(self,
                'Export Patches...', guicmds.export_patches, 'Alt+E')
        self.menu_preferences = add_action(self,
                'Preferences', lambda: preferences(model=prefs_model),
                QtGui.QKeySequence.Preferences, 'Ctrl+O')

#.........这里部分代码省略.........
开发者ID:haffmans,项目名称:git-cola,代码行数:101,代码来源:view.py

示例12: apply_state

 def apply_state(self, state):
     """Imports data for save/restore"""
     # 1 is the widget version; change when widgets are added/removed
     MainWindow.apply_state(self, state)
     qtutils.apply_window_state(self, state, 1)
开发者ID:haffmans,项目名称:git-cola,代码行数:5,代码来源:view.py

示例13: closeEvent

 def closeEvent(self, event):
     """Save state in the settings manager."""
     s = settings.Settings()
     s.add_recent(core.decode(os.getcwd()))
     qtutils.save_state(self, handler=s)
     MainWindow.closeEvent(self, event)
开发者ID:haffmans,项目名称:git-cola,代码行数:6,代码来源:view.py

示例14: resizeEvent

 def resizeEvent(self, e):
     MainWindow.resizeEvent(self, e)
     self.treewidget.adjust_columns()
开发者ID:B-Rich,项目名称:git-cola,代码行数:3,代码来源:dag.py

示例15: __init__

    def __init__(self, model, parent=None):
        MainWindow.__init__(self, parent)
        # Default size; this is thrown out when save/restore is used
        self.resize(987, 610)
        self.model = model
        self.prefs_model = prefs_model = prefs.PreferencesModel()

        # The widget version is used by import/export_state().
        # Change this whenever dockwidgets are removed.
        self.widget_version = 2

        # Keeps track of merge messages we've seen
        self.merge_message_hash = ''

        self.setAcceptDrops(True)
        self.setAttribute(Qt.WA_MacMetalStyle)

        cfg = gitcfg.instance()
        self.browser_dockable = (cfg.get('cola.browserdockable') or
                                 cfg.get('cola.classicdockable'))
        if self.browser_dockable:
            self.browserdockwidget = create_dock(N_('Browser'), self)
            self.browserwidget = worktree_browser_widget(self)
            self.browserdockwidget.setWidget(self.browserwidget)

        # "Actions" widget
        self.actionsdockwidget = create_dock(N_('Actions'), self)
        self.actionsdockwidgetcontents = action.ActionButtons(self)
        self.actionsdockwidget.setWidget(self.actionsdockwidgetcontents)
        self.actionsdockwidget.toggleViewAction().setChecked(False)
        self.actionsdockwidget.hide()

        # "Repository Status" widget
        self.statuswidget = StatusWidget(self)
        self.statusdockwidget = create_dock(N_('Status'), self)
        self.statusdockwidget.setWidget(self.statuswidget)

        # "Commit Message Editor" widget
        self.position_label = QtGui.QLabel()
        font = qtutils.default_monospace_font()
        font.setPointSize(int(font.pointSize() * 0.8))
        self.position_label.setFont(font)
        self.commitdockwidget = create_dock(N_('Commit'), self)
        titlebar = self.commitdockwidget.titleBarWidget()
        titlebar.add_corner_widget(self.position_label)

        self.commitmsgeditor = CommitMessageEditor(model, self)
        self.commitdockwidget.setWidget(self.commitmsgeditor)

        # "Console" widget
        self.logwidget = LogWidget()
        self.logdockwidget = create_dock(N_('Console'), self)
        self.logdockwidget.setWidget(self.logwidget)
        self.logdockwidget.toggleViewAction().setChecked(False)
        self.logdockwidget.hide()

        # "Diff Viewer" widget
        self.diffdockwidget = create_dock(N_('Diff'), self)
        self.diffeditor = DiffEditor(self.diffdockwidget)
        self.diffdockwidget.setWidget(self.diffeditor)

        # "Diff Options" tool menu
        self.diff_ignore_space_at_eol_action = add_action(self,
                N_('Ignore changes in whitespace at EOL'),
                self._update_diff_opts)
        self.diff_ignore_space_at_eol_action.setCheckable(True)

        self.diff_ignore_space_change_action = add_action(self,
                N_('Ignore changes in amount of whitespace'),
                self._update_diff_opts)
        self.diff_ignore_space_change_action.setCheckable(True)

        self.diff_ignore_all_space_action = add_action(self,
                N_('Ignore all whitespace'),
                self._update_diff_opts)
        self.diff_ignore_all_space_action.setCheckable(True)

        self.diff_function_context_action = add_action(self,
                N_('Show whole surrounding functions of changes'),
                self._update_diff_opts)
        self.diff_function_context_action.setCheckable(True)

        self.diffopts_button = create_toolbutton(text=N_('Options'),
                                                 icon=options_icon(),
                                                 tooltip=N_('Diff Options'))
        self.diffopts_menu = create_menu(N_('Diff Options'),
                                         self.diffopts_button)

        self.diffopts_menu.addAction(self.diff_ignore_space_at_eol_action)
        self.diffopts_menu.addAction(self.diff_ignore_space_change_action)
        self.diffopts_menu.addAction(self.diff_ignore_all_space_action)
        self.diffopts_menu.addAction(self.diff_function_context_action)
        self.diffopts_button.setMenu(self.diffopts_menu)
        self.diffopts_button.setPopupMode(QtGui.QToolButton.InstantPopup)

        titlebar = self.diffdockwidget.titleBarWidget()
        titlebar.add_corner_widget(self.diffopts_button)

        # All Actions
        self.menu_unstage_all = add_action(self,
#.........这里部分代码省略.........
开发者ID:etsrepo,项目名称:git-cola,代码行数:101,代码来源:main.py


注:本文中的cola.widgets.standard.MainWindow类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。