예제 #1
0
    def fill_builtin_processes(self, parent_tree_item=None):
        if not parent_tree_item:
            parent_tree_item_add = self.tree_widget.addTopLevelItem
        else:
            parent_tree_item_add = parent_tree_item.addChild

        # Builtin processes
        for key in ['publish', 'attachment', 'icon']:
            top_item = QtGui.QTreeWidgetItem()
            top_item.setText(0, key.capitalize() + ' (builtin)')
            top_item.setCheckState(0, QtCore.Qt.Checked)
            top_item.setData(1, 0, '{0}:{1}'.format(key, '{b}'))
            parent_tree_item_add(top_item)
    def fill_children_pipelines_and_processes(self,
                                              stype=None,
                                              parent_tree_item=None,
                                              added_stypes=None):
        if not parent_tree_item:
            parent_tree_item_add = self.tree_widget.addTopLevelItem
        else:
            parent_tree_item_add = parent_tree_item.addChild

        if not added_stypes:
            added_stypes = []

        # Children process
        if stype.schema:
            for child in stype.schema.children:
                child_stype = stype.get_project().stypes.get(child['from'])
                relationship_type = child.get('type')
                if child_stype and relationship_type not in ['many_to_many']:

                    top_item = QtGui.QTreeWidgetItem()
                    top_item.setText(
                        0,
                        child_stype.get_pretty_name() + ' (child)')
                    top_item.setCheckState(0, QtCore.Qt.Checked)
                    top_item.setData(
                        1, 0, '{0}:{1}'.format(child_stype.get_code(), '{s}'))

                    clr = child_stype.get_stype_color(tuple=True)
                    stype_color = None
                    if clr:
                        stype_color = Qt4Gui.QColor(clr[0], clr[1], clr[2],
                                                    255)
                    top_item.setIcon(
                        0,
                        gf.get_icon('view-sequential',
                                    color=stype_color,
                                    icons_set='mdi',
                                    scale_factor=1.1))

                    parent_tree_item_add(top_item)

                    self.fill_builtin_processes(top_item)

                    # breaking recursion
                    if child_stype not in added_stypes:
                        added_stypes.append(child_stype)

                        self.fill_stype_pipeline(child_stype, top_item)

                        self.fill_children_pipelines_and_processes(
                            child_stype, top_item, added_stypes)
예제 #3
0
    def addAction(self, action, edit_label=False):

        w = QtGui.QWidget()
        l = QtGui.QGridLayout(w)

        b = SquareLabel(menu=self, action=action)
        b.setAlignment(QtCore.Qt.AlignCenter)
        b.setPixmap(gf.get_icon('edit', icons_set='ei').pixmap(13, 13))
        w.setMinimumSize(22, 13)

        b.setAutoFillBackground(True)

        b.setBackgroundRole(Qt4Gui.QPalette.Background)

        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        l.setSpacing(0)
        l.setContentsMargins(0, 0, 0, 0)
        l.addWidget(b)

        self.layout.addWidget(w, len(self.actions()), 1, 1, 1)

        spacerItem = QtGui.QSpacerItem(self.sizeHint().width()-5, 2, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)

        self.layout.addItem(spacerItem, len(self.actions()), 0, 1, 1)

        self.layout.setRowStretch(len(self.actions()), 1)

        super(MenuWithLayout, self).addAction(action)

        w.setFixedHeight(self.actionGeometry(action).height())

        if edit_label:
            return b
        else:
            b.setHidden(True)
            return action
예제 #4
0
    def setupUi(self, sobjectGroupBox):
        sobjectGroupBox.setObjectName("sobjectGroupBox")
        sobjectGroupBox.resize(150, 150)
        # sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
        # sizePolicy.setHorizontalStretch(0)
        # sizePolicy.setVerticalStretch(0)
        # sizePolicy.setHeightForWidth(sobjectGroupBox.sizePolicy().hasHeightForWidth())
        # sobjectGroupBox.setSizePolicy(sizePolicy)
        sobjectGroupBox.setMinimumSize(QtCore.QSize(150, 150))
        sobjectGroupBox.setFocusPolicy(QtCore.Qt.ClickFocus)
        sobjectGroupBox.setStyleSheet("#sobjectGroupBox {\n"
"    background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(175, 175, 175, 75), stop: 1 rgba(0, 0, 0, 30));\n"
"    border: 1px solid rgb(96, 96, 96);\n"
"    border-radius: 1px;\n"
"    padding: 0px 0px;\n"
"    margin-top: 5ex;\n"
"}\n"
"\n"
"#sobjectGroupBox::title {\n"
"    subcontrol-origin: margin;\n"
"    subcontrol-position: top center;\n"
"    padding: 0 3px;\n"
"    background-color: transparent;\n"
"}")
        sobjectGroupBox.setAlignment(QtCore.Qt.AlignHCenter|QtCore.Qt.AlignTop)
        self.vboxlayout = QtGui.QVBoxLayout(sobjectGroupBox)
        self.vboxlayout.setSpacing(0)
        self.vboxlayout.setContentsMargins(0, 0, 0, 0)
        self.vboxlayout.setObjectName("vboxlayout")
        self.picLabel = QtGui.QLabel(sobjectGroupBox)
        self.picLabel.setTextFormat(QtCore.Qt.RichText)
        self.picLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.picLabel.setObjectName("picLabel")
        self.vboxlayout.addWidget(self.picLabel)
        self.vboxlayout.setStretch(0, 1)

        self.retranslateUi(sobjectGroupBox)
        QtCore.QMetaObject.connectSlotsByName(sobjectGroupBox)
