Esempio n. 1
0
 def add_new_file_actions(self, menu):
     for applet in self.paradigm_container.paradigms.values():
         action = QtGui.QAction(qicon(applet.icon), 'New %s' % applet.default_name, self)
         action.triggered.connect(self.new_file)
         self._new_file_actions[action] = applet
         menu.addAction(action)
     menu.addSeparator()
Esempio n. 2
0
def launch_lab(plugin_class):
    from openalea.oalab.gui.splittablewindow import OALabMainWin
    from openalea.core.settings import get_openalea_home_dir
    from openalea.core.path import path as Path
    from openalea.core.service.introspection import alias
    from openalea.oalab.gui.utils import qicon

    plugin = plugin_class()
    lab_class = plugin()
    layout_path = Path(get_openalea_home_dir()) / '%s.oaui' % lab_class.name
    OALabMainWin.DEFAULT_LAYOUT_PATH = layout_path
    OALabMainWin.DEFAULT_LAYOUT = lab_class.layout
    OALabMainWin.DEFAULT_MENU_NAMES = lab_class.menu_names
    OALabMainWin.LAB = lab_class
    if hasattr(lab_class, "start"):
        lab_class.start()
    win = OALabMainWin(lab=lab_class)
    win.setWindowIcon(qicon(lab_class.icon))
    if hasattr(lab_class, 'connect_applet'):
        win.appletSet.connect(lab_class.connect_applet)
    win.emit_applet_set()
    if hasattr(lab_class, "initialize"):
        lab_class.initialize()
    win.initialize()
    win.setWindowTitle('OpenAleaLab "%s"' % alias(plugin))
    win.showMaximized()
    win.raise_()

    return win
Esempio n. 3
0
def launch_lab(plugin_class):
    from openalea.oalab.gui.splittablewindow import OALabMainWin
    from openalea.core.settings import get_openalea_home_dir
    from openalea.core.path import path as Path
    from openalea.core.service.introspection import alias
    from openalea.oalab.gui.utils import qicon

    plugin = plugin_class()
    lab_class = plugin()
    layout_path = Path(get_openalea_home_dir()) / '%s.oaui' % lab_class.name
    OALabMainWin.DEFAULT_LAYOUT_PATH = layout_path
    OALabMainWin.DEFAULT_LAYOUT = lab_class.layout
    OALabMainWin.DEFAULT_MENU_NAMES = lab_class.menu_names
    OALabMainWin.LAB = lab_class
    if hasattr(lab_class, "start"):
        lab_class.start()
    win = OALabMainWin(lab=lab_class)
    win.setWindowIcon(qicon(lab_class.icon))
    if hasattr(lab_class, 'connect_applet'):
        win.appletSet.connect(lab_class.connect_applet)
    win.emit_applet_set()
    if hasattr(lab_class, "initialize"):
        lab_class.initialize()
    win.initialize()
    win.setWindowTitle('OpenAleaLab "%s"' % alias(plugin))
    win.showMaximized()
    win.raise_()

    return win
Esempio n. 4
0
 def add_new_file_actions(self, menu):
     for applet in self.paradigm_container.paradigms.values():
         action = QtGui.QAction(qicon(applet.icon),
                                'New %s' % applet.default_name, self)
         action.triggered.connect(self.new_file)
         self._new_file_actions[action] = applet
         menu.addAction(action)
     menu.addSeparator()
Esempio n. 5
0
    def _create_actions(self):
        self.action_title = QtGui.QAction("Set Title", self)
        self.action_title.triggered.connect(self._on_set_title_triggered)

        self.action_unlock = QtGui.QAction(qicon('oxygen_object-unlocked.png'), "Edit layout", self.menu_edit_off)
        self.action_unlock.triggered.connect(self.unlock_layout)

        self.action_lock = QtGui.QAction(qicon('oxygen_object-locked.png'), "Lock layout", self.menu_edit_on)
        self.action_lock.triggered.connect(self.lock_layout)

        self.action_add_tab = QtGui.QAction(qicon('Crystal_Clear_action_edit_add.png'), "Add tab", self.menu_edit_on)
        self.action_add_tab.triggered.connect(self._tabwidget.new_tab)

        self.action_remove_tab = QtGui.QAction(
            qicon('Crystal_Clear_action_edit_remove.png'), "Remove tab", self.menu_edit_on)
        self.action_remove_tab.triggered.connect(self._tabwidget.remove_tab)

        self.action_push_to_shell = QtGui.QAction("DEBUG push applet to shell", self.menu_edit_on)
        self.action_push_to_shell.triggered.connect(self._push_applet_to_shell)
