Esempio n. 1
0
    def get_settings_dict(self):

        settings_dict = {}

        if self.windowState() == QtCore.Qt.WindowMaximized:
            state = True
            if self.ui_settings_dict:
                settings_dict['pos'] = self.ui_settings_dict['pos']
                settings_dict['size'] = self.ui_settings_dict['size']
            else:
                settings_dict['pos'] = self.pos().toTuple()
                settings_dict['size'] = self.size().toTuple()
        else:
            state = False
            settings_dict['pos'] = self.pos().toTuple()
            settings_dict['size'] = self.size().toTuple()
        settings_dict['windowState'] = state

        if self.projects_docks.keys():
            settings_dict['opened_projects'] = self.projects_docks.keys()
            if env_inst.get_current_project():
                settings_dict['current_active_project'] = str(env_inst.get_current_project())
        else:
            settings_dict['opened_projects'] = ''
            settings_dict['current_active_project'] = ''

        return settings_dict
Esempio n. 2
0
    def apply_current_view(self):
        # TODO may be need to be rewriten to use env instance
        if env_inst.get_current_project():
            current_project_widget = self.projects_docks[
                env_inst.get_current_project()].widget()

            current_project_widget.ui_checkin_checkout.apply_current_view_to_all(
            )
Esempio n. 3
0
    def save_current_script(self):

        script_folder = self.first_path_part_line_edit.text()
        script_title = self.second_path_part_line_edit.text()
        current_language = self.get_current_script_language()[1]

        if script_folder and script_title:
            script_sobject = self.get_current_script_sobject()

            if script_sobject:
                script_sobject.set_value('script', self.get_current_script())
                script_sobject.set_value('language', current_language)
                script_sobject.set_value('folder', script_folder)
                script_sobject.set_value('title', script_title)
                script_sobject.commit(False)
            else:
                search_type = tc.server_start().build_search_type(
                    'config/custom_script',
                    project_code=env_inst.get_current_project())
                filters = [('script', self.get_current_script()),
                           ('folder', script_folder), ('title', script_title),
                           ('language', current_language)]
                tc.server_start().insert(search_type, dict(filters))

            self.refresh_scripts_tree()
Esempio n. 4
0
    def go_by_skey(self, skey_in=None, relates_to=None):
        # TODO Need to rewrite this according to porjects tabs

        if relates_to:
            self.relates_to = relates_to
        else:
            self.relates_to = None
            if self.main_tabWidget.currentWidget().objectName() == 'checkOutTab':
                self.relates_to = 'checkout'
            if self.main_tabWidget.currentWidget().objectName() == 'checkInTab':
                self.relates_to = 'checkin'

        print(self.relates_to)

        if skey_in:
            skey = tc.parce_skey(skey_in)
        else:
            skey = tc.parce_skey(self.skeyLineEdit.text())

        print(skey)

        common_pipeline_codes = ['snapshot', 'task']
        pipeline_code = None
        if skey:
            if skey.get('pipeline_code') and skey.get('project'):
                if skey.get('project') == env_inst.get_current_project():
                    if skey['pipeline_code'] not in common_pipeline_codes:
                        pipeline_code = u'{namespace}/{pipeline_code}'.format(**skey)
                else:
                    self.wrong_project_message(skey)

        if pipeline_code and self.relates_to in ['checkin', 'checkout']:
            # TODO BUG WITH env_inst.ui_check_tabs!!!
            tab_wdg = env_inst.ui_check_tabs[self.relates_to].sObjTabWidget
            for i in range(tab_wdg.count()):
                if tab_wdg.widget(i).objectName() == pipeline_code:
                    tab_wdg.setCurrentIndex(i)

            tree_wdg = tab_wdg.currentWidget()
            tree_wdg.go_by_skey[0] = True

            if skey.get('context'):
                tree_wdg.go_by_skey[1] = skey

            search_code = skey.get('code')
            tree_wdg.searchLineEdit.setText(search_code)
            tree_wdg.searchOptionsGroupBox.searchCodeRadioButton.setChecked(True)

            tree_wdg.search_results_widget.add_tab(search_code)
Esempio n. 5
0
    def show_projects_cooser(self):

        if self.projects_chooser_widget.isVisible():
            self.projects_chooser_widget.setHidden(True)

            current_project = env_inst.get_current_project()
            if current_project:
                current_project_dock = self.projects_docks.get(current_project)
                current_project_dock.setHidden(False)
            else:
                self.projects_chooser_widget.setHidden(False)
        else:
            for opened_project in self.projects_docks.values():
                opened_project.setHidden(True)

            self.projects_chooser_widget.setHidden(False)
Esempio n. 6
0
    def apply_current_view(self):

        if env_inst.get_current_project():
            current_project_widget = self.projects_docks[env_inst.get_current_project()]

            current_project_widget.ui_checkin_checkout.apply_current_view_to_all()