예제 #5
0
    def create_float_buttons(self):
        self.clear_button_layout = QtGui.QGridLayout(self.plain_text_editor)
        self.clear_button_layout.setContentsMargins(0, 0, 0, 0)
        self.clear_button_layout.setSpacing(0)

        self.clear_button = QtGui.QToolButton()
        self.clear_button.setAutoRaise(True)
        self.clear_button.setFixedSize(24, 24)
        self.clear_button.setIcon(gf.get_icon('lock-open', icons_set='mdi'))

        self.clear_button_layout.addWidget(self.clear_button, 1, 3, 1, 1)
        self.clear_button_layout.addItem(
            QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding,
                              QtGui.QSizePolicy.Minimum), 1, 4, 1, 1)

        self.clear_button.clicked.connect(self.unfreeze_text_edit)

        self.lock_button = QtGui.QToolButton()
        self.lock_button.setAutoRaise(True)
        self.lock_button.setFixedSize(24, 24)
        self.lock_button.setIcon(gf.get_icon('lock', icons_set='mdi'))

        self.clear_button_layout.addWidget(self.lock_button, 1, 2, 1, 1)
        # self.clear_button_layout.addItem(QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum), 1, 3, 1, 1)

        self.lock_button.clicked.connect(self.freeze_text_edit)

        self.edit_button = QtGui.QToolButton()
        self.edit_button.setAutoRaise(True)
        self.edit_button.setFixedSize(24, 24)
        self.edit_button.setIcon(gf.get_icon('pencil', icons_set='mdi'))

        self.clear_button_layout.addWidget(self.edit_button, 1, 0, 1, 1)
        self.clear_button_layout.addItem(
            QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum,
                              QtGui.QSizePolicy.Expanding), 0, 0, 1, 3)

        self.edit_button.clicked.connect(self.set_edit_mode)

        self.save_button = QtGui.QToolButton()
        self.save_button.setAutoRaise(True)
        self.save_button.setFixedSize(24, 24)
        self.save_button.setIcon(
            gf.get_icon('content-save',
                        icons_set='mdi',
                        color=Qt4Gui.QColor(0, 255, 128, 192)))
        self.clear_button_layout.addWidget(self.save_button, 1, 1, 1, 1)

        self.save_button.clicked.connect(self.save_current_column)

        self.clear_button.setHidden(True)
        self.save_button.setHidden(True)
        self.lock_button.setHidden(True)
    def create_dependency_widget(self):
        pos = 0

        check_list = ['sthpw/snapshot', 'sthpw/file']

        self.check_boxes_list = []

        for search_type, sobjects in self.dependencies.items():
            if len(sobjects) > 0:
                pos += 1
                layout = QtGui.QHBoxLayout()

                deleting_check_box = QtGui.QCheckBox()
                deleting_check_box.setObjectName(search_type)
                if search_type in check_list:
                    deleting_check_box.setChecked(True)
                layout.addWidget(deleting_check_box)

                self.check_boxes_list.append(deleting_check_box)

                collapse_wdg_files = Ui_collapsableWidget(state=True)
                layout_files = QtGui.QVBoxLayout()

                collapse_wdg_files.setLayout(layout_files)
                collapse_wdg_files.setText(u'Hide {0} | {1}'.format(
                    search_type, len(sobjects)))
                collapse_wdg_files.setCollapsedText(u'Show {0} | {1}'.format(
                    search_type, len(sobjects)))

                files_tree_widget = Ui_dependencyExpandWidget(
                    sobjects=sobjects)
                files_tree_widget.setMinimumSize(600, 300)

                layout_files.addWidget(files_tree_widget)

                layout.addWidget(collapse_wdg_files)

                self.main_layout.addLayout(layout, pos, 0)