Esempio n. 6
0
    def _create_actions(self):
        self.action_title = QtGui.QAction("Set Title", self)
        self.action_title.triggered.connect(self._on_set_title_triggered)

        self.action_unlock = QtGui.QAction(qicon('oxygen_object-unlocked.png'), "Edit layout", self.menu_edit_off)
        self.action_unlock.triggered.connect(self.unlock_layout)

        self.action_lock = QtGui.QAction(qicon('oxygen_object-locked.png'), "Lock layout", self.menu_edit_on)
        self.action_lock.triggered.connect(self.lock_layout)

        self.action_add_tab = QtGui.QAction(qicon('Crystal_Clear_action_edit_add.png'), "Add tab", self.menu_edit_on)
        self.action_add_tab.triggered.connect(self._tabwidget.new_tab)

        self.action_remove_tab = QtGui.QAction(
            qicon('Crystal_Clear_action_edit_remove.png'), "Remove tab", self.menu_edit_on)
        self.action_remove_tab.triggered.connect(self._tabwidget.remove_tab)

        self.action_push_to_shell = QtGui.QAction("DEBUG push applet to shell", self.menu_edit_on)
        self.action_push_to_shell.triggered.connect(self._push_applet_to_shell)
Esempio n. 7
0
    def __init__(self):
        QtGui.QTreeView.__init__(self)

        self._model = ProjectManagerModel()
        self.pm = ProjectManager()
        self.setModel(self._model)

        self._model.dataChanged.connect(self._on_model_changed)

        self.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
        self.connect(self, QtCore.SIGNAL('doubleClicked(const QModelIndex&)'),
                     self.open)

        self.setHeaderHidden(True)
        self.setDragEnabled(True)
        self.setDropIndicatorShown(True)
        self.setAcceptDrops(True)

        self._actions = []
        self._new_file_actions = {}
        self.paradigms_actions = []
        self.paradigms = {}

        self.actionEditMeta = QtGui.QAction(qicon("book.png"),
                                            "Edit Project Information", self)
        self.actionEditMeta.triggered.connect(self.edit_metadata)

        self.actionImportFile = QtGui.QAction(qicon("open.png"), "Import file",
                                              self)
        self.actionImportFile.triggered.connect(self.import_file)

        self.actionSaveProjAs = QtGui.QAction(qicon("save.png"), "Save As",
                                              self)
        self.actionSaveProjAs.triggered.connect(self.save_as)

        self.actionSaveProj = QtGui.QAction(qicon("save.png"), "Save project",
                                            self)
        self.actionSaveProj.triggered.connect(self.save)
        self.actionSaveProj.setShortcut(
            QtGui.QApplication.translate("MainWindow", "Ctrl+Shift+S", None,
                                         QtGui.QApplication.UnicodeUTF8))

        self.actionCloseProj = QtGui.QAction(qicon("closeButton.png"),
                                             "Close project", self)
        self.actionCloseProj.triggered.connect(self.close)
        self.actionCloseProj.setShortcut(self.tr("Ctrl+Shift+W"))

        self.actionNewProj = QtGui.QAction(qicon("new.png"), "New Project",
                                           self)
        self.actionNewProj.triggered.connect(self.new_project)
        self.actionNewProj.setShortcut(self.tr("Ctrl+Shift+N"))

        self.actionOpenProj = QtGui.QAction(qicon("open.png"), "Open Project",
                                            self)
        self.actionOpenProj.triggered.connect(self.open_project)
        self.actionOpenProj.setShortcut(self.tr('Ctrl+Shift+O'))
