Beispiel #1
0
    def reset_workspace(self):
        self.build_output = ConsoleOutput()
        self.build_output.show()

        class thc(QtCore.QThread):
            def __init__(self, workspace):
                self.workspace = workspace
                super(thc, self).__init__()

            def run(self):
                print "running..."
                self.workspace.reset()

        self.th = thc(self.workspace)
        self.th.start()
Beispiel #2
0
 def reset_workspace(self):
     self.build_output = ConsoleOutput()
     self.build_output.show()
     class thc(QtCore.QThread):
         def __init__(self, workspace):
             self.workspace = workspace
             super(thc, self).__init__()
         def run(self):
             print "running..."
             self.workspace.reset()
     self.th = thc(self.workspace)
     self.th.start()
Beispiel #3
0
 def on_run_click(self):
     root_url = os.path.dirname(self.config_path)
     if os.name != 'posix':
         root_url = '/' + root_url
     if self.build_output:
         self.build_output.close()
     self.build_output = ConsoleOutput()
     self.build_output.show()
     config_loader = FileConfigLoader(self.config_path)
     builder = AppConfigurator(config_loader,
                               ZmqChainedLoger(1234),
                               verbose=self.verbose)
     builder.set_execution_dir(self.working_dir)
     builder.include_bundles(self.get_included_bundles())
     self.set_message_receiver()
     if self.debug:
         builder.apply()
     else:
         self.worker = ConfigRunnerThread(builder)
         self.worker.start()
         self.worker.finished.connect(self.on_worker_finished)
Beispiel #4
0
 def on_run_click(self):
   root_url = os.path.dirname(self.config_path)
   if os.name!='posix':
     root_url = '/'+root_url
   if self.build_output:
     self.build_output.close()
   self.build_output = ConsoleOutput()
   self.build_output.show()
   config_loader = FileConfigLoader(self.config_path)
   builder = AppConfigurator(config_loader, ZmqChainedLoger(1234))
   builder.set_execution_dir(self.working_dir)
   builder.include_bundles(self.get_included_bundles())
   self.set_message_receiver()
   #builder.apply()
   self.worker = ConfigRunnerThread(builder)
   self.worker.start()
   self.worker.finished.connect(self.on_worker_finished)