예제 #7
0
    def create_presets_combo_box(self):
        self.grid_presets = QtGui.QGridLayout()

        self.presets_combo_box = QtGui.QComboBox()

        self.add_new_preset_button = QtGui.QToolButton()
        self.add_new_preset_button.setAutoRaise(True)
        self.add_new_preset_button.setIcon(
            gf.get_icon('plus-box', icons_set='mdi', scale_factor=1.2))
        self.add_new_preset_button.clicked.connect(self.add_new_preset)
        self.add_new_preset_button.setToolTip(
            'Create new Preset and Save (from current state)')
        self.add_new_preset_button.setHidden(True)

        self.save_new_preset_button = QtGui.QToolButton()
        self.save_new_preset_button.setAutoRaise(True)
        self.save_new_preset_button.setIcon(
            gf.get_icon('content-save', icons_set='mdi', scale_factor=1))
        self.save_new_preset_button.clicked.connect(self.save_preset_to_server)
        self.save_new_preset_button.setToolTip('Save Current Preset Changes')
        self.save_new_preset_button.setHidden(True)

        self.remove_preset_button = QtGui.QToolButton()
        self.remove_preset_button.setAutoRaise(True)
        self.remove_preset_button.setIcon(
            gf.get_icon('delete', icons_set='mdi', scale_factor=1))
        self.remove_preset_button.clicked.connect(self.close)
        self.remove_preset_button.setToolTip('Remove Current Preset')
        self.remove_preset_button.setHidden(True)

        self.grid_presets.addWidget(self.remove_preset_button, 0, 0, 1, 1)
        self.grid_presets.addWidget(self.presets_combo_box, 0, 1, 1, 1)
        self.grid_presets.addWidget(self.save_new_preset_button, 0, 2, 1, 1)
        self.grid_presets.addWidget(self.add_new_preset_button, 0, 3, 1, 1)

        self.grid_presets.setColumnStretch(1, 0)

        self.grid.addLayout(self.grid_presets, 0, 0, 1, 2)
예제 #8
0
    def create_ui(self):

        self.create_no_notes_label()

        self.create_notes_tab_widget()

        self.main_notes_layout = QtGui.QVBoxLayout()
        self.main_notes_layout.setSpacing(0)
        self.main_notes_layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(self.main_notes_layout)

        self.main_notes_layout.addWidget(self.no_notes_label)
        self.main_notes_layout.addWidget(self.notes_tab_widget)
        self.notes_tab_widget.setHidden(True)
예제 #9
0
    def fill_modules_tree(self):
        if self.isVisible():
            scrollbar = self.debugLogTextEdit.verticalScrollBar()
            scrollbar.setValue(scrollbar.maximum())

            # self.treeWidget.clear()
            if not self.check_if_items_exists(self.treeWidget, 'FULL LOG'):
                self.full_log_item = QtGui.QTreeWidgetItem()
                self.full_log_item.setText(0, ' -- FULL LOG -- ')
                self.full_log_item.setData(0, 12, 'FULL LOG')
                self.treeWidget.addTopLevelItem(self.full_log_item)

            for debuglog_dict in [dl.info_dict, dl.warning_dict, dl.log_dict]:
                self.add_items_by_debuglog_dict(debuglog_dict)
예제 #10
0
    def setupUi(self, taskItem):
        taskItem.setObjectName("taskItem")
        taskItem.resize(108, 20)
        taskItem.setWindowTitle("")
        self.versionlessLayout = QtGui.QGridLayout(taskItem)
        self.versionlessLayout.setContentsMargins(0, 0, 0, 0)
        self.versionlessLayout.setSpacing(0)
        self.versionlessLayout.setObjectName("versionlessLayout")
        spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding,
                                       QtGui.QSizePolicy.Minimum)
        self.versionlessLayout.addItem(spacerItem, 0, 0, 1, 1)
        self.addToolButton = QtGui.QToolButton(taskItem)
        self.addToolButton.setMaximumSize(QtCore.QSize(75, 20))
        self.addToolButton.setIconSize(QtCore.QSize(12, 12))
        self.addToolButton.setToolButtonStyle(
            QtCore.Qt.ToolButtonTextBesideIcon)
        self.addToolButton.setAutoRaise(True)
        self.addToolButton.setArrowType(QtCore.Qt.DownArrow)
        self.addToolButton.setObjectName("addToolButton")
        self.versionlessLayout.addWidget(self.addToolButton, 0, 1, 1, 1)

        self.retranslateUi(taskItem)
        QtCore.QMetaObject.connectSlotsByName(taskItem)