Esempio n. 8
0
    def __init__(self):
        QtGui.QTreeView.__init__(self)

        self._model = ProjectManagerModel()
        self.pm = ProjectManager()
        self.setModel(self._model)

        self._model.dataChanged.connect(self._on_model_changed)

        self.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
        self.connect(self, QtCore.SIGNAL('doubleClicked(const QModelIndex&)'), self.open)

        self.setHeaderHidden(True)
        self.setDragEnabled(True)
        self.setDropIndicatorShown(True)
        self.setAcceptDrops(True)

        self._actions = []
        self._new_file_actions = {}
        self.paradigms_actions = []
        self.paradigms = {}

        self.actionEditMeta = QtGui.QAction(qicon("book.png"), "Edit Project Information", self)
        self.actionEditMeta.triggered.connect(self.edit_metadata)

        self.actionImportFile = QtGui.QAction(qicon("open.png"), "Import file", self)
        self.actionImportFile.triggered.connect(self.import_file)

        self.actionSaveProjAs = QtGui.QAction(qicon("save.png"), "Save As", self)
        self.actionSaveProjAs.triggered.connect(self.save_as)

        self.actionSaveProj = QtGui.QAction(qicon("save.png"), "Save project", self)
        self.actionSaveProj.triggered.connect(self.save)
        self.actionSaveProj.setShortcut(
            QtGui.QApplication.translate("MainWindow", "Ctrl+Shift+S", None, QtGui.QApplication.UnicodeUTF8))

        self.actionCloseProj = QtGui.QAction(qicon("closeButton.png"), "Close project", self)
        self.actionCloseProj.triggered.connect(self.close)
        self.actionCloseProj.setShortcut(self.tr("Ctrl+Shift+W"))

        self.actionNewProj = QtGui.QAction(qicon("new.png"), "New Project", self)
        self.actionNewProj.triggered.connect(self.new_project)
        self.actionNewProj.setShortcut(self.tr("Ctrl+Shift+N"))

        self.actionOpenProj = QtGui.QAction(qicon("open.png"), "Open Project", self)
        self.actionOpenProj.triggered.connect(self.open_project)
        self.actionOpenProj.setShortcut(self.tr('Ctrl+Shift+O'))
Esempio n. 9
0
    def create_menu(self):
        menu = QtGui.QMenu(self)
        project, category, obj = self.selected_data()

        if category == 'category' and obj == 'model':
            self.add_new_file_actions(menu)

        elif category == 'category' and obj == 'data':
            import_data = QtGui.QAction(qicon('import.png'), 'Import data',
                                        self)
            import_data.triggered.connect(self.open)
            menu.addAction(import_data)

        elif category == 'category' and obj in ('startup', 'doc', 'lib'):
            new_startup = QtGui.QAction(qicon('filenew.png'), 'New file', self)
            new_startup.triggered.connect(self.new_file)
            menu.addAction(new_startup)

        if category == 'model':
            self.add_new_file_actions(menu)

        if category in ['model', 'src', 'startup', 'doc', 'data', 'lib']:
            editAction = QtGui.QAction(qicon('open.png'), 'Open "%s"' % obj,
                                       self)
            menu.addAction(editAction)
            editAction.triggered.connect(self.open)

            rename = QtGui.QAction(qicon('Crystal_Clear_action_editcopy.png'),
                                   'Rename', self)
            rename.triggered.connect(self.rename)
            menu.addAction(rename)

            remove = QtGui.QAction(
                qicon('Crystal_Clear_action_edit_remove.png'), 'Remove', self)
            remove.triggered.connect(self.remove)
            menu.addAction(remove)

            menu.addSeparator()

            deleteAction = QtGui.QAction(
                qicon('Crystal_Clear_action_stop.png'), 'Delete', self)
            menu.addAction(deleteAction)
            deleteAction.triggered.connect(self.delete)

        if category in ['project']:
            menu.addAction(self.actionEditMeta)
            menu.addAction(self.actionSaveProj)
            menu.addAction(self.actionSaveProjAs)
            menu.addAction(self.actionCloseProj)

        return menu