Esempio n. 7
0
    def create_ui(self):

        self.setWindowTitle('Script editor')
        self.setObjectName("scriptEditForm")
        self.resize(720, 550)
        self.setSizeGripEnabled(True)
        self.setWindowFlags(QtCore.Qt.Window)

        font = Qt4Gui.QFont()
        font.setPointSize(10)
        font.setFamily('Courier')

        self.main_grid_layout = QtGui.QGridLayout(self)
        self.setLayout(self.main_grid_layout)

        self.main_grid_layout.setObjectName("main_grid_layout")

        self.main_splitter = QtGui.QSplitter(self)
        self.main_splitter.setOrientation(QtCore.Qt.Horizontal)
        self.main_splitter.setObjectName("main_splitter")

        self.verticalLayoutWidget = QtGui.QWidget(self.main_splitter)
        self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")

        self.script_editor_vertical_layout = QtGui.QVBoxLayout(
            self.verticalLayoutWidget)
        self.script_editor_vertical_layout.setContentsMargins(0, 0, 0, 0)
        self.script_editor_vertical_layout.setObjectName(
            "script_editor_vertical_layout")

        self.script_path_horizontal_layout = QtGui.QHBoxLayout()
        self.script_path_horizontal_layout.setObjectName(
            "script_path_horizontal_layout")

        self.path_label = QtGui.QLabel(self.verticalLayoutWidget)
        self.path_label.setObjectName("path_label")
        self.path_label.setText('Script path: ')

        self.first_path_part_line_edit = QtGui.QLineEdit(
            self.verticalLayoutWidget)
        self.first_path_part_line_edit.setObjectName(
            "first_path_part_line_edit")

        self.slash_label = QtGui.QLabel(self.verticalLayoutWidget)
        self.slash_label.setObjectName("slash_label")
        self.slash_label.setText(' / ')

        self.second_path_part_line_edit = QtGui.QLineEdit(
            self.verticalLayoutWidget)
        self.second_path_part_line_edit.setObjectName(
            "second_path_part_line_edit")

        self.script_language_combo_box = QtGui.QComboBox(
            self.verticalLayoutWidget)
        for script in self.sripts_languages:
            self.script_language_combo_box.addItem(script[0])

        self.create_left_collapsable_toolbar()
        self.create_right_collapsable_toolbar()

        self.script_path_horizontal_layout.addWidget(
            self.left_collapsable_toolbar)
        self.script_path_horizontal_layout.setStretch(0, 0)
        self.script_path_horizontal_layout.addWidget(self.path_label)
        self.script_path_horizontal_layout.setStretch(1, 0)
        self.script_path_horizontal_layout.addWidget(
            self.first_path_part_line_edit)
        self.script_path_horizontal_layout.setStretch(2, 1)
        self.script_path_horizontal_layout.addWidget(self.slash_label)
        self.script_path_horizontal_layout.setStretch(3, 0)
        self.script_path_horizontal_layout.addWidget(
            self.second_path_part_line_edit)
        self.script_path_horizontal_layout.setStretch(4, 1)
        self.script_path_horizontal_layout.addWidget(
            self.script_language_combo_box)
        self.script_path_horizontal_layout.setStretch(5, 0)
        self.script_path_horizontal_layout.addWidget(
            self.right_collapsable_toolbar)
        self.script_path_horizontal_layout.setStretch(6, 0)

        self.script_editor_vertical_layout.addLayout(
            self.script_path_horizontal_layout)

        self.splitter = QtGui.QSplitter(self.verticalLayoutWidget)
        self.splitter.setOrientation(QtCore.Qt.Vertical)
        self.splitter.setObjectName("splitter")

        self.output = output_window.OutputWindow(self)
        self.output.setFont(font)
        self.splitter.addWidget(self.output)

        self.console = editor_window.EditorWindow(self)
        self.console.setFont(font)
        self.splitter.addWidget(self.console)

        self.script_editor_vertical_layout.addWidget(self.splitter)

        self.down_buttons_horizontal_layout = QtGui.QHBoxLayout()
        self.down_buttons_horizontal_layout.setObjectName(
            "down_buttons_horizontal_layout")

        self.run_script_button = QtGui.QPushButton(self.verticalLayoutWidget)
        self.run_script_button.setObjectName("run_script_button")
        self.run_script_button.setText('Run Script')
        self.run_script_button.setFlat(True)
        self.run_script_button.setIcon(gf.get_icon('play', icons_set='mdi'))

        self.execute_label = QtGui.QLabel(self.verticalLayoutWidget)
        self.execute_label.setObjectName("execute_label")
        self.execute_label.setText('Execute: ')

        self.run_type_combo_box = QtGui.QComboBox(self.verticalLayoutWidget)
        self.run_type_combo_box.setObjectName("run_type_combo_box")
        self.run_type_combo_box.addItem('Locally')
        self.run_type_combo_box.addItem('Server-Side')

        spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding,
                                       QtGui.QSizePolicy.Minimum)

        self.down_buttons_horizontal_layout.addWidget(self.run_script_button)
        self.down_buttons_horizontal_layout.addItem(spacerItem)
        self.down_buttons_horizontal_layout.addWidget(self.execute_label)
        self.down_buttons_horizontal_layout.addWidget(self.run_type_combo_box)

        self.script_editor_vertical_layout.addLayout(
            self.down_buttons_horizontal_layout)

        self.scripts_tree_widget = QtGui.QTreeWidget(self.main_splitter)
        self.scripts_tree_widget.setAlternatingRowColors(True)
        self.scripts_tree_widget.setAllColumnsShowFocus(True)
        self.scripts_tree_widget.setVerticalScrollMode(
            QtGui.QAbstractItemView.ScrollPerPixel)
        self.scripts_tree_widget.setStyleSheet(gf.get_qtreeview_style())
        self.scripts_tree_widget.setSelectionMode(
            QtGui.QAbstractItemView.SingleSelection)
        self.scripts_tree_widget.setEditTriggers(
            QtGui.QAbstractItemView.NoEditTriggers)
        self.scripts_tree_widget.setRootIsDecorated(True)
        self.scripts_tree_widget.setHeaderHidden(True)
        self.scripts_tree_widget.setObjectName('scripts_tree_widget')

        self.scripts_tree_widget.setColumnCount(2)

        self.main_grid_layout.addWidget(self.main_splitter)

        self.stream = stream.Stream.get_stream()
        if self.stream is None:
            self.stream = stream.Stream()

        self.console_obj = console.Console()

        if env_inst.get_current_project():
            self.fill_sctipts_tree_widget()

        self.create_scripts_tree_context_menu()