예제 #11
0
    def create_scroll_layout(self):
        # self.scroller = FlowLayout()
        # self.scroller.setContentsMargins(20, 20, 20, 20)
        # self.scroller.setSpacing(12)
        # self.scroller.wheelEvent = self.wheelEvent
        # self.sobjectScrollLayout.addWidget(self.scroller)

        self.scroll_area_contents = QtGui.QWidget()
        self.scroll_area_contents.setContentsMargins(0, 0, 0, 0)

        self.scroller = QtGui.QScrollArea()
        self.scroller.setWidgetResizable(True)
        self.scroller.setWidget(self.scroll_area_contents)
        self.scroller.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)

        self.scroll_area_layout = StretchFlowLayout(self.scroll_area_contents)
        # self.scroll_area_layout = QtGui.QGridLayout(self.scroll_area_contents)

        self.scroll_area_layout.setAlignment(QtCore.Qt.AlignTop)
        self.scroll_area_layout.setContentsMargins(0, 0, 0, 0)
        self.scroll_area_layout.setSpacing(0)

        self.sobjectScrollLayout.addWidget(self.scroller)
예제 #12
0
    def create_chat_tab(self, chat_subscription, partner_login):
        tab_layout = QtGui.QVBoxLayout()
        tab_widget = QtGui.QWidget()
        tab_widget.setLayout(tab_layout)

        text_edit = QtGui.QTextEdit()

        reply_widget = Ui_replyWidget(self)

        tab_layout.addWidget(text_edit)
        tab_layout.addWidget(reply_widget)

        # temporary!!!
        reply_widget.reply_button.clicked.connect(lambda: self.post_reply(
            text_edit,
            chat_subscription,
            partner_login,
            reply_widget.descriptionTextEdit.toPlainText(),
        ))

        self.fill_chat_messages(text_edit, chat_subscription, partner_login)

        return tab_widget
예제 #13
0
    def note_options_menu(self):

        # add_task = QtGui.QAction('Change Status', self.tasks_options_button)
        # add_task.setIcon(gf.get_icon('plus', icons_set='mdi', scale_factor=1))
        # add_task.triggered.connect(self.add_new_task)

        edit_message = QtGui.QAction('Edit', self.message_options_button)
        edit_message.setIcon(
            gf.get_icon('square-edit-outline', icons_set='mdi',
                        scale_factor=1))
        edit_message.triggered.connect(self.edit_message)

        delete_message = QtGui.QAction('Delete', self.message_options_button)
        delete_message.setIcon(
            gf.get_icon('delete-forever', icons_set='mdi', scale_factor=1))
        delete_message.triggered.connect(self.delete_message)

        menu = QtGui.QMenu()

        menu.addAction(edit_message)
        menu.addAction(delete_message)

        return menu
    def tab_bar_customization(self):
        self.hamburger_tab_button = QtGui.QToolButton()
        self.hamburger_tab_button.setAutoRaise(True)
        self.hamburger_tab_button.setMinimumWidth(24)
        self.hamburger_tab_button.setMinimumHeight(24)
        self.animation_close = QtCore.QPropertyAnimation(
            self.stypes_tree_widget, "maximumWidth", self)
        self.animation_open = QtCore.QPropertyAnimation(
            self.stypes_tree_widget, "maximumWidth", self)
        self.hamburger_tab_button.setIcon(
            gf.get_icon('menu', icons_set='mdi', scale_factor=1.2))

        self.stypes_tab_widget.add_left_corner_widget(
            self.hamburger_tab_button)
예제 #15
0
    def create_options_toolbar(self):

        self.collapsable_options_toolbar = Ui_horizontalCollapsableWidget()
        buttons_layout = QtGui.QHBoxLayout()
        buttons_layout.setSpacing(9)
        buttons_layout.setContentsMargins(0, 0, 0, 0)
        self.collapsable_options_toolbar.set_direction('right')
        self.collapsable_options_toolbar.setLayout(buttons_layout)
        self.collapsable_options_toolbar.setCollapsed(True)

        self.auto_save_check_box = QtGui.QCheckBox('Autosave')
        self.auto_save_check_box.setChecked(False)

        self.definition_label = QtGui.QLabel('Definition: ')

        self.definition_combo_box = QtGui.QComboBox()

        buttons_layout.addWidget(self.definition_label)
        buttons_layout.addWidget(self.definition_combo_box)
        buttons_layout.addWidget(self.auto_save_check_box)

        self.main_layout.addWidget(self.collapsable_options_toolbar, 0, 1, 1,
                                   1)