Esempio n. 10
0
    def create_menu(self):
        menu = QtGui.QMenu(self)
        project, category, obj = self.selected_data()

        if category == 'category' and obj == 'model':
            self.add_new_file_actions(menu)

        elif category == 'category' and obj == 'data':
            import_data = QtGui.QAction(qicon('import.png'), 'Import data', self)
            import_data.triggered.connect(self.open)
            menu.addAction(import_data)

        elif category == 'category' and obj in ('startup', 'doc', 'lib'):
            new_startup = QtGui.QAction(qicon('filenew.png'), 'New file', self)
            new_startup.triggered.connect(self.new_file)
            menu.addAction(new_startup)

        if category == 'model':
            self.add_new_file_actions(menu)

        if category in ['model', 'src', 'startup', 'doc', 'data', 'lib']:
            editAction = QtGui.QAction(qicon('open.png'), 'Open "%s"' % obj, self)
            menu.addAction(editAction)
            editAction.triggered.connect(self.open)

            rename = QtGui.QAction(qicon('Crystal_Clear_action_editcopy.png'), 'Rename', self)
            rename.triggered.connect(self.rename)
            menu.addAction(rename)

            remove = QtGui.QAction(qicon('Crystal_Clear_action_edit_remove.png'), 'Remove', self)
            remove.triggered.connect(self.remove)
            menu.addAction(remove)

            menu.addSeparator()

            deleteAction = QtGui.QAction(qicon('Crystal_Clear_action_stop.png'), 'Delete', self)
            menu.addAction(deleteAction)
            deleteAction.triggered.connect(self.delete)

        if category in ['project']:
            menu.addAction(self.actionEditMeta)
            menu.addAction(self.actionSaveProj)
            menu.addAction(self.actionSaveProjAs)
            menu.addAction(self.actionCloseProj)

        return menu
