當前位置: 首頁>>代碼示例>>Python>>正文


Python MainWindow.get_open_projects方法代碼示例

本文整理匯總了Python中main_window.MainWindow.get_open_projects方法的典型用法代碼示例。如果您正苦於以下問題:Python MainWindow.get_open_projects方法的具體用法?Python MainWindow.get_open_projects怎麽用?Python MainWindow.get_open_projects使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在main_window.MainWindow的用法示例。


在下文中一共展示了MainWindow.get_open_projects方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: IDE

# 需要導入模塊: from main_window import MainWindow [as 別名]
# 或者: from main_window.MainWindow import get_open_projects [as 別名]
class IDE(QMainWindow, IDEGeneric):

    max_opacity = 1
    min_opacity = 0.3

    def __init__(self):
        QWidget.__init__(self)
        IDEGeneric.__init__(self)
        self.setWindowTitle('NINJA-IDE {Ninja Is Not Just Another IDE}')
        self.setWindowIcon(QIcon(resources.images['icon']))
        self.setWindowState(Qt.WindowMaximized)
        self.setMinimumSize(700, 500)

        #Opactity
        self.opacity = 1

        #ToolBar
        self._toolbar = QToolBar()
        self._toolbar.setToolTip('Press and Drag to Move')
        styles.set_style(self._toolbar, 'toolbar-default')
        self.addToolBar(Qt.LeftToolBarArea, self._toolbar)
        self._toolbar.setToolButtonStyle(Qt.ToolButtonIconOnly)

        #StatusBar
        self._status = StatusBar()
        self._status.hide()
        self.setStatusBar(self._status)

        #Main Widgets
        self.main = MainWindow(self)
        self.setCentralWidget(self.main)

        #Menu
        menubar = self.menuBar()
        styles.apply(menubar, 'menu')
        file_ = menubar.addMenu('&File')
        edit = menubar.addMenu('&Edit')
        view = menubar.addMenu('&View')
        project = menubar.addMenu('&Project')
        self.pluginsMenu = menubar.addMenu('P&lugins')
        about = menubar.addMenu('&About')

        #The order of the icons in the toolbar is defined by this calls
        self._menuFile = MenuFile(file_, self._toolbar, self.main)
        self._menuView = MenuView(view, self, self.main)
        self._menuEdit = MenuEdit(edit, self._toolbar, self.main, self._status)
        self._menuProject = MenuProject(project, self._toolbar, self.main)
        self._menuPlugins = MenuPlugins(self.pluginsMenu, self)
        self._menuAbout = MenuAbout(about, self.main)

        self.main.container.load_toolbar(self._toolbar)
        self.main._central.actual_tab().obtain_editor().setFocus()

        filenames, projects_path = core.cliparser.parse()

        for filename in filenames:
            self.main.open_document(filename)

        for project_path in projects_path:
            self.main.open_project_folder(project_path)

        self.connect(self.main, SIGNAL("fileSaved(QString)"), self.show_status_message)

    def show_status_message(self, message):
        self._status.showMessage(message, 2000)

    def add_toolbar_item(self, plugin, name, icon):
        self._toolbar.addSeparator()
        action = self._toolbar.addAction(QIcon(icon), name)
        self.connect(action, SIGNAL("triggered()"), lambda: plugin.toolbarAction())

    def closeEvent(self, event):
        settings = QSettings('NINJA-IDE','Kunai')
        if settings.value('Preferences/General/load_files', 2).toInt()[0]==2:
            settings.setValue('Open_Files/projects',self.main.get_open_projects())
            settings.setValue('Open_Files/tab1', self.main._central._tabs.get_open_files())
            settings.setValue('Open_Files/tab2', self.main._central._tabs2.get_open_files())
        else:
            settings.setValue('Open_Files/projects',[])

        if self.main._central.check_for_unsaved():
            val = QMessageBox.question(self, 'Some changes were not saved',
                        'Do you want to exit anyway?', QMessageBox.Yes, QMessageBox.No)
            if val == QMessageBox.No:
                event.ignore()
            else:
                self.main._properties._treeProjects.close_open_projects()
        else:
            self.main._properties._treeProjects.close_open_projects()

    def wheelEvent(self, event):
        if event.modifiers() == Qt.AltModifier:
            if event.delta() == 120 and self.opacity < self.max_opacity:
                self.opacity += 0.1
            elif event.delta() == -120 and self.opacity > self.min_opacity:
                self.opacity -= 0.1
            self.setWindowOpacity(self.opacity)
            event.ignore()
        else:
            super(IDE, self).wheelEvent(event)
開發者ID:calpe20,項目名稱:PYTHONIZANDO,代碼行數:102,代碼來源:ide.py


注:本文中的main_window.MainWindow.get_open_projects方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。