예제 #16
0
    def create_tree_widget(self):

        self.grid = QtGui.QGridLayout()
        self.grid.setContentsMargins(9, 9, 9, 9)
        self.grid.setSpacing(6)
        self.setLayout(self.grid)

        self.create_presets_combo_box()

        self.tree_widget = QtGui.QTreeWidget(self)
        self.tree_widget.setTabKeyNavigation(True)
        self.tree_widget.setVerticalScrollMode(
            QtGui.QAbstractItemView.ScrollPerPixel)
        self.tree_widget.setAllColumnsShowFocus(True)
        self.tree_widget.setSelectionMode(
            QtGui.QAbstractItemView.ExtendedSelection)
        self.tree_widget.setHeaderHidden(True)
        self.tree_widget.setObjectName('tree_widget')
        self.tree_widget.setStyleSheet(gf.get_qtreeview_style())
        self.tree_widget.setRootIsDecorated(True)

        self.grid.addWidget(self.tree_widget, 1, 0, 1, 2)
        self.grid.setRowStretch(1, 1)
예제 #17
0
    def setupUi(self, previewItem):
        previewItem.setObjectName("previewItem")
        previewItem.resize(382, 64)
        self.gridLayout = QtGui.QGridLayout(previewItem)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.setSpacing(0)
        self.gridLayout.setObjectName("gridLayout")
        self.previewLabel = QtGui.QLabel(previewItem)
        self.previewLabel.setMinimumSize(QtCore.QSize(64, 64))
        self.previewLabel.setMaximumSize(QtCore.QSize(64, 64))
        self.previewLabel.setStyleSheet("QLabel {\n"
"    background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(175, 175, 175, 16), stop: 1 rgba(0, 0, 0, 0));\n"
"    border: 0px;\n"
"    border-radius: 4px;\n"
"    padding: 0px 0px;\n"
"}")
        self.previewLabel.setTextFormat(QtCore.Qt.RichText)
        self.previewLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.previewLabel.setObjectName("previewLabel")
        self.gridLayout.addWidget(self.previewLabel, 0, 0, 1, 1)
        self.fileNameLabel = QtGui.QLabel(previewItem)
        self.fileNameLabel.setMinimumSize(QtCore.QSize(0, 20))
        self.fileNameLabel.setMaximumSize(QtCore.QSize(16777215, 24))
        font = Qt4Gui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.fileNameLabel.setFont(font)
        self.fileNameLabel.setStyleSheet("QLabel {\n"
"    background-color: transparent;\n"
"    border-bottom: 2px solid qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(128, 128, 128, 64), stop:1 rgba(128, 128,128, 0));\n"
"}")
        self.fileNameLabel.setTextFormat(QtCore.Qt.PlainText)
        self.fileNameLabel.setObjectName("fileNameLabel")
        self.gridLayout.addWidget(self.fileNameLabel, 0, 1, 1, 1)

        self.retranslateUi(previewItem)
        QtCore.QMetaObject.connectSlotsByName(previewItem)
    def add_items_to_stypes_tree(self):
        exclude_list = self.get_ignore_stypes_list()
        self.stypes_tree_widget.clear()

        all_stypes = []

        for stype in env_inst.projects[
                self.project.get_code()].stypes.itervalues():
            all_stypes.append(stype.info)

        grouped = gf.group_dict_by(all_stypes, 'type')

        for type_name, value in grouped.items():
            top_item = QtGui.QTreeWidgetItem()

            if not type_name:
                type_name = 'No Category'
            top_item.setText(0, type_name.capitalize())
            top_item.setCheckState(0, QtCore.Qt.Checked)
            self.stypes_tree_widget.addTopLevelItem(top_item)
            for item in value:
                child_item = QtGui.QTreeWidgetItem()

                stype = env_inst.projects[self.project.get_code()].stypes.get(
                    item.get('code'))

                item_code = stype.get_code()
                child_item.setText(0, stype.get_pretty_name())
                child_item.setText(1, item_code)
                child_item.setData(0, QtCore.Qt.UserRole, item)
                child_item.setCheckState(0, QtCore.Qt.Checked)
                if exclude_list:
                    if item_code in exclude_list:
                        child_item.setCheckState(0, QtCore.Qt.Unchecked)
                top_item.addChild(child_item)

            top_item.setExpanded(True)