Esempio n. 11
0
    def __init__(self, parent=None):
        super(ParadigmContainer, self).__init__(parent=parent)

        self.setTabsClosable(True)

        self.applets = []
        self._open_tabs = {}
        self.paradigms = {}
        self._new_file_actions = {}
        self.paradigms_actions = []
        for plugin_class in plugins('oalab.paradigm_applet'):
            plugin = plugin_class()
            paradigm_applet = debug_plugin('oalab.paradigm_applet', func=plugin)
            if paradigm_applet:
                self.paradigms[plugin_class.name] = paradigm_applet

        self._open_objects = {}

        self.projectManager = ProjectManager()

        self.setAccessibleName("Container")
        self.setElideMode(QtCore.Qt.ElideLeft)

        self.actionNewFile = QtGui.QAction(qicon("new.png"), "New file", self)
        self.actionOpenFile = QtGui.QAction(qicon("open.png"), "Open file", self)
        self.actionSave = QtGui.QAction(qicon("save.png"), "Save File", self)
        self.actionSaveAs = QtGui.QAction(qicon("save.png"), "Save As", self)
        self.actionRun = QtGui.QAction(qicon("run.png"), "Run", self)
        self.actionAnimate = QtGui.QAction(qicon("play.png"), "Animate", self)
        self.actionStep = QtGui.QAction(qicon("step.png"), "Step", self)
        self.actionStop = QtGui.QAction(qicon("pause.png"), "Stop", self)
        self.actionInit = QtGui.QAction(qicon("rewind.png"), "Init", self)
        self.actionCloseCurrent = QtGui.QAction(qicon("closeButton.png"), "Close current tab", self)

        self.actionRunSelection = QtGui.QAction(qicon("run.png"), "Run subpart", self)

        self.actionUndo = QtGui.QAction(qicon("editundo.png"), "Undo", self)
        self.actionRedo = QtGui.QAction(qicon("editredo.png"), "Redo", self)
        self.actionSearch = QtGui.QAction(qicon("editfind.png"), "Search", self)

        self.actionComment = QtGui.QAction(qicon("commentOn.png"), "Comment", self)
        self.actionUnComment = QtGui.QAction(qicon("commentOff.png"), "Uncomment", self)
        self.actionGoto = QtGui.QAction(qicon("next-green.png"), "Go To", self)

        self.actionNewFile.setShortcut(self.tr("Ctrl+N"))
        self.actionOpenFile.setShortcut(
            QtGui.QApplication.translate("MainWindow", "Ctrl+O", None, QtGui.QApplication.UnicodeUTF8))

        self.actionRunSelection.setShortcut(
            QtGui.QApplication.translate("MainWindow", "Ctrl+E", None, QtGui.QApplication.UnicodeUTF8))

        self.actionCloseCurrent.setShortcut(
            QtGui.QApplication.translate("MainWindow", "Ctrl+W", None, QtGui.QApplication.UnicodeUTF8))
        self.actionSearch.setShortcut(
            QtGui.QApplication.translate("MainWindow", "Ctrl+F", None, QtGui.QApplication.UnicodeUTF8))
        self.actionGoto.setShortcut(
            QtGui.QApplication.translate("MainWindow", "Ctrl+G", None, QtGui.QApplication.UnicodeUTF8))
        self.actionSave.setShortcut(
            QtGui.QApplication.translate("MainWindow", "Ctrl+S", None, QtGui.QApplication.UnicodeUTF8))
        # self.actionRun.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+R", None, QtGui.QApplication.UnicodeUTF8))
        self.actionRun.setShortcuts([QtGui.QApplication.translate("MainWindow", "F1", None, QtGui.QApplication.UnicodeUTF8), QtGui.QApplication.translate(
            "MainWindow", "Ctrl+R", None, QtGui.QApplication.UnicodeUTF8)])
        self.actionAnimate.setShortcut(
            QtGui.QApplication.translate("MainWindow", "F2", None, QtGui.QApplication.UnicodeUTF8))
        self.actionStep.setShortcut(
            QtGui.QApplication.translate("MainWindow", "F3", None, QtGui.QApplication.UnicodeUTF8))
        self.actionStop.setShortcut(
            QtGui.QApplication.translate("MainWindow", "F4", None, QtGui.QApplication.UnicodeUTF8))
        self.actionInit.setShortcut(
            QtGui.QApplication.translate("MainWindow", "F5", None, QtGui.QApplication.UnicodeUTF8))

        self.actionNewFile.triggered.connect(self.new_file)
        self.actionOpenFile.triggered.connect(self.open)
        self.actionSave.triggered.connect(self.save_current)
#         self.actionSaveAs.triggered.connect(self.save_as)
        self.actionRun.triggered.connect(self.run)
        self.actionAnimate.triggered.connect(self.animate)
        self.actionStep.triggered.connect(self.step)
        self.actionStop.triggered.connect(self.stop)
        self.actionInit.triggered.connect(self.init)
        self.actionCloseCurrent.triggered.connect(self.close_current)

        self.actionRunSelection.triggered.connect(self.execute)

        self.actionUndo.triggered.connect(self.undo)
        self.actionRedo.triggered.connect(self.redo)
        self.actionSearch.triggered.connect(self.search)
        self.actionGoto.triggered.connect(self.goto)
        self.actionComment.triggered.connect(self.comment)
        self.actionUnComment.triggered.connect(self.uncomment)

        self.actionAddFile = QtGui.QAction(qicon("bool.png"), "Add to Project", self)
        self.actionAddFile.triggered.connect(self.add_current_file)

        self.actionStop.setEnabled(False)

        self._run_actions = [
            self.actionAnimate,
            self.actionInit,
            self.actionRun,
            self.actionRunSelection,
            self.actionStep,
            self.actionStop,
        ]

        self._actions = [
            ["Project", "Manage", self.actionNewFile, 0],
            ["Project", "Manage", self.actionAddFile, 1],
            ["Project", "Manage", self.actionOpenFile, 1],
            ["Project", "Manage", self.actionSave, 1],
            ["Project", "Manage", self.actionCloseCurrent, 1],

            ["Project", "Play", self.actionRun, 0],
            ["Project", "Play", self.actionAnimate, 0],
            ["Project", "Play", self.actionStep, 0],
            ["Project", "Play", self.actionStop, 0],
            ["Project", "Play", self.actionInit, 0],

            ["Edit", "Text Edit", self.actionUndo, 0],
            ["Edit", "Text Edit", self.actionRedo, 0],
            ["Edit", "Text Edit", self.actionSearch, 0],
            ["Edit", "Text Edit", self.actionGoto, 0],
            ["Edit", "Text Edit", self.actionComment, 0],
            ["Edit", "Text Edit", self.actionUnComment, 0],
            ["Edit", "Text Edit", self.actionRunSelection, 0],
        ]

        self.connect_paradigm_container()
        self.extensions = ""
        self.connect(self, QtCore.SIGNAL('tabCloseRequested(int)'), self.autoClose)
        self.connect(self, QtCore.SIGNAL('currentChanged(int)'), self.safe_display_help)
        self.currentChanged.connect(self.on_current_tab_changed)

        self.addDefaultTab()
        self.fine_tune()