Beispiel #5
0
class ConfigWindow(QtGui.QMainWindow, Ui_ConfigWindow):
    def __init__(self, main_window, *args, **kwargs):
        super(ConfigWindow, self).__init__(*args, **kwargs)
        self.viewMode = 'admin'
        self.debug = False
        self.verbose = app_config.is_verbose()
        self.config_path = None
        self.working_dir = None
        self.main_window = main_window or self
        self.working_dir_choser = None
        self.messages_thread = None
        self.cw = None
        self.bundlesModel = QtGui.QStandardItemModel()
        self.set_plugins()
        self.setupUi()
        self.set_message_receiver()
        self.start_last_if_any()
    
    def set_plugins(self):
        self.plugins =[]
        for d in config.plugin_dirs:
            self.plugins.extend(get_plugins(d))

    def setupUi(self):
        super(ConfigWindow, self).setupUi(self)
        title="Configurator Version:%s"%(app_config.get_version())
        self.setWindowTitle(title)
        self.cbChooseWorkingDir.clicked.connect(self.chose_working_dir)
        self.set_menu_bar()
        self.set_recent_config_actions()
        self.tool = None
        self.workspace = app_config.get_current_workspace()
        if not self.workspace:
            self.switch_workspace()
        else:
            self.workspace.set_loger(ZmqChainedLoger(1234))
        self.viewMode = self.workspace.mode
        self.actionViewAsAdmin.setChecked(self.viewMode=='admin')
        self.actionViewAsModerator.setChecked(self.viewMode=='moderator')

    def bindUi(self):
        if self.viewMode != 'admin':
            self.tool = self.detailsContainer
        else:
            self.tool = None
        title = os.path.basename((os.path.dirname(os.path.dirname(self.config_path))))
        title +="         -- Configurator Version:%s" % (app_config.get_version())
        self.setWindowTitle(title)
        self.txtWorkingDir.setText(self.working_dir)

        if self.cw:
            self.ltv_content.removeWidget(self.cw)
            self.cw.close()
        self.cw = ConfigForm(self.loader, parent=self, details_parent = self.tool)
        #self.tool.setModel(ToolsListModel(self.plugins, False))
        self.menubar.setWindowTitle(title)
        self.build_output = None
        self.set_bundles_model()

        self.ltv_content.addWidget(self.cw)
        # if self.viewMode!='admin':
        #     self.cw.tlbx_bundles.hide()
        #     self.widget.hide()
        #     width = self.splitter_2.sizeHint().width()
        #     self.splitter_2.setSizes([width*0.3, width*0.7])
        # else:
        #     width = self.splitter_2.sizeHint().width()
        #     self.splitter_2.setSizes([width, 0])
            
    def start_last_if_any(self):
        try:
            config_history = app_config.get_config_history()
            if config_history:
                self.set_configuration(config_history[-1])
        except Exception as ex:
                print(ex)

    def set_configuration(self, config_path, working_dir=None):
        self.config_path = config_path
        if working_dir:
            self.working_dir = working_dir
        else:
            self.working_dir = app_config.get_working_dir()
        self.loader = FileConfigLoader(self.config_path)
        self.configuration = self.loader.load_config()
        self.bindUi()

    def set_bundles_model(self):
        self.bundlesModel.clear()
        work_mode = Workspace.current.mode
        bundle_filter = ConfigBuildFilter(included=Workspace.registered_bundles)
        d = self.get_mode_config_for_key(work_mode, 'bundles')
        bundle_filter.extend_from_dict(d)
        for bundle in self.configuration['Content']['OperationBundles']:
            dataItem = QtGui.QStandardItem(bundle['Name'])
            dataItem.setCheckable(True)
            check_state = bundle_filter.allowed(bundle['Name']) and QtCore.Qt.CheckState.Checked or QtCore.Qt.CheckState.Unchecked
            dataItem.setCheckState(check_state)
            self.bundlesModel.appendRow(dataItem)
    
    def get_mode_config_for_key(self, work_mode, key):
        if self.configuration.has_key('Builds'):
            if self.configuration['Builds'].has_key(work_mode):
                bc = self.configuration['Builds'][work_mode]
                if bc.has_key(key):
                    return copy.deepcopy(bc[key])
        return {}

    def get_included_bundles(self):
        i = 0
        includedBundles = []
        while self.bundlesModel.item(i):
            dataItem = self.bundlesModel.item(i)
            if dataItem.checkState():
                includedBundles.append(dataItem.text())
            i += 1
        return includedBundles
            
    def chose_working_dir(self):
        """
        Choses the current working directory for the current configuration
        """
        res = QtGui.QFileDialog.getExistingDirectory(caption="Choose working directory")
        if res:
            app_config.set_working_dir(res)
            self.working_dir = res
            self.txtWorkingDir.setText(res)


    def show_bundle_selector(self):
        self.bundleSelectorWidget = BundleSelector(self.bundlesModel)
        self.bundleSelectorWidget.show()


    def validate_configuration(self):
        validator = ConfigurationValidator(self.config_path)
        result = validator.validate(self.configuration)
        title = result.is_valid and 'Valid Configuration' or 'Invalid Configurration'
        message = 'Errors:\n'+'\n'.join(['\t'+x for x in result.errors])
        message+= '\nWarnings:\n'+'\n'.join(['\t'+x for x in result.warnings])
        message+= '\nSuggestions:\n'+'\n'.join(['\t'+x for x in result.suggestions])
        msgBox = QtGui.QMessageBox()
        msgBox.setText(title)
        msgBox.setInformativeText(message)
        msgBox.exec_()

    def open_regex_tool(self):
        self.rtool = RegexTool()
        self.rtool.show()


    def sync_workspace(self):
        self.build_output = ConsoleOutput()
        self.build_output.show()
        class thc(QtCore.QThread):
            def __init__(self, workspace):
                self.workspace = workspace
                super(thc, self).__init__()
            def run(self):
                print "running..."
                self.workspace.sync()
        self.th = thc(self.workspace)
        self.th.start()

    def switch_workspace(self, custom_title = None):
        self.workspacedialog = QtGui.QFileDialog(None, custom_title or 'Choose your Workspace!')
        self.workspacedialog.setFileMode(QtGui.QFileDialog.Directory)
        self.workspacedialog.setOption(QtGui.QFileDialog.ShowDirsOnly)
        res = self.workspacedialog.exec_()
        if res:
            dirpath = self.workspacedialog.selectedFiles()[0]
            app_config.set_current_workspace(dirpath)
        while not app_config.get_current_workspace():
            self.switch_workspace('You must choose a valid workspace in order to open the app')
        self.workspace = app_config.get_current_workspace()
        self.workspace.set_loger(ZmqChainedLoger(1234))
        self.workspacedialog.close()

    def reset_workspace(self):
        self.build_output = ConsoleOutput()
        self.build_output.show()
        class thc(QtCore.QThread):
            def __init__(self, workspace):
                self.workspace = workspace
                super(thc, self).__init__()
            def run(self):
                print "running..."
                self.workspace.reset()
        self.th = thc(self.workspace)
        self.th.start()

    def setViewMode(self, modeUsed=None):
        newViewMode = None
        if modeUsed=='moderator':
            self.actionViewAsAdmin.setChecked(not self.actionViewAsModerator.isChecked())
            newViewMode = self.actionViewAsModerator.isChecked() and 'moderator' or 'admin'
        else:
            self.actionViewAsModerator.setChecked(not self.actionViewAsAdmin.isChecked())
            newViewMode = self.actionViewAsAdmin.isChecked() and 'admin' or 'moderator'

        if newViewMode !=self.viewMode and self.config_path:
            self.viewMode = newViewMode
            self.workspace.mode = newViewMode
            self.set_configuration(self.config_path, self.working_dir)

    def set_menu_bar(self):
        def save(is_new, is_cloning_empty):
            def fn ():
                if self.cw:
                    self.cw.save_config(is_new, is_cloning_empty)
            return fn
        def viewModeSetter(mode):
            def fn ():
                return self.setViewMode(mode)
            return fn
        self.actionRun.triggered.connect(self.on_run_click)
        self.actionClose.triggered.connect(self.close)
        self.actionOpen.triggered.connect(self.open_config)
        self.actionNew.triggered.connect(self.create_new_config)
        self.actionEnable_Disable_Bundles.triggered.connect(self.show_bundle_selector)
        self.actionVallidate.triggered.connect(self.validate_configuration)
        self.actionRegex.triggered.connect(self.open_regex_tool)
        self.actionSync.triggered.connect(self.sync_workspace)
        self.actionSwitch_Workspace.triggered.connect(self.switch_workspace)
        self.actionReset.triggered.connect(self.reset_workspace)
        self.actionSave.triggered.connect(save(False, False))
        self.actionSave_As.triggered.connect(save(True, False))
        self.actionClone.triggered.connect(save(True, True))
        self.actionViewAsAdmin.triggered.connect(viewModeSetter('admin'))
        self.actionViewAsModerator.triggered.connect(viewModeSetter('moderator'))
        self.actionVerbose.triggered.connect(self.setVerbosity)
        self.actionVerbose.setChecked(app_config.is_verbose())
        self.actionDebug_2.triggered.connect(self.debugChanged)

    def debugChanged(self):
        self.debug = self.actionDebug.isChecked()

    def setVerbosity(self):
        app_config.set_verbose(self.actionVerbose.isChecked())
        self.verbose = self.actionVerbose.isChecked()

    def create_new_config(self):
        params = {"caption":"Choose Configuration","filter":"bc.halc"}
        if len(app_config.get_config_history())>0:
            last_config = app_config.get_config_history()[-1]
            last_config = last_config.replace("'", '')
            params["dir"] = os.path.dirname(last_config)
            
        f = QtGui.QFileDialog.getSaveFileName(**params)
        if f[0]:
            self.config_path = f[0]
            FileConfigLoader.new(self.config_path)
            app_config.add_config_to_history(self.config_path)
            self.set_configuration(self.config_path, self.working_dir)

    def set_recent_config_actions(self):
        history = app_config.get_config_history()
        history.reverse()
        self.historyActions = []
        for k in history:
            a = QtGui.QAction(self)
            a.triggered.connect(self.open_recent)
            a.setText(k)
            self.historyActions.append(a)
            self.menuRecent.addAction(a)

    def open_recent(self, *args, **kwargs):
        app_config.add_config_to_history(self.sender().text())
        self.set_configuration(self.sender().text(), self.working_dir)

    def open_config(self):
        cur_dir = None
        if app_config.get_config_history():
            cur_dir = app_config.get_config_history()[-1]

        params = {"caption":"Choose Configuration","filter":"Config Files(bc.json *.halc)"}
        if cur_dir:
            params["dir"] = app_config.get_config_history()[-1]
        f = QtGui.QFileDialog.getOpenFileName(**params)

        if f[0]:
            self.config_path = f[0]
            app_config.add_config_to_history(self.config_path)
            self.set_configuration(self.config_path, self.working_dir)

    def on_run_click(self):
        root_url = os.path.dirname(self.config_path)
        if os.name!='posix':
            root_url = '/'+root_url
        if self.build_output:
            self.build_output.close()
        self.build_output = ConsoleOutput()
        self.build_output.show()
        config_loader = FileConfigLoader(self.config_path)
        builder = AppConfigurator(config_loader, ZmqChainedLoger(1234), verbose=self.verbose)
        builder.set_execution_dir(self.working_dir)
        builder.include_bundles(self.get_included_bundles())
        self.set_message_receiver()
        if self.debug:
            builder.apply()
        else:
            self.worker = ConfigRunnerThread(builder)
            self.worker.start()
            self.worker.finished.connect(self.on_worker_finished)

    def on_worker_finished(self):
        self.worker.builder = None
        del self.worker

    def set_message_receiver(self):
        if not self.messages_thread:
            self.messages_thread = MessageSubsriberThread(1234)
            self.messages_thread.on_message_received.connect(self.on_message_received)
            self.messages_thread.start(QThread.TimeCriticalPriority)

    def on_message_received(self, message):
        if self.build_output:
            self.build_output.txt_output.append("%s" % message)

      
    @QtCore.Slot()
    def showOptionsMenu(self):
        self.prefs = PreferencesWidget()
        self.prefs.show()