예제 #19
0
    def create_tabbed_widget(self):
        self.columns_tab_widget = QtGui.QTabWidget(self)

        self.columns_tab_widget.setMovable(True)
        self.columns_tab_widget.setTabsClosable(False)
        self.columns_tab_widget.setObjectName("notes_tab_widget")
        self.columns_tab_widget.setStyleSheet(
            '#notes_tab_widget > QTabBar::tab {background: transparent;border: 2px solid transparent;'
            'border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;padding: 4px;}'
            '#notes_tab_widget > QTabBar::tab:selected, #notes_tab_widget > QTabBar::tab:hover {'
            'background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(255, 255, 255, 48), stop: 1 rgba(255, 255, 255, 32));}'
            '#notes_tab_widget > QTabBar::tab:selected {border-color: transparent;}'
            '#notes_tab_widget > QTabBar::tab:!selected {margin-top: 0px;}')

        self.main_layout.addWidget(self.columns_tab_widget, 1, 0, 1, 3)
    def add_new_preset(self):

        add_preset_dialog = QtGui.QDialog(self)
        add_preset_dialog.setWindowTitle('Save as new Preset {}'.format(self.stype.get_pretty_name()))
        add_preset_dialog.setMinimumSize(320, 80)
        add_preset_dialog.setMaximumSize(450, 80)

        add_preset_dialog_layout = QtGui.QVBoxLayout()
        add_preset_dialog.setLayout(add_preset_dialog_layout)

        add_preset_dialog_line_edit = QtGui.QLineEdit('New Preset')

        add_preset_dialog_button = QtGui.QPushButton('Create and Save')

        add_preset_dialog_layout.addWidget(add_preset_dialog_line_edit)
        add_preset_dialog_layout.addWidget(add_preset_dialog_button)

        add_preset_dialog_button.clicked.connect(lambda: self.save_preset_to_server(
            preset_name=add_preset_dialog_line_edit.text().lower().replace(' ', '_'),
            pretty_preset_name=add_preset_dialog_line_edit.text()
        ))
        add_preset_dialog_button.clicked.connect(add_preset_dialog.close)

        add_preset_dialog.exec_()
예제 #21
0
    def fill_versions_widget(self, paths):
        self.treeWidget_vers.clear()
        file_names = []
        for keys, values in paths:
            for i, fl in enumerate(values['versioned']['names']):
                full_path = gf.form_path(self.repo['value'][0] + '/' + values['versioned']['paths'][i])
                item = QtGui.QTreeWidgetItem()
                item.setText(0, u''.join(fl))
                file_names.append(u''.join(fl))
                item.setText(1, full_path)
                self.treeWidget_vers.addTopLevelItem(item)

        if self.commit_item:
            self.commit_item.set_new_title(file_names[0])
        self.treeWidget_vers.resizeColumnToContents(0)
    def __init__(self, parent=None):
        super(self.__class__, self).__init__(parent=parent)

        self.scene = QtGui.QGraphicsScene(self)
        self.shown = False
        self.scene_created = False

        self.item_widget = None
        self.snapshots = None

        self.create_ui()

        self.controls_actions()

        self.installEventFilter(self)
예제 #23
0
    def fill_table_widget(self, pipeline=None):

        # def get_current_process_info(self):
        #     pipeline = self.get_current_process_pipeline()
        #     process_info = None
        #     if pipeline:
        #         process_info = pipeline.process.get(self.process)
        #
        #     return process_info
        #
        # self.tablesTreeWidget.addTopLevelItem(QtGui.QTreeWidgetItem())

        def recursive_add_sub_processes(ppln):
            for child_process in ppln.get_all_processes_names():
                subprocess_item = QtGui.QTreeWidgetItem()
                subprocess_item.setText(0, child_process)
                process_item.addChild(subprocess_item)

        # getting all possible processes here
        pipeline_code = self.sobject.info.get('pipeline_code')
        if pipeline_code and self.stype.pipeline:
            pipeline = self.stype.pipeline.get(pipeline_code)

        for process in pipeline.get_all_processes_names():
            process_item = QtGui.QTreeWidgetItem()
            process_item.setText(0, process)
            self.tablesTreeWidget.addTopLevelItem(process_item)
            process_info = pipeline.process.get(process)

            if process_info.get('type') == 'hierarchy':
                workflow = self.stype.get_workflow()
                child_pipeline = workflow.get_child_pipeline_by_process_code(
                    pipeline, process)

                recursive_add_sub_processes(child_pipeline)

        # print self.sobject.process.items()

        process = self.sobject.get_process('modeling')
        contexts = process.get_contexts()
        if contexts:
            for key, val in contexts.items():
                # print key, val

                for snapshot in val.get_versions().values():
                    # from pprint import pprint
                    # pprint(snapshot.get_snapshot())
                    self.fill_edit_table_tree_widget(snapshot.get_snapshot())