Esempio n. 12
0
    def __init__(self, parent=None):
        super(ParadigmContainer, self).__init__(parent=parent)

        self.setTabsClosable(True)

        self.applets = []
        self._open_tabs = {}
        self.paradigms = {}
        self._new_file_actions = {}
        self.paradigms_actions = []
        for plugin_class in plugins('oalab.paradigm_applet'):
            plugin = plugin_class()
            paradigm_applet = debug_plugin('oalab.paradigm_applet',
                                           func=plugin)
            if paradigm_applet:
                self.paradigms[plugin_class.name] = paradigm_applet

        self._open_objects = {}

        self.projectManager = ProjectManager()

        self.setAccessibleName("Container")
        self.setElideMode(QtCore.Qt.ElideLeft)

        self.actionNewFile = QtGui.QAction(qicon("new.png"), "New file", self)
        self.actionOpenFile = QtGui.QAction(qicon("open.png"), "Open file",
                                            self)
        self.actionSave = QtGui.QAction(qicon("save.png"), "Save File", self)
        self.actionSaveAs = QtGui.QAction(qicon("save.png"), "Save As", self)
        self.actionRun = QtGui.QAction(qicon("run.png"), "Run", self)
        self.actionAnimate = QtGui.QAction(qicon("play.png"), "Animate", self)
        self.actionStep = QtGui.QAction(qicon("step.png"), "Step", self)
        self.actionStop = QtGui.QAction(qicon("pause.png"), "Stop", self)
        self.actionInit = QtGui.QAction(qicon("rewind.png"), "Init", self)
        self.actionCloseCurrent = QtGui.QAction(qicon("closeButton.png"),
                                                "Close current tab", self)

        self.actionRunSelection = QtGui.QAction(qicon("run.png"),
                                                "Run subpart", self)

        self.actionUndo = QtGui.QAction(qicon("editundo.png"), "Undo", self)
        self.actionRedo = QtGui.QAction(qicon("editredo.png"), "Redo", self)
        self.actionSearch = QtGui.QAction(qicon("editfind.png"), "Search",
                                          self)

        self.actionComment = QtGui.QAction(qicon("commentOn.png"), "Comment",
                                           self)
        self.actionUnComment = QtGui.QAction(qicon("commentOff.png"),
                                             "Uncomment", self)
        self.actionGoto = QtGui.QAction(qicon("next-green.png"), "Go To", self)

        self.actionNewFile.setShortcut(self.tr("Ctrl+N"))
        self.actionOpenFile.setShortcut(
            QtGui.QApplication.translate("MainWindow", "Ctrl+O", None,
                                         QtGui.QApplication.UnicodeUTF8))

        self.actionRunSelection.setShortcut(
            QtGui.QApplication.translate("MainWindow", "Ctrl+E", None,
                                         QtGui.QApplication.UnicodeUTF8))

        self.actionCloseCurrent.setShortcut(
            QtGui.QApplication.translate("MainWindow", "Ctrl+W", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.actionSearch.setShortcut(
            QtGui.QApplication.translate("MainWindow", "Ctrl+F", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.actionGoto.setShortcut(
            QtGui.QApplication.translate("MainWindow", "Ctrl+G", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.actionSave.setShortcut(
            QtGui.QApplication.translate("MainWindow", "Ctrl+S", None,
                                         QtGui.QApplication.UnicodeUTF8))
        # self.actionRun.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+R", None, QtGui.QApplication.UnicodeUTF8))
        self.actionRun.setShortcuts([
            QtGui.QApplication.translate("MainWindow", "F1", None,
                                         QtGui.QApplication.UnicodeUTF8),
            QtGui.QApplication.translate("MainWindow", "Ctrl+R", None,
                                         QtGui.QApplication.UnicodeUTF8)
        ])
        self.actionAnimate.setShortcut(
            QtGui.QApplication.translate("MainWindow", "F2", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.actionStep.setShortcut(
            QtGui.QApplication.translate("MainWindow", "F3", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.actionStop.setShortcut(
            QtGui.QApplication.translate("MainWindow", "F4", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.actionInit.setShortcut(
            QtGui.QApplication.translate("MainWindow", "F5", None,
                                         QtGui.QApplication.UnicodeUTF8))

        self.actionNewFile.triggered.connect(self.new_file)
        self.actionOpenFile.triggered.connect(self.open)
        self.actionSave.triggered.connect(self.save_current)
        #         self.actionSaveAs.triggered.connect(self.save_as)
        self.actionRun.triggered.connect(self.run)
        self.actionAnimate.triggered.connect(self.animate)
        self.actionStep.triggered.connect(self.step)
        self.actionStop.triggered.connect(self.stop)
        self.actionInit.triggered.connect(self.init)
        self.actionCloseCurrent.triggered.connect(self.close_current)

        self.actionRunSelection.triggered.connect(self.execute)

        self.actionUndo.triggered.connect(self.undo)
        self.actionRedo.triggered.connect(self.redo)
        self.actionSearch.triggered.connect(self.search)
        self.actionGoto.triggered.connect(self.goto)
        self.actionComment.triggered.connect(self.comment)
        self.actionUnComment.triggered.connect(self.uncomment)

        self.actionAddFile = QtGui.QAction(qicon("bool.png"), "Add to Project",
                                           self)
        self.actionAddFile.triggered.connect(self.add_current_file)

        self.actionStop.setEnabled(False)

        self._run_actions = [
            self.actionAnimate,
            self.actionInit,
            self.actionRun,
            self.actionRunSelection,
            self.actionStep,
            self.actionStop,
        ]

        self._actions = [
            ["Project", "Manage", self.actionNewFile, 0],
            ["Project", "Manage", self.actionAddFile, 1],
            ["Project", "Manage", self.actionOpenFile, 1],
            ["Project", "Manage", self.actionSave, 1],
            ["Project", "Manage", self.actionCloseCurrent, 1],
            ["Project", "Play", self.actionRun, 0],
            ["Project", "Play", self.actionAnimate, 0],
            ["Project", "Play", self.actionStep, 0],
            ["Project", "Play", self.actionStop, 0],
            ["Project", "Play", self.actionInit, 0],
            ["Edit", "Text Edit", self.actionUndo, 0],
            ["Edit", "Text Edit", self.actionRedo, 0],
            ["Edit", "Text Edit", self.actionSearch, 0],
            ["Edit", "Text Edit", self.actionGoto, 0],
            ["Edit", "Text Edit", self.actionComment, 0],
            ["Edit", "Text Edit", self.actionUnComment, 0],
            ["Edit", "Text Edit", self.actionRunSelection, 0],
        ]

        self.connect_paradigm_container()
        self.extensions = ""
        self.connect(self, QtCore.SIGNAL('tabCloseRequested(int)'),
                     self.autoClose)
        self.connect(self, QtCore.SIGNAL('currentChanged(int)'),
                     self.safe_display_help)
        self.currentChanged.connect(self.on_current_tab_changed)

        self.addDefaultTab()
        self.fine_tune()
Esempio n. 13
0
 def _create_actions(self):
     self._action_go_to_parent = QtGui.QAction(qicon('oxygen_go-up.png'), 'Parent dir', self)
     self._action_go_to_parent.triggered.connect(self.go_to_parent)