Beispiel #6
0
    def setupUi(self, ConfigWindow):
        ConfigWindow.setObjectName("ConfigWindow")
        ConfigWindow.resize(1026, 697)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/buttons/images/HAL-9000-icon.png"),
                       QtGui.QIcon.Normal, QtGui.QIcon.Off)
        ConfigWindow.setWindowIcon(icon)
        ConfigWindow.setDockOptions(QtGui.QMainWindow.AllowTabbedDocks
                                    | QtGui.QMainWindow.AnimatedDocks)
        ConfigWindow.setUnifiedTitleAndToolBarOnMac(True)
        self.centralwidget = QtGui.QWidget(ConfigWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.verticalLayout_2 = QtGui.QVBoxLayout(self.centralwidget)
        self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.ltv_content = QtGui.QVBoxLayout()
        self.ltv_content.setSizeConstraint(QtGui.QLayout.SetMaximumSize)
        self.ltv_content.setObjectName("ltv_content")
        self.verticalLayout_2.addLayout(self.ltv_content)
        ConfigWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtGui.QMenuBar()
        self.menubar.setGeometry(QtCore.QRect(0, 0, 1026, 22))
        self.menubar.setObjectName("menubar")
        self.menuFile = QtGui.QMenu(self.menubar)
        self.menuFile.setObjectName("menuFile")
        self.menuRecent = QtGui.QMenu(self.menuFile)
        self.menuRecent.setObjectName("menuRecent")
        self.menuWorkspace = QtGui.QMenu(self.menuFile)
        self.menuWorkspace.setObjectName("menuWorkspace")
        self.menuEdit = QtGui.QMenu(self.menubar)
        self.menuEdit.setObjectName("menuEdit")
        self.menuHelp = QtGui.QMenu(self.menubar)
        self.menuHelp.setObjectName("menuHelp")
        self.menuRun = QtGui.QMenu(self.menubar)
        self.menuRun.setObjectName("menuRun")
        self.menuTools = QtGui.QMenu(self.menubar)
        self.menuTools.setObjectName("menuTools")
        self.menuView = QtGui.QMenu(self.menubar)
        self.menuView.setObjectName("menuView")
        ConfigWindow.setMenuBar(self.menubar)
        self.toolBar = QtGui.QToolBar(ConfigWindow)
        palette = QtGui.QPalette()
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText,
                         brush)
        brush = QtGui.QBrush(QtGui.QColor(218, 227, 237))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Light, brush)
        brush = QtGui.QBrush(QtGui.QColor(236, 241, 246))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Midlight, brush)
        brush = QtGui.QBrush(QtGui.QColor(109, 113, 118))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Dark, brush)
        brush = QtGui.QBrush(QtGui.QColor(145, 151, 158))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Mid, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.BrightText,
                         brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText,
                         brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush)
        brush = QtGui.QBrush(QtGui.QColor(218, 227, 237))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Shadow, brush)
        brush = QtGui.QBrush(QtGui.QColor(236, 241, 246))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.AlternateBase,
                         brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipBase,
                         brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipText,
                         brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText,
                         brush)
        brush = QtGui.QBrush(QtGui.QColor(218, 227, 237))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Button, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Light, brush)
        brush = QtGui.QBrush(QtGui.QColor(236, 241, 246))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Midlight,
                         brush)
        brush = QtGui.QBrush(QtGui.QColor(109, 113, 118))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Dark, brush)
        brush = QtGui.QBrush(QtGui.QColor(145, 151, 158))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Mid, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.BrightText,
                         brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText,
                         brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush)
        brush = QtGui.QBrush(QtGui.QColor(218, 227, 237))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Shadow, brush)
        brush = QtGui.QBrush(QtGui.QColor(236, 241, 246))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.AlternateBase,
                         brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipBase,
                         brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipText,
                         brush)
        brush = QtGui.QBrush(QtGui.QColor(109, 113, 118))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText,
                         brush)
        brush = QtGui.QBrush(QtGui.QColor(218, 227, 237))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Light, brush)
        brush = QtGui.QBrush(QtGui.QColor(236, 241, 246))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Midlight,
                         brush)
        brush = QtGui.QBrush(QtGui.QColor(109, 113, 118))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Dark, brush)
        brush = QtGui.QBrush(QtGui.QColor(145, 151, 158))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Mid, brush)
        brush = QtGui.QBrush(QtGui.QColor(109, 113, 118))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.BrightText,
                         brush)
        brush = QtGui.QBrush(QtGui.QColor(109, 113, 118))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText,
                         brush)
        brush = QtGui.QBrush(QtGui.QColor(218, 227, 237))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush)
        brush = QtGui.QBrush(QtGui.QColor(218, 227, 237))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Shadow, brush)
        brush = QtGui.QBrush(QtGui.QColor(218, 227, 237))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.AlternateBase,
                         brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipBase,
                         brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipText,
                         brush)
        self.toolBar.setPalette(palette)
        self.toolBar.setToolButtonStyle(QtCore.Qt.ToolButtonFollowStyle)
        self.toolBar.setObjectName("toolBar")
        ConfigWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar)
        self.dock_tools = QtGui.QDockWidget(ConfigWindow)
        self.dock_tools.setFloating(False)
        self.dock_tools.setObjectName("dock_tools")
        self.dockWidgetContents = QtGui.QWidget()
        self.dockWidgetContents.setObjectName("dockWidgetContents")
        self.gridLayout = QtGui.QGridLayout(self.dockWidgetContents)
        self.gridLayout.setObjectName("gridLayout")
        self.lv_tools = QtGui.QVBoxLayout()
        self.lv_tools.setSizeConstraint(QtGui.QLayout.SetMinimumSize)
        self.lv_tools.setObjectName("lv_tools")
        self.listWidget = PluginsList(self.dockWidgetContents)
        font = QtGui.QFont()
        font.setPointSize(14)
        self.listWidget.setFont(font)
        self.listWidget.setProperty("isWrapping", True)
        self.listWidget.setSpacing(5)
        self.listWidget.setViewMode(QtGui.QListView.IconMode)
        self.listWidget.setModelColumn(0)
        self.listWidget.setWordWrap(False)
        self.listWidget.setObjectName("listWidget")
        self.lv_tools.addWidget(self.listWidget)
        self.gridLayout.addLayout(self.lv_tools, 1, 0, 1, 1)
        self.txt_plugin_filter = QtGui.QLineEdit(self.dockWidgetContents)
        self.txt_plugin_filter.setObjectName("txt_plugin_filter")
        self.gridLayout.addWidget(self.txt_plugin_filter, 0, 0, 1, 1)
        self.dock_tools.setWidget(self.dockWidgetContents)
        ConfigWindow.addDockWidget(QtCore.Qt.DockWidgetArea(2),
                                   self.dock_tools)
        self.dock_working_dir = QtGui.QDockWidget(ConfigWindow)
        self.dock_working_dir.setObjectName("dock_working_dir")
        self.dockWidgetContents_2 = QtGui.QWidget()
        self.dockWidgetContents_2.setObjectName("dockWidgetContents_2")
        self.verticalLayout = QtGui.QVBoxLayout(self.dockWidgetContents_2)
        self.verticalLayout.setContentsMargins(5, 0, 0, 0)
        self.verticalLayout.setObjectName("verticalLayout")
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.txtWorkingDir = QtGui.QLineEdit(self.dockWidgetContents_2)
        self.txtWorkingDir.setEnabled(False)
        self.txtWorkingDir.setObjectName("txtWorkingDir")
        self.horizontalLayout.addWidget(self.txtWorkingDir)
        self.cbChooseWorkingDir = QtGui.QToolButton(self.dockWidgetContents_2)
        self.cbChooseWorkingDir.setObjectName("cbChooseWorkingDir")
        self.horizontalLayout.addWidget(self.cbChooseWorkingDir)
        self.cbStepThruBundles = QtGui.QCheckBox(self.dockWidgetContents_2)
        self.cbStepThruBundles.setEnabled(False)
        self.cbStepThruBundles.setMaximumSize(QtCore.QSize(0, 16777215))
        self.cbStepThruBundles.setStyleSheet("")
        self.cbStepThruBundles.setObjectName("cbStepThruBundles")
        self.horizontalLayout.addWidget(self.cbStepThruBundles)
        self.cbStepThruOps = QtGui.QCheckBox(self.dockWidgetContents_2)
        self.cbStepThruOps.setEnabled(False)
        self.cbStepThruOps.setMaximumSize(QtCore.QSize(0, 16777215))
        self.cbStepThruOps.setStyleSheet("")
        self.cbStepThruOps.setObjectName("cbStepThruOps")
        self.horizontalLayout.addWidget(self.cbStepThruOps)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.dock_working_dir.setWidget(self.dockWidgetContents_2)
        ConfigWindow.addDockWidget(QtCore.Qt.DockWidgetArea(4),
                                   self.dock_working_dir)
        self.dock_console = QtGui.QDockWidget(ConfigWindow)
        self.dock_console.setObjectName("dock_console")
        self.dockWidgetContents_3 = QtGui.QWidget()
        self.dockWidgetContents_3.setObjectName("dockWidgetContents_3")
        self.horizontalLayout_2 = QtGui.QHBoxLayout(self.dockWidgetContents_3)
        self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.widget = ConsoleOutput(self.dockWidgetContents_3)
        self.widget.setObjectName("widget")
        self.horizontalLayout_2.addWidget(self.widget)
        self.dock_console.setWidget(self.dockWidgetContents_3)
        ConfigWindow.addDockWidget(QtCore.Qt.DockWidgetArea(8),
                                   self.dock_console)
        self.dock_resources = QtGui.QDockWidget(ConfigWindow)
        self.dock_resources.setObjectName("dock_resources")
        self.resources_widget = ResourcesWidget()
        self.resources_widget.setObjectName("resources_widget")
        self.dock_resources.setWidget(self.resources_widget)
        ConfigWindow.addDockWidget(QtCore.Qt.DockWidgetArea(1),
                                   self.dock_resources)
        self.actionSave = QtGui.QAction(ConfigWindow)
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(":/buttons/images/save.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionSave.setIcon(icon1)
        self.actionSave.setObjectName("actionSave")
        self.actionRun = QtGui.QAction(ConfigWindow)
        icon2 = QtGui.QIcon()
        icon2.addPixmap(QtGui.QPixmap(":/buttons/images/debug.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionRun.setIcon(icon2)
        self.actionRun.setObjectName("actionRun")
        self.actionCopy_2 = QtGui.QAction(ConfigWindow)
        self.actionCopy_2.setObjectName("actionCopy_2")
        self.actionPaste = QtGui.QAction(ConfigWindow)
        self.actionPaste.setObjectName("actionPaste")
        self.actionAbout = QtGui.QAction(ConfigWindow)
        self.actionAbout.setObjectName("actionAbout")
        self.actionSave_As = QtGui.QAction(ConfigWindow)
        self.actionSave_As.setObjectName("actionSave_As")
        self.actionClose = QtGui.QAction(ConfigWindow)
        self.actionClose.setObjectName("actionClose")
        self.actionClone = QtGui.QAction(ConfigWindow)
        self.actionClone.setObjectName("actionClone")
        self.actionOpen = QtGui.QAction(ConfigWindow)
        self.actionOpen.setObjectName("actionOpen")
        self.actionNew = QtGui.QAction(ConfigWindow)
        self.actionNew.setObjectName("actionNew")
        self.actionEnable_Disable_Bundles = QtGui.QAction(ConfigWindow)
        icon3 = QtGui.QIcon()
        icon3.addPixmap(QtGui.QPixmap(":/buttons/images/select_bundles.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionEnable_Disable_Bundles.setIcon(icon3)
        self.actionEnable_Disable_Bundles.setObjectName(
            "actionEnable_Disable_Bundles")
        self.actionRun_2 = QtGui.QAction(ConfigWindow)
        self.actionRun_2.setObjectName("actionRun_2")
        self.actionDebug = QtGui.QAction(ConfigWindow)
        self.actionDebug.setEnabled(False)
        icon4 = QtGui.QIcon()
        icon4.addPixmap(QtGui.QPixmap(":/buttons/images/debug-bug.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionDebug.setIcon(icon4)
        self.actionDebug.setObjectName("actionDebug")
        self.actionPackage = QtGui.QAction(ConfigWindow)
        self.actionPackage.setEnabled(False)
        icon5 = QtGui.QIcon()
        icon5.addPixmap(QtGui.QPixmap(":/buttons/images/package.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionPackage.setIcon(icon5)
        self.actionPackage.setObjectName("actionPackage")
        self.actionSwitch_Workspace = QtGui.QAction(ConfigWindow)
        self.actionSwitch_Workspace.setObjectName("actionSwitch_Workspace")
        self.actionSync = QtGui.QAction(ConfigWindow)
        icon6 = QtGui.QIcon()
        icon6.addPixmap(QtGui.QPixmap(":/buttons/images/sync.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionSync.setIcon(icon6)
        self.actionSync.setObjectName("actionSync")
        self.actionReset = QtGui.QAction(ConfigWindow)
        icon7 = QtGui.QIcon()
        icon7.addPixmap(QtGui.QPixmap(":/buttons/images/reset.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionReset.setIcon(icon7)
        self.actionReset.setObjectName("actionReset")
        self.actionVallidate = QtGui.QAction(ConfigWindow)
        self.actionVallidate.setIcon(icon3)
        self.actionVallidate.setObjectName("actionVallidate")
        self.actionRegex = QtGui.QAction(ConfigWindow)
        self.actionRegex.setObjectName("actionRegex")
        self.actionViewAsModerator = QtGui.QAction(ConfigWindow)
        self.actionViewAsModerator.setCheckable(True)
        self.actionViewAsModerator.setEnabled(True)
        self.actionViewAsModerator.setObjectName("actionViewAsModerator")
        self.actionRemote_Build = QtGui.QAction(ConfigWindow)
        self.actionRemote_Build.setIcon(icon2)
        self.actionRemote_Build.setObjectName("actionRemote_Build")
        self.actionViewAsAdmin = QtGui.QAction(ConfigWindow)
        self.actionViewAsAdmin.setCheckable(True)
        self.actionViewAsAdmin.setObjectName("actionViewAsAdmin")
        self.actionAbout_Halicea = QtGui.QAction(ConfigWindow)
        self.actionAbout_Halicea.setObjectName("actionAbout_Halicea")
        self.actionVerbose = QtGui.QAction(ConfigWindow)
        self.actionVerbose.setCheckable(True)
        icon8 = QtGui.QIcon()
        icon8.addPixmap(QtGui.QPixmap(":/buttons/images/verbose.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionVerbose.setIcon(icon8)
        self.actionVerbose.setObjectName("actionVerbose")
        self.actionDebug_2 = QtGui.QAction(ConfigWindow)
        self.actionDebug_2.setCheckable(True)
        self.actionDebug_2.setIcon(icon4)
        self.actionDebug_2.setObjectName("actionDebug_2")
        self.actionOptions = QtGui.QAction(ConfigWindow)
        self.actionOptions.setIcon(icon3)
        self.actionOptions.setShortcutContext(QtCore.Qt.WindowShortcut)
        self.actionOptions.setObjectName("actionOptions")
        self.actionToggle_Toolbar = QtGui.QAction(ConfigWindow)
        self.actionToggle_Toolbar.setCheckable(True)
        self.actionToggle_Toolbar.setObjectName("actionToggle_Toolbar")
        self.menuWorkspace.addAction(self.actionSync)
        self.menuWorkspace.addAction(self.actionReset)
        self.menuWorkspace.addSeparator()
        self.menuWorkspace.addAction(self.actionSwitch_Workspace)
        self.menuFile.addAction(self.actionNew)
        self.menuFile.addAction(self.actionOpen)
        self.menuFile.addAction(self.menuRecent.menuAction())
        self.menuFile.addAction(self.actionSave)
        self.menuFile.addAction(self.actionSave_As)
        self.menuFile.addAction(self.actionClone)
        self.menuFile.addAction(self.menuWorkspace.menuAction())
        self.menuFile.addSeparator()
        self.menuFile.addAction(self.actionClose)
        self.menuEdit.addAction(self.actionCopy_2)
        self.menuEdit.addAction(self.actionPaste)
        self.menuHelp.addAction(self.actionAbout)
        self.menuRun.addAction(self.actionEnable_Disable_Bundles)
        self.menuRun.addAction(self.actionVallidate)
        self.menuRun.addSeparator()
        self.menuRun.addAction(self.actionRun)
        self.menuRun.addAction(self.actionRemote_Build)
        self.menuRun.addAction(self.actionDebug)
        self.menuRun.addAction(self.actionPackage)
        self.menuTools.addAction(self.actionRegex)
        self.menuTools.addAction(self.actionOptions)
        self.menuView.addAction(self.actionViewAsModerator)
        self.menuView.addAction(self.actionViewAsAdmin)
        self.menuView.addSeparator()
        self.menuView.addAction(self.actionVerbose)
        self.menuView.addAction(self.actionDebug_2)
        self.menuView.addSeparator()
        self.menuView.addAction(self.actionToggle_Toolbar)
        self.menubar.addAction(self.menuFile.menuAction())
        self.menubar.addAction(self.menuEdit.menuAction())
        self.menubar.addAction(self.menuRun.menuAction())
        self.menubar.addAction(self.menuView.menuAction())
        self.menubar.addAction(self.menuTools.menuAction())
        self.menubar.addAction(self.menuHelp.menuAction())
        self.toolBar.addAction(self.actionSave)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.actionRun)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.actionVallidate)
        self.toolBar.addAction(self.actionVerbose)

        self.retranslateUi(ConfigWindow)
        QtCore.QObject.connect(self.txt_plugin_filter,
                               QtCore.SIGNAL("textEdited(QString)"),
                               self.listWidget.filter)
        QtCore.QObject.connect(self.actionOptions,
                               QtCore.SIGNAL("triggered()"),
                               ConfigWindow.showOptionsMenu)
        QtCore.QObject.connect(self.actionToggle_Toolbar,
                               QtCore.SIGNAL("toggled(bool)"),
                               self.toolBar.setVisible)
        QtCore.QMetaObject.connectSlotsByName(ConfigWindow)
Beispiel #7
0
class ConfigWindow(QtGui.QMainWindow, Ui_ConfigWindow):
    def __init__(self, main_window, *args, **kwargs):
        super(ConfigWindow, self).__init__(*args, **kwargs)
        self.viewMode = 'admin'
        self.debug = False
        self.verbose = app_config.is_verbose()
        self.config_path = None
        self.working_dir = None
        self.main_window = main_window or self
        self.working_dir_choser = None
        self.messages_thread = None
        self.cw = None
        self.bundlesModel = QtGui.QStandardItemModel()
        self.set_plugins()
        self.setupUi()
        self.set_message_receiver()
        self.start_last_if_any()

    def set_plugins(self):
        self.plugins = []
        for d in config.plugin_dirs:
            self.plugins.extend(get_plugins(d))

    def setupUi(self):
        super(ConfigWindow, self).setupUi(self)
        title = "Configurator Version:%s" % (app_config.get_version())
        self.setWindowTitle(title)
        self.cbChooseWorkingDir.clicked.connect(self.chose_working_dir)
        self.set_menu_bar()
        self.set_recent_config_actions()
        self.tool = None
        self.workspace = app_config.get_current_workspace()
        if not self.workspace:
            self.switch_workspace()
        else:
            self.workspace.set_loger(ZmqChainedLoger(1234))
        self.viewMode = self.workspace.mode
        self.actionViewAsAdmin.setChecked(self.viewMode == 'admin')
        self.actionViewAsModerator.setChecked(self.viewMode == 'moderator')

    def bindUi(self):
        if self.viewMode != 'admin':
            self.tool = self.detailsContainer
        else:
            self.tool = None
        title = os.path.basename(
            (os.path.dirname(os.path.dirname(self.config_path))))
        title += "         -- Configurator Version:%s" % (
            app_config.get_version())
        self.setWindowTitle(title)
        self.txtWorkingDir.setText(self.working_dir)

        if self.cw:
            self.ltv_content.removeWidget(self.cw)
            self.cw.close()
        self.cw = ConfigForm(self.loader,
                             parent=self,
                             details_parent=self.tool)
        #self.tool.setModel(ToolsListModel(self.plugins, False))
        self.menubar.setWindowTitle(title)
        self.build_output = None
        self.set_bundles_model()

        self.ltv_content.addWidget(self.cw)
        # if self.viewMode!='admin':
        #     self.cw.tlbx_bundles.hide()
        #     self.widget.hide()
        #     width = self.splitter_2.sizeHint().width()
        #     self.splitter_2.setSizes([width*0.3, width*0.7])
        # else:
        #     width = self.splitter_2.sizeHint().width()
        #     self.splitter_2.setSizes([width, 0])

    def start_last_if_any(self):
        try:
            config_history = app_config.get_config_history()
            if config_history:
                self.set_configuration(config_history[-1])
        except Exception as ex:
            print(ex)

    def set_configuration(self, config_path, working_dir=None):
        self.config_path = config_path
        if working_dir:
            self.working_dir = working_dir
        else:
            self.working_dir = app_config.get_working_dir()
        self.loader = FileConfigLoader(self.config_path)
        self.configuration = self.loader.load_config()
        self.bindUi()

    def set_bundles_model(self):
        self.bundlesModel.clear()
        work_mode = Workspace.current.mode
        bundle_filter = ConfigBuildFilter(
            included=Workspace.registered_bundles)
        d = self.get_mode_config_for_key(work_mode, 'bundles')
        bundle_filter.extend_from_dict(d)
        for bundle in self.configuration['Content']['OperationBundles']:
            dataItem = QtGui.QStandardItem(bundle['Name'])
            dataItem.setCheckable(True)
            check_state = bundle_filter.allowed(
                bundle['Name']
            ) and QtCore.Qt.CheckState.Checked or QtCore.Qt.CheckState.Unchecked
            dataItem.setCheckState(check_state)
            self.bundlesModel.appendRow(dataItem)

    def get_mode_config_for_key(self, work_mode, key):
        if self.configuration.has_key('Builds'):
            if self.configuration['Builds'].has_key(work_mode):
                bc = self.configuration['Builds'][work_mode]
                if bc.has_key(key):
                    return copy.deepcopy(bc[key])
        return {}

    def get_included_bundles(self):
        i = 0
        includedBundles = []
        while self.bundlesModel.item(i):
            dataItem = self.bundlesModel.item(i)
            if dataItem.checkState():
                includedBundles.append(dataItem.text())
            i += 1
        return includedBundles

    def chose_working_dir(self):
        """
        Choses the current working directory for the current configuration
        """
        res = QtGui.QFileDialog.getExistingDirectory(
            caption="Choose working directory")
        if res:
            app_config.set_working_dir(res)
            self.working_dir = res
            self.txtWorkingDir.setText(res)

    def show_bundle_selector(self):
        self.bundleSelectorWidget = BundleSelector(self.bundlesModel)
        self.bundleSelectorWidget.show()

    def validate_configuration(self):
        validator = ConfigurationValidator(self.config_path)
        result = validator.validate(self.configuration)
        title = result.is_valid and 'Valid Configuration' or 'Invalid Configurration'
        message = 'Errors:\n' + '\n'.join(['\t' + x for x in result.errors])
        message += '\nWarnings:\n' + '\n'.join(
            ['\t' + x for x in result.warnings])
        message += '\nSuggestions:\n' + '\n'.join(
            ['\t' + x for x in result.suggestions])
        msgBox = QtGui.QMessageBox()
        msgBox.setText(title)
        msgBox.setInformativeText(message)
        msgBox.exec_()

    def open_regex_tool(self):
        self.rtool = RegexTool()
        self.rtool.show()

    def sync_workspace(self):
        self.build_output = ConsoleOutput()
        self.build_output.show()

        class thc(QtCore.QThread):
            def __init__(self, workspace):
                self.workspace = workspace
                super(thc, self).__init__()

            def run(self):
                print "running..."
                self.workspace.sync()

        self.th = thc(self.workspace)
        self.th.start()

    def switch_workspace(self, custom_title=None):
        self.workspacedialog = QtGui.QFileDialog(
            None, custom_title or 'Choose your Workspace!')
        self.workspacedialog.setFileMode(QtGui.QFileDialog.Directory)
        self.workspacedialog.setOption(QtGui.QFileDialog.ShowDirsOnly)
        res = self.workspacedialog.exec_()
        if res:
            dirpath = self.workspacedialog.selectedFiles()[0]
            app_config.set_current_workspace(dirpath)
        while not app_config.get_current_workspace():
            self.switch_workspace(
                'You must choose a valid workspace in order to open the app')
        self.workspace = app_config.get_current_workspace()
        self.workspace.set_loger(ZmqChainedLoger(1234))
        self.workspacedialog.close()

    def reset_workspace(self):
        self.build_output = ConsoleOutput()
        self.build_output.show()

        class thc(QtCore.QThread):
            def __init__(self, workspace):
                self.workspace = workspace
                super(thc, self).__init__()

            def run(self):
                print "running..."
                self.workspace.reset()

        self.th = thc(self.workspace)
        self.th.start()

    def setViewMode(self, modeUsed=None):
        newViewMode = None
        if modeUsed == 'moderator':
            self.actionViewAsAdmin.setChecked(
                not self.actionViewAsModerator.isChecked())
            newViewMode = self.actionViewAsModerator.isChecked(
            ) and 'moderator' or 'admin'
        else:
            self.actionViewAsModerator.setChecked(
                not self.actionViewAsAdmin.isChecked())
            newViewMode = self.actionViewAsAdmin.isChecked(
            ) and 'admin' or 'moderator'

        if newViewMode != self.viewMode and self.config_path:
            self.viewMode = newViewMode
            self.workspace.mode = newViewMode
            self.set_configuration(self.config_path, self.working_dir)

    def set_menu_bar(self):
        def save(is_new, is_cloning_empty):
            def fn():
                if self.cw:
                    self.cw.save_config(is_new, is_cloning_empty)

            return fn

        def viewModeSetter(mode):
            def fn():
                return self.setViewMode(mode)

            return fn

        self.actionRun.triggered.connect(self.on_run_click)
        self.actionClose.triggered.connect(self.close)
        self.actionOpen.triggered.connect(self.open_config)
        self.actionNew.triggered.connect(self.create_new_config)
        self.actionEnable_Disable_Bundles.triggered.connect(
            self.show_bundle_selector)
        self.actionVallidate.triggered.connect(self.validate_configuration)
        self.actionRegex.triggered.connect(self.open_regex_tool)
        self.actionSync.triggered.connect(self.sync_workspace)
        self.actionSwitch_Workspace.triggered.connect(self.switch_workspace)
        self.actionReset.triggered.connect(self.reset_workspace)
        self.actionSave.triggered.connect(save(False, False))
        self.actionSave_As.triggered.connect(save(True, False))
        self.actionClone.triggered.connect(save(True, True))
        self.actionViewAsAdmin.triggered.connect(viewModeSetter('admin'))
        self.actionViewAsModerator.triggered.connect(
            viewModeSetter('moderator'))
        self.actionVerbose.triggered.connect(self.setVerbosity)
        self.actionVerbose.setChecked(app_config.is_verbose())
        self.actionDebug_2.triggered.connect(self.debugChanged)

    def debugChanged(self):
        self.debug = self.actionDebug.isChecked()

    def setVerbosity(self):
        app_config.set_verbose(self.actionVerbose.isChecked())
        self.verbose = self.actionVerbose.isChecked()

    def create_new_config(self):
        params = {"caption": "Choose Configuration", "filter": "bc.halc"}
        if len(app_config.get_config_history()) > 0:
            last_config = app_config.get_config_history()[-1]
            last_config = last_config.replace("'", '')
            params["dir"] = os.path.dirname(last_config)

        f = QtGui.QFileDialog.getSaveFileName(**params)
        if f[0]:
            self.config_path = f[0]
            FileConfigLoader.new(self.config_path)
            app_config.add_config_to_history(self.config_path)
            self.set_configuration(self.config_path, self.working_dir)

    def set_recent_config_actions(self):
        history = app_config.get_config_history()
        history.reverse()
        self.historyActions = []
        for k in history:
            a = QtGui.QAction(self)
            a.triggered.connect(self.open_recent)
            a.setText(k)
            self.historyActions.append(a)
            self.menuRecent.addAction(a)

    def open_recent(self, *args, **kwargs):
        app_config.add_config_to_history(self.sender().text())
        self.set_configuration(self.sender().text(), self.working_dir)

    def open_config(self):
        cur_dir = None
        if app_config.get_config_history():
            cur_dir = app_config.get_config_history()[-1]

        params = {
            "caption": "Choose Configuration",
            "filter": "Config Files(bc.json *.halc)"
        }
        if cur_dir:
            params["dir"] = app_config.get_config_history()[-1]
        f = QtGui.QFileDialog.getOpenFileName(**params)

        if f[0]:
            self.config_path = f[0]
            app_config.add_config_to_history(self.config_path)
            self.set_configuration(self.config_path, self.working_dir)

    def on_run_click(self):
        root_url = os.path.dirname(self.config_path)
        if os.name != 'posix':
            root_url = '/' + root_url
        if self.build_output:
            self.build_output.close()
        self.build_output = ConsoleOutput()
        self.build_output.show()
        config_loader = FileConfigLoader(self.config_path)
        builder = AppConfigurator(config_loader,
                                  ZmqChainedLoger(1234),
                                  verbose=self.verbose)
        builder.set_execution_dir(self.working_dir)
        builder.include_bundles(self.get_included_bundles())
        self.set_message_receiver()
        if self.debug:
            builder.apply()
        else:
            self.worker = ConfigRunnerThread(builder)
            self.worker.start()
            self.worker.finished.connect(self.on_worker_finished)

    def on_worker_finished(self):
        self.worker.builder = None
        del self.worker

    def set_message_receiver(self):
        if not self.messages_thread:
            self.messages_thread = MessageSubsriberThread(1234)
            self.messages_thread.on_message_received.connect(
                self.on_message_received)
            self.messages_thread.start(QThread.TimeCriticalPriority)

    def on_message_received(self, message):
        if self.build_output:
            self.build_output.txt_output.append("%s" % message)

    @QtCore.Slot()
    def showOptionsMenu(self):
        self.prefs = PreferencesWidget()
        self.prefs.show()
Beispiel #8
0
    def setupUi(self, ConfigWindow):
        ConfigWindow.setObjectName("ConfigWindow")
        ConfigWindow.resize(1026, 697)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/buttons/images/HAL-9000-icon.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        ConfigWindow.setWindowIcon(icon)
        ConfigWindow.setDockOptions(QtGui.QMainWindow.AllowTabbedDocks|QtGui.QMainWindow.AnimatedDocks)
        ConfigWindow.setUnifiedTitleAndToolBarOnMac(True)
        self.centralwidget = QtGui.QWidget(ConfigWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.verticalLayout_2 = QtGui.QVBoxLayout(self.centralwidget)
        self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.ltv_content = QtGui.QVBoxLayout()
        self.ltv_content.setSizeConstraint(QtGui.QLayout.SetMaximumSize)
        self.ltv_content.setObjectName("ltv_content")
        self.verticalLayout_2.addLayout(self.ltv_content)
        ConfigWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtGui.QMenuBar()
        self.menubar.setGeometry(QtCore.QRect(0, 0, 1026, 22))
        self.menubar.setObjectName("menubar")
        self.menuFile = QtGui.QMenu(self.menubar)
        self.menuFile.setObjectName("menuFile")
        self.menuRecent = QtGui.QMenu(self.menuFile)
        self.menuRecent.setObjectName("menuRecent")
        self.menuWorkspace = QtGui.QMenu(self.menuFile)
        self.menuWorkspace.setObjectName("menuWorkspace")
        self.menuEdit = QtGui.QMenu(self.menubar)
        self.menuEdit.setObjectName("menuEdit")
        self.menuHelp = QtGui.QMenu(self.menubar)
        self.menuHelp.setObjectName("menuHelp")
        self.menuRun = QtGui.QMenu(self.menubar)
        self.menuRun.setObjectName("menuRun")
        self.menuTools = QtGui.QMenu(self.menubar)
        self.menuTools.setObjectName("menuTools")
        self.menuView = QtGui.QMenu(self.menubar)
        self.menuView.setObjectName("menuView")
        ConfigWindow.setMenuBar(self.menubar)
        self.toolBar = QtGui.QToolBar(ConfigWindow)
        palette = QtGui.QPalette()
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
        brush = QtGui.QBrush(QtGui.QColor(218, 227, 237))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Light, brush)
        brush = QtGui.QBrush(QtGui.QColor(236, 241, 246))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Midlight, brush)
        brush = QtGui.QBrush(QtGui.QColor(109, 113, 118))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Dark, brush)
        brush = QtGui.QBrush(QtGui.QColor(145, 151, 158))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Mid, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.BrightText, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush)
        brush = QtGui.QBrush(QtGui.QColor(218, 227, 237))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Shadow, brush)
        brush = QtGui.QBrush(QtGui.QColor(236, 241, 246))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.AlternateBase, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipBase, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipText, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
        brush = QtGui.QBrush(QtGui.QColor(218, 227, 237))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Button, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Light, brush)
        brush = QtGui.QBrush(QtGui.QColor(236, 241, 246))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Midlight, brush)
        brush = QtGui.QBrush(QtGui.QColor(109, 113, 118))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Dark, brush)
        brush = QtGui.QBrush(QtGui.QColor(145, 151, 158))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Mid, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.BrightText, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush)
        brush = QtGui.QBrush(QtGui.QColor(218, 227, 237))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Shadow, brush)
        brush = QtGui.QBrush(QtGui.QColor(236, 241, 246))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.AlternateBase, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipBase, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipText, brush)
        brush = QtGui.QBrush(QtGui.QColor(109, 113, 118))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
        brush = QtGui.QBrush(QtGui.QColor(218, 227, 237))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Light, brush)
        brush = QtGui.QBrush(QtGui.QColor(236, 241, 246))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Midlight, brush)
        brush = QtGui.QBrush(QtGui.QColor(109, 113, 118))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Dark, brush)
        brush = QtGui.QBrush(QtGui.QColor(145, 151, 158))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Mid, brush)
        brush = QtGui.QBrush(QtGui.QColor(109, 113, 118))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.BrightText, brush)
        brush = QtGui.QBrush(QtGui.QColor(109, 113, 118))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush)
        brush = QtGui.QBrush(QtGui.QColor(218, 227, 237))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush)
        brush = QtGui.QBrush(QtGui.QColor(218, 227, 237))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Shadow, brush)
        brush = QtGui.QBrush(QtGui.QColor(218, 227, 237))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.AlternateBase, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipBase, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipText, brush)
        self.toolBar.setPalette(palette)
        self.toolBar.setToolButtonStyle(QtCore.Qt.ToolButtonFollowStyle)
        self.toolBar.setObjectName("toolBar")
        ConfigWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar)
        self.dock_tools = QtGui.QDockWidget(ConfigWindow)
        self.dock_tools.setFloating(False)
        self.dock_tools.setObjectName("dock_tools")
        self.dockWidgetContents = QtGui.QWidget()
        self.dockWidgetContents.setObjectName("dockWidgetContents")
        self.gridLayout = QtGui.QGridLayout(self.dockWidgetContents)
        self.gridLayout.setObjectName("gridLayout")
        self.lv_tools = QtGui.QVBoxLayout()
        self.lv_tools.setSizeConstraint(QtGui.QLayout.SetMinimumSize)
        self.lv_tools.setObjectName("lv_tools")
        self.listWidget = PluginsList(self.dockWidgetContents)
        font = QtGui.QFont()
        font.setPointSize(14)
        self.listWidget.setFont(font)
        self.listWidget.setProperty("isWrapping", True)
        self.listWidget.setSpacing(5)
        self.listWidget.setViewMode(QtGui.QListView.IconMode)
        self.listWidget.setModelColumn(0)
        self.listWidget.setWordWrap(False)
        self.listWidget.setObjectName("listWidget")
        self.lv_tools.addWidget(self.listWidget)
        self.gridLayout.addLayout(self.lv_tools, 1, 0, 1, 1)
        self.txt_plugin_filter = QtGui.QLineEdit(self.dockWidgetContents)
        self.txt_plugin_filter.setObjectName("txt_plugin_filter")
        self.gridLayout.addWidget(self.txt_plugin_filter, 0, 0, 1, 1)
        self.dock_tools.setWidget(self.dockWidgetContents)
        ConfigWindow.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.dock_tools)
        self.dock_working_dir = QtGui.QDockWidget(ConfigWindow)
        self.dock_working_dir.setObjectName("dock_working_dir")
        self.dockWidgetContents_2 = QtGui.QWidget()
        self.dockWidgetContents_2.setObjectName("dockWidgetContents_2")
        self.verticalLayout = QtGui.QVBoxLayout(self.dockWidgetContents_2)
        self.verticalLayout.setContentsMargins(5, 0, 0, 0)
        self.verticalLayout.setObjectName("verticalLayout")
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.txtWorkingDir = QtGui.QLineEdit(self.dockWidgetContents_2)
        self.txtWorkingDir.setEnabled(False)
        self.txtWorkingDir.setObjectName("txtWorkingDir")
        self.horizontalLayout.addWidget(self.txtWorkingDir)
        self.cbChooseWorkingDir = QtGui.QToolButton(self.dockWidgetContents_2)
        self.cbChooseWorkingDir.setObjectName("cbChooseWorkingDir")
        self.horizontalLayout.addWidget(self.cbChooseWorkingDir)
        self.cbStepThruBundles = QtGui.QCheckBox(self.dockWidgetContents_2)
        self.cbStepThruBundles.setEnabled(False)
        self.cbStepThruBundles.setMaximumSize(QtCore.QSize(0, 16777215))
        self.cbStepThruBundles.setStyleSheet("")
        self.cbStepThruBundles.setObjectName("cbStepThruBundles")
        self.horizontalLayout.addWidget(self.cbStepThruBundles)
        self.cbStepThruOps = QtGui.QCheckBox(self.dockWidgetContents_2)
        self.cbStepThruOps.setEnabled(False)
        self.cbStepThruOps.setMaximumSize(QtCore.QSize(0, 16777215))
        self.cbStepThruOps.setStyleSheet("")
        self.cbStepThruOps.setObjectName("cbStepThruOps")
        self.horizontalLayout.addWidget(self.cbStepThruOps)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.dock_working_dir.setWidget(self.dockWidgetContents_2)
        ConfigWindow.addDockWidget(QtCore.Qt.DockWidgetArea(4), self.dock_working_dir)
        self.dock_console = QtGui.QDockWidget(ConfigWindow)
        self.dock_console.setObjectName("dock_console")
        self.dockWidgetContents_3 = QtGui.QWidget()
        self.dockWidgetContents_3.setObjectName("dockWidgetContents_3")
        self.horizontalLayout_2 = QtGui.QHBoxLayout(self.dockWidgetContents_3)
        self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.widget = ConsoleOutput(self.dockWidgetContents_3)
        self.widget.setObjectName("widget")
        self.horizontalLayout_2.addWidget(self.widget)
        self.dock_console.setWidget(self.dockWidgetContents_3)
        ConfigWindow.addDockWidget(QtCore.Qt.DockWidgetArea(8), self.dock_console)
        self.dock_resources = QtGui.QDockWidget(ConfigWindow)
        self.dock_resources.setObjectName("dock_resources")
        self.resources_widget = ResourcesWidget()
        self.resources_widget.setObjectName("resources_widget")
        self.dock_resources.setWidget(self.resources_widget)
        ConfigWindow.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.dock_resources)
        self.actionSave = QtGui.QAction(ConfigWindow)
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(":/buttons/images/save.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionSave.setIcon(icon1)
        self.actionSave.setObjectName("actionSave")
        self.actionRun = QtGui.QAction(ConfigWindow)
        icon2 = QtGui.QIcon()
        icon2.addPixmap(QtGui.QPixmap(":/buttons/images/debug.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionRun.setIcon(icon2)
        self.actionRun.setObjectName("actionRun")
        self.actionCopy_2 = QtGui.QAction(ConfigWindow)
        self.actionCopy_2.setObjectName("actionCopy_2")
        self.actionPaste = QtGui.QAction(ConfigWindow)
        self.actionPaste.setObjectName("actionPaste")
        self.actionAbout = QtGui.QAction(ConfigWindow)
        self.actionAbout.setObjectName("actionAbout")
        self.actionSave_As = QtGui.QAction(ConfigWindow)
        self.actionSave_As.setObjectName("actionSave_As")
        self.actionClose = QtGui.QAction(ConfigWindow)
        self.actionClose.setObjectName("actionClose")
        self.actionClone = QtGui.QAction(ConfigWindow)
        self.actionClone.setObjectName("actionClone")
        self.actionOpen = QtGui.QAction(ConfigWindow)
        self.actionOpen.setObjectName("actionOpen")
        self.actionNew = QtGui.QAction(ConfigWindow)
        self.actionNew.setObjectName("actionNew")
        self.actionEnable_Disable_Bundles = QtGui.QAction(ConfigWindow)
        icon3 = QtGui.QIcon()
        icon3.addPixmap(QtGui.QPixmap(":/buttons/images/select_bundles.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionEnable_Disable_Bundles.setIcon(icon3)
        self.actionEnable_Disable_Bundles.setObjectName("actionEnable_Disable_Bundles")
        self.actionRun_2 = QtGui.QAction(ConfigWindow)
        self.actionRun_2.setObjectName("actionRun_2")
        self.actionDebug = QtGui.QAction(ConfigWindow)
        self.actionDebug.setEnabled(False)
        icon4 = QtGui.QIcon()
        icon4.addPixmap(QtGui.QPixmap(":/buttons/images/debug-bug.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionDebug.setIcon(icon4)
        self.actionDebug.setObjectName("actionDebug")
        self.actionPackage = QtGui.QAction(ConfigWindow)
        self.actionPackage.setEnabled(False)
        icon5 = QtGui.QIcon()
        icon5.addPixmap(QtGui.QPixmap(":/buttons/images/package.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionPackage.setIcon(icon5)
        self.actionPackage.setObjectName("actionPackage")
        self.actionSwitch_Workspace = QtGui.QAction(ConfigWindow)
        self.actionSwitch_Workspace.setObjectName("actionSwitch_Workspace")
        self.actionSync = QtGui.QAction(ConfigWindow)
        icon6 = QtGui.QIcon()
        icon6.addPixmap(QtGui.QPixmap(":/buttons/images/sync.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionSync.setIcon(icon6)
        self.actionSync.setObjectName("actionSync")
        self.actionReset = QtGui.QAction(ConfigWindow)
        icon7 = QtGui.QIcon()
        icon7.addPixmap(QtGui.QPixmap(":/buttons/images/reset.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionReset.setIcon(icon7)
        self.actionReset.setObjectName("actionReset")
        self.actionVallidate = QtGui.QAction(ConfigWindow)
        self.actionVallidate.setIcon(icon3)
        self.actionVallidate.setObjectName("actionVallidate")
        self.actionRegex = QtGui.QAction(ConfigWindow)
        self.actionRegex.setObjectName("actionRegex")
        self.actionViewAsModerator = QtGui.QAction(ConfigWindow)
        self.actionViewAsModerator.setCheckable(True)
        self.actionViewAsModerator.setEnabled(True)
        self.actionViewAsModerator.setObjectName("actionViewAsModerator")
        self.actionRemote_Build = QtGui.QAction(ConfigWindow)
        self.actionRemote_Build.setIcon(icon2)
        self.actionRemote_Build.setObjectName("actionRemote_Build")
        self.actionViewAsAdmin = QtGui.QAction(ConfigWindow)
        self.actionViewAsAdmin.setCheckable(True)
        self.actionViewAsAdmin.setObjectName("actionViewAsAdmin")
        self.actionAbout_Halicea = QtGui.QAction(ConfigWindow)
        self.actionAbout_Halicea.setObjectName("actionAbout_Halicea")
        self.actionVerbose = QtGui.QAction(ConfigWindow)
        self.actionVerbose.setCheckable(True)
        icon8 = QtGui.QIcon()
        icon8.addPixmap(QtGui.QPixmap(":/buttons/images/verbose.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionVerbose.setIcon(icon8)
        self.actionVerbose.setObjectName("actionVerbose")
        self.actionDebug_2 = QtGui.QAction(ConfigWindow)
        self.actionDebug_2.setCheckable(True)
        self.actionDebug_2.setIcon(icon4)
        self.actionDebug_2.setObjectName("actionDebug_2")
        self.actionOptions = QtGui.QAction(ConfigWindow)
        self.actionOptions.setIcon(icon3)
        self.actionOptions.setShortcutContext(QtCore.Qt.WindowShortcut)
        self.actionOptions.setObjectName("actionOptions")
        self.actionToggle_Toolbar = QtGui.QAction(ConfigWindow)
        self.actionToggle_Toolbar.setCheckable(True)
        self.actionToggle_Toolbar.setObjectName("actionToggle_Toolbar")
        self.menuWorkspace.addAction(self.actionSync)
        self.menuWorkspace.addAction(self.actionReset)
        self.menuWorkspace.addSeparator()
        self.menuWorkspace.addAction(self.actionSwitch_Workspace)
        self.menuFile.addAction(self.actionNew)
        self.menuFile.addAction(self.actionOpen)
        self.menuFile.addAction(self.menuRecent.menuAction())
        self.menuFile.addAction(self.actionSave)
        self.menuFile.addAction(self.actionSave_As)
        self.menuFile.addAction(self.actionClone)
        self.menuFile.addAction(self.menuWorkspace.menuAction())
        self.menuFile.addSeparator()
        self.menuFile.addAction(self.actionClose)
        self.menuEdit.addAction(self.actionCopy_2)
        self.menuEdit.addAction(self.actionPaste)
        self.menuHelp.addAction(self.actionAbout)
        self.menuRun.addAction(self.actionEnable_Disable_Bundles)
        self.menuRun.addAction(self.actionVallidate)
        self.menuRun.addSeparator()
        self.menuRun.addAction(self.actionRun)
        self.menuRun.addAction(self.actionRemote_Build)
        self.menuRun.addAction(self.actionDebug)
        self.menuRun.addAction(self.actionPackage)
        self.menuTools.addAction(self.actionRegex)
        self.menuTools.addAction(self.actionOptions)
        self.menuView.addAction(self.actionViewAsModerator)
        self.menuView.addAction(self.actionViewAsAdmin)
        self.menuView.addSeparator()
        self.menuView.addAction(self.actionVerbose)
        self.menuView.addAction(self.actionDebug_2)
        self.menuView.addSeparator()
        self.menuView.addAction(self.actionToggle_Toolbar)
        self.menubar.addAction(self.menuFile.menuAction())
        self.menubar.addAction(self.menuEdit.menuAction())
        self.menubar.addAction(self.menuRun.menuAction())
        self.menubar.addAction(self.menuView.menuAction())
        self.menubar.addAction(self.menuTools.menuAction())
        self.menubar.addAction(self.menuHelp.menuAction())
        self.toolBar.addAction(self.actionSave)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.actionRun)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.actionVallidate)
        self.toolBar.addAction(self.actionVerbose)

        self.retranslateUi(ConfigWindow)
        QtCore.QObject.connect(self.txt_plugin_filter, QtCore.SIGNAL("textEdited(QString)"), self.listWidget.filter)
        QtCore.QObject.connect(self.actionOptions, QtCore.SIGNAL("triggered()"), ConfigWindow.showOptionsMenu)
        QtCore.QObject.connect(self.actionToggle_Toolbar, QtCore.SIGNAL("toggled(bool)"), self.toolBar.setVisible)
        QtCore.QMetaObject.connectSlotsByName(ConfigWindow)