예제 #24
0
    def setupUi(self, referenceOptions):
        referenceOptions.setObjectName("referenceOptions")
        referenceOptions.setWindowModality(QtCore.Qt.ApplicationModal)
        referenceOptions.resize(400, 100)
        referenceOptions.setMinimumSize(QtCore.QSize(400, 0))
        referenceOptions.setMaximumSize(QtCore.QSize(16777215, 100))
        self.gridLayout = QtGui.QGridLayout(referenceOptions)
        self.gridLayout.setObjectName("gridLayout")
        spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Preferred,
                                       QtGui.QSizePolicy.Minimum)
        self.gridLayout.addItem(spacerItem, 1, 0, 1, 1)
        self.optionsReferencePushButton = QtGui.QPushButton(referenceOptions)
        self.optionsReferencePushButton.setObjectName(
            "optionsReferencePushButton")
        self.gridLayout.addWidget(self.optionsReferencePushButton, 1, 1, 1, 1)
        self.referencePushButton = QtGui.QPushButton(referenceOptions)
        self.referencePushButton.setObjectName("referencePushButton")
        self.gridLayout.addWidget(self.referencePushButton, 1, 2, 1, 1)
        self.groupBox = QtGui.QGroupBox(referenceOptions)
        self.groupBox.setFlat(True)
        self.groupBox.setObjectName("groupBox")
        self.horizontalLayout = QtGui.QHBoxLayout(self.groupBox)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.horizontalSlider = QtGui.QSlider(self.groupBox)
        self.horizontalSlider.setMinimum(1)
        self.horizontalSlider.setMaximum(100)
        self.horizontalSlider.setOrientation(QtCore.Qt.Horizontal)
        self.horizontalSlider.setObjectName("horizontalSlider")
        self.horizontalLayout.addWidget(self.horizontalSlider)
        self.spinBox = QtGui.QSpinBox(self.groupBox)
        self.spinBox.setAccelerated(True)
        self.spinBox.setMinimum(1)
        self.spinBox.setMaximum(100)
        self.spinBox.setObjectName("spinBox")
        self.horizontalLayout.addWidget(self.spinBox)
        self.gridLayout.addWidget(self.groupBox, 0, 0, 1, 3)

        self.retranslateUi(referenceOptions)
        QtCore.QObject.connect(self.horizontalSlider,
                               QtCore.SIGNAL("valueChanged(int)"),
                               self.spinBox.setValue)
        QtCore.QObject.connect(self.spinBox,
                               QtCore.SIGNAL("valueChanged(int)"),
                               self.horizontalSlider.setValue)
        QtCore.QMetaObject.connectSlotsByName(referenceOptions)
예제 #25
0
def startup():
    env_inst.ui_super = QtGui.QApplication(sys.argv)
    env_inst.ui_super.setApplicationName('TacticHandler_Client')
    env_inst.ui_super.setStyle('plastique')
    setPaletteFromDct(palette)

    def server_ping_agent():
        return tc.server_ping()

    ping_worker = gf.get_thread_worker(server_ping_agent,
                                       finished_func=create_ui,
                                       error_func=create_ui)

    ping_worker.start()

    sys.exit(env_inst.ui_super.exec_())
예제 #26
0
    def create_ui(self):

        self.mainwidget = QtGui.QWidget(self)
        self.mainwidget.setObjectName("mainwidget")
        self.setCentralWidget(self.mainwidget)

        # Spawning server
        dl.log('Spawning Tactic Server')
        print('Spawning Tactic Server')

        self.create_batch_object()

        self.create_float_notify()

        self.create_debuglog_widget()
        self.create_script_editor_widget()
예제 #27
0
    def create_project_dock(self, project_code, close_project=True, raise_tab=False):
        if project_code not in self.projects_docks.keys():
            project = env_inst.projects.get(project_code)
            if project:
                if not project.is_template():
                    dock_widget = QtGui.QDockWidget(self)
                    dock_widget.setObjectName(project_code)
                    # print project.info['title'].replace('_', ' ').capitalize()
                    dock_widget.setWindowTitle(project.info.get('title'))
                    dock_widget.setMinimumWidth(200)
                    dock_widget.setFeatures(
                        QtGui.QDockWidget.DockWidgetMovable | QtGui.QDockWidget.DockWidgetClosable)

                    main_tabs_widget = Ui_mainTabs(project_code, dock_widget)
                    dock_widget.setWidget(main_tabs_widget)

                    self.addDockWidget(QtCore.Qt.LeftDockWidgetArea, dock_widget)
                    for dock in self.projects_docks.values():
                        self.tabifyDockWidget(dock, dock_widget)

                    self.projects_docks[project_code] = dock_widget

                    dock_widget.setStyleSheet(
                        '#complex_testing_phase_four > QTabBar::tab {background: transparent;border: 2px solid transparent;'
                        'border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-left-radius: 0px;border-bottom-right-radius: 0px;padding: 4px;}'
                        '#complex_testing_phase_four > QTabBar::tab:selected, #complex_testing_phase_four > QTabBar::tab:hover {'
                        'background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(255, 255, 255, 48), stop: 1 rgba(255, 255, 255, 32));}'
                        '#complex_testing_phase_four > QTabBar::tab:selected {border-color: transparent;}'
                        '#complex_testing_phase_four > QTabBar::tab:!selected {margin-top: 0px;}')

                    dock_widget.show()
                    dock_widget.raise_()
            else:
                print('No project with code: {0}'.format(project_code))

        elif close_project:
            self.projects_docks[project_code].widget().close()
            self.projects_docks[project_code].close()
            self.projects_docks[project_code].deleteLater()
            del self.projects_docks[project_code]
            env_inst.cleanup(project_code)

        if raise_tab:
            project_dock = self.projects_docks.get(project_code)
            if project_dock:
                project_dock.show()
                project_dock.raise_()
예제 #28
0
    def fill_templates(self):

        templates = [
            (True, '$FILENAME'),
            (True, '$FILENAME.$EXT'),
            (True, '$FILENAME.$FRAME.$EXT'),
            (True, '$FILENAME_$UDIM.$EXT'),
            (True, '$FILENAME_$UV.$EXT'),
            (True, '$FILENAME.$FRAME_$UDIM.$EXT'),
            (True, '$FILENAME.$FRAME_$UV.$EXT'),
            (True, '$FILENAME_$UV.$FRAME.$EXT'),
            (False, '$FILENAME_$LAYER.$EXT'),
            (False, '$FILENAME.$LAYER.$EXT'),
            (False, '$FILENAME_$LAYER.$FRAME.$EXT'),
            (False, '$FILENAME.$LAYER.$FRAME.$EXT'),
            (False, '$FILENAME.$LAYER_$UV.$EXT'),
            (False, '$FILENAME.$LAYER.$FRAME_$UV.$EXT'),
            (False, '$FILENAME.$LAYER_$UV.$FRAME.$EXT'),
            (False, '$FILENAME.$LAYER_$UDIM.$EXT'),
            (False, '$FILENAME.$LAYER.$FRAME_$UDIM.$EXT'),
            (False, '$FILENAME.$LAYER_$UDIM.$FRAME.$EXT'),
            (False, '$FILENAME_$LAYER.$FRAME_$UDIM.$EXT'),
        ]
        # templates = [
        #     (True, '$FILENAME'),
        #     (True, '$FILENAME.$EXT'),
        #     (True, '$FILENAMEFrame$FRAME.$EXT'),
        # ]

        for enabled, template in templates:

            tree_item = QtGui.QTreeWidgetItem()
            if enabled:
                tree_item.setCheckState(0, QtCore.Qt.Checked)
                self.current_templates_list.append(template)
            else:
                tree_item.setCheckState(0, QtCore.Qt.Unchecked)
            tree_item.setText(1, template)
            match_template = gf.MatchTemplate([template],
                                              padding=self.get_min_padding())
            tree_item.setText(2, match_template.get_preview_string())
            tree_item.setText(3, match_template.get_type_string())

            if template in ['$FILENAME', '$FILENAME.$EXT']:
                tree_item.setDisabled(True)

            self.templatesTreeWidget.addTopLevelItem(tree_item)
    def create_ui(self):

        self.mainwidget = QtGui.QWidget(self)
        self.mainwidget.setObjectName("mainwidget")
        self.setCentralWidget(self.mainwidget)

        tc.get_all_projects_and_logins()

        self.create_float_notify()

        self.create_debuglog_widget()
        self.create_script_editor_widget()

        # Spawning api listener server
        dl.log('Spawning api listener Server')
        print 'Spawning api listener Server'
        env_api.spawn_api_server(self)
    def fill_repo_tree_widget(self, exlude_list=None):

        self.repos_tree_widget.clear()

        if not exlude_list:
            exlude_list = []

        base_dirs = env_tactic.get_all_base_dirs()

        # Default repo states
        for key, val in base_dirs:
            if val['value'][4] and val['value'][3] in exlude_list:
                root_item = QtGui.QTreeWidgetItem()
                root_item.setText(0, val['value'][1])
                root_item.setData(0, QtCore.Qt.UserRole, val)

                self.repos_tree_widget.addTopLevelItem(root_item)