Пример #1
0
 def set_default(self):
     self.clear_widget()
     show_icon, valid = self.environ.get_environ_value('SHOW_ICON')
     if not show_icon:
         show_icon = os.path.join(resource.getIconPath(), 'show.png')
     size = self.button_show.minimumSize()
     swidgets.image_to_button(
         self.button_show,
         size.width(),
         size.height(),
         path=show_icon
         )
     pub_data = self.spipe.get()
     captions = ['']
     if pub_data:  # add caption from database
         captions = [''] + pub_data.keys()
     self.combobox_caption.addItems(captions)
     self.combobox_version.addItems(['major', 'minor', 'patch'])            
     size = self.button_thumbnail.minimumSize()
     swidgets.image_to_button(
         self.button_thumbnail,
         size.width(),
         size.height(),
         path=os.path.join(resource.getIconPath(), 'screenshot.png')
         )
Пример #2
0
def set_header(parent, title, layout, show_icon=None):  # **
    config = sheader.Header()
    config.tool()
    # version, label = config.version, config.pretty        
    parent.setWindowTitle('{} ({} {})'.format(title, config.pretty, config.version))        
    groupbox = QtWidgets.QGroupBox(None)
    groupbox.setObjectName('groupbox_asset')
    groupbox.setTitle('{} <{}>'.format(config.pretty, title))  
    layout.addWidget(groupbox)             
    verticallayout = QtWidgets.QVBoxLayout(groupbox)
    verticallayout.setObjectName('verticallayout_item')
    verticallayout.setSpacing(10)
    verticallayout.setContentsMargins(5, 5, 5, 5)                
    horizontallayout = QtWidgets.QHBoxLayout()
    horizontallayout.setContentsMargins(5, 5, 5, 5)
    horizontallayout.setObjectName('horizontallayout')
    verticallayout.addLayout(horizontallayout)
    button_logo = QtWidgets.QPushButton(None)
    button_logo.setFlat(True)
    button_logo.setObjectName('button_logo')
    button_logo.setMinimumSize(QtCore.QSize(350, 99))
    button_logo.setMaximumSize(QtCore.QSize(350, 99))                
    logo_path = os.path.join(resource.getIconPath(), 'logo.png')        
    image_to_button(button_logo, 350, 99, path=logo_path)
    horizontallayout.addWidget(button_logo)       
    spaceritem = QtWidgets.QSpacerItem(
        40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
    horizontallayout.addItem(spaceritem)    
    button_show = QtWidgets.QPushButton(None)
    button_show.setFlat(True)
    button_show.setObjectName('button_show')
    button_show.setMinimumSize(QtCore.QSize(176, 99))
    button_show.setMaximumSize(QtCore.QSize(176, 99))
    horizontallayout.addWidget(button_show)
    if show_icon:
        if not os.path.isfile(show_icon):
            show_icon = os.path.join(resource.getIconPath(), 'show.png')
        size = button_show.minimumSize()
        image_to_button(
            button_show,
            size.width(),
            size.height(),
            path=show_icon
            )
    line = QtWidgets.QFrame(None)
    line.setObjectName('line')        
    line.setFrameShape(QtWidgets.QFrame.HLine)    
    verticallayout.addWidget(line)
    
    return verticallayout, button_show
Пример #3
0
 def get_applications_data(self, application_type):
     application_name = '%s_application' % application_type
     applications_path = resource.getApplicationsPath(application_type)
     module_data = common.get_modules(applications_path,
                                      module_types=[application_name])
     if not module_data:
         return None
     if application_name not in module_data:
         return None
     application_data = {}
     for order, module in module_data[application_name].items():
         module_path = os.path.join(module.__path__[-1], 'main.sh')
         if not os.path.isfile(module_path):
             continue
         contents = {
             "exe": ['%s_EXE' % module.KEY.upper(), module_path],
             'bash':
             module_path,
             "path":
             ['%s_PATH' % module.KEY.upper(),
              os.path.dirname(module_path)],
             "version": [
                 '%s_VERSION' % module.KEY.upper(),
                 '%s%s' % (module.KEY, module.VERSION)
             ],
             "order":
             order,
             "icon": [
                 '%s_ICON' % module.KEY.upper(),
                 os.path.join(resource.getIconPath(), module.ICON)
             ]
         }
         application_data.setdefault(module.KEY, contents)
     return application_data
Пример #4
0
def set_icons(mainwindow=None, widgets=None):  # **
    if mainwindow:
        icon = QtGui.QIcon()
        split = mainwindow.objectName().split('_')[1:]
        name = '_'.join(split)
        
        icon.addPixmap(QtGui.QPixmap(os.path.join(resource.getIconPath(), '%s.png' % name)))
        mainwindow.setWindowIcon(icon)
    if widgets:
        # qactions = self.findChildren(QtWidgets.QAction)
        for widget in widgets :
            icon = QtGui.QIcon()         
            icon_name = widget.objectName().split('action_')[-1]
            icon_path = (os.path.join(resource.getIconPath(), '{}.png'.format(icon_name)))
            icon.addPixmap(QtGui.QPixmap (icon_path), QtGui.QIcon.Normal, QtGui.QIcon.Off)
            widget.setIcon(icon)  
Пример #5
0
 def current_item_select(self, *args):
     self.clear_widget()
     current_item = args[0]
     contents = current_item.statusTip(0)
     if not contents:
         return
     contents = ast.literal_eval(contents)
     self.setup_toolbox(contents['subfield'])
     self.label_caption.setText(contents['caption'])
     self.label_tag.setText(contents['tag'])
     self.label_type.setText(contents['type'])
     self.label_user.setText(contents['user'])
     self.label_modified.setText(contents['modified'])
     self.label_showpath.setText(contents['show_path'])
     location = '...%s' % (contents['location'].split(
         contents['show_path'])[-1])
     self.label_location.setText(location)
     self.textedit_description.setText(contents['description'])
     size = self.button_thumbnail.minimumSize()
     thumbnail_icon = contents['thumbnail']
     if not os.path.isfile(thumbnail_icon):
         thumbnail_icon = os.path.join(resource.getIconPath(),
                                       'unknown.png')
     swidgets.image_to_button(self.button_thumbnail,
                              size.width(),
                              size.height(),
                              path=thumbnail_icon)
Пример #6
0
 def setup_default(self):
     self.load_captions(input_data=None)
     swidgets.image_to_button(self.button_thumbnail,
                              256,
                              180,
                              path=os.path.join(resource.getIconPath(),
                                                'unknown.png'))
Пример #7
0
def add_listwidget_item(parent, label, key=None, icon_path=None):
    item = QtWidgets.QListWidgetItem()
    parent.addItem(item)
    item.setText(label)
    if key:
        item.setStatusTip(key)            
    icon = QtGui.QIcon()
    
    if not icon_path:
        icon_path = os.path.join(resource.getIconPath(), 'unknown.png')
    if not os.path.isfile(icon_path) and os.path.isabs(icon_path):
        icon_path = os.path.join(resource.getIconPath(), 'unknown.png')
    
    icon.addPixmap(QtGui.QPixmap(icon_path), QtGui.QIcon.Normal, QtGui.QIcon.Off)
    item.setIcon(icon)
    item.setTextAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignBottom)       
Пример #8
0
def image_to_button(button, width, height, path=None):  # **
    if not path:
        path = os.path.join(resource.getIconPath(), 'unknown.png')
    icon = QtGui.QIcon()
    icon.addPixmap(
        QtGui.QPixmap(path),
        QtGui.QIcon.Normal, QtGui.QIcon.Off
    )
    button.setIcon(icon)
    button.setIconSize(QtCore.QSize(width, height)) 
Пример #9
0
 def set_dependency(self, caption):
     self.combobox_dependency.clear()
     dependency, dependencies = self.get_dependencies(
         caption, self.pipe_ids)
     icon_path = os.path.join(resource.getIconPath(), 'tick.png')
     for each in dependencies:
         if each == dependency:
             icon = QtGui.QIcon()
             icon.addPixmap(QtGui.QPixmap(icon_path), QtGui.QIcon.Normal,
                            QtGui.QIcon.Off)
             self.combobox_dependency.addItem(icon, each)
         else:
             self.combobox_dependency.addItem(each)
Пример #10
0
 def set_current_show(self):
     self.combobox_pipe.clear()
     if self.combobox_show.currentText() == 'None':
         return
     pipes = sorted(resource.getPipeData()['pipe'].keys())
     self.combobox_pipe.addItem('None')
     for pipe in pipes:
         icon_path = os.path.join(resource.getIconPath(), '%s.png' % pipe)
         icon = QtGui.QIcon()
         icon.addPixmap(QtGui.QPixmap(icon_path), QtGui.QIcon.Normal,
                        QtGui.QIcon.Off)
         self.combobox_pipe.addItem(icon, pipe)
     current_show = self.combobox_show.currentText().encode()
     environ = studioEnviron.Environ(current_show)
     show_icon, valid = environ.get_environ_value('SHOW_ICON')
     if not show_icon:
         show_icon = os.path.join(resource.getIconPath(), 'show.png')
     size = self.button_show.minimumSize()
     swidgets.image_to_button(self.button_show,
                              size.width(),
                              size.height(),
                              path=show_icon)
Пример #11
0
def add_treewidget_item(parent, label, icon=None, foreground=None):
    item = QtWidgets.QTreeWidgetItem (parent)
    item.setText (0, label)
    if icon:      
        icon_path = os.path.join(resource.getIconPath(), '{}.png'.format(icon))
        icon = QtGui.QIcon ()
        icon.addPixmap(QtGui.QPixmap(icon_path), QtGui.QIcon.Normal, QtGui.QIcon.Off)           
        item.setIcon (0, icon)
    if foreground:
        r, g, b = foreground
        brush = QtGui.QBrush(QtGui.QColor(r, g, b))
        brush.setStyle(QtCore.Qt.NoBrush)
        item.setForeground(0, brush)
    return item
Пример #12
0
 def set_default(self):
     self.clear_widget()
     self.setup_current_maya()
     captions = self.spipe.get_castingsheet_captions()
     captions = [''] + captions
     self.combobox_caption.addItems(captions)
     self.combobox_subfield.addItems(self.spipe.pipe_inputs['subfield']['values'])
     self.combobox_version.addItems(['major', 'minor', 'patch'])            
     size = self.button_thumbnail.minimumSize()
     swidgets.image_to_button(
         self.button_thumbnail,
         size.width(),
         size.height(),
         path=os.path.join(resource.getIconPath(), 'screenshot.png')
         )
Пример #13
0
 def setup_default(self):
     self.label_caption.clear()
     self.label_tag.clear()
     self.label_type.clear()
     self.label_user.clear()
     self.label_modified.clear()
     self.label_showpath.clear()
     self.label_location.clear()
     self.textedit_description.clear()
     size = self.button_thumbnail.minimumSize()
     thumbnail_icon = os.path.join(resource.getIconPath(), 'thumbnail.png')
     swidgets.image_to_button(self.button_thumbnail,
                              size.width(),
                              size.height(),
                              path=thumbnail_icon)
Пример #14
0
 def set_default(self):
     self.clear_widget()
     self.setup_current_maya()
     pub_data = self.spipe.get()
     captions = ['']
     if pub_data:  # add caption from database
         captions = [''] + pub_data.keys()
     self.combobox_caption.addItems(captions)
     self.combobox_subfield.addItems(
         self.spipe.pipe_inputs['subfield']['values'])
     self.combobox_type.addItems(self.spipe.pipe_inputs['type']['values'])
     self.combobox_tag.addItems(self.spipe.pipe_inputs['tag']['values'])
     self.combobox_version.addItems(['major', 'minor', 'patch'])
     size = self.button_thumbnail.minimumSize()
     swidgets.image_to_button(self.button_thumbnail,
                              size.width(),
                              size.height(),
                              path=os.path.join(resource.getIconPath(),
                                                'screenshot.png'))
Пример #15
0
 def set_catalogue(self, **kwargs):
     self.setup_default()
     self.label_caption.setText(kwargs['caption'])
     self.label_tag.setText(kwargs['tag'])
     self.label_type.setText(kwargs['type'])
     self.label_user.setText(kwargs['user'])
     self.label_modified.setText(kwargs['modified'])
     self.label_showpath.setText(kwargs['show_path'])
     location = '...%s' % (kwargs['location'].split(
         kwargs['show_path'])[-1])
     self.label_location.setText(location)
     self.textedit_description.setText(kwargs['description'])
     size = self.button_thumbnail.minimumSize()
     thumbnail_icon = kwargs['thumbnail']
     if not os.path.isfile(thumbnail_icon):
         thumbnail_icon = os.path.join(resource.getIconPath(),
                                       'unknown.png')
     swidgets.image_to_button(self.button_thumbnail,
                              size.width(),
                              size.height(),
                              path=thumbnail_icon)
Пример #16
0
def _set_header(layout, show_icon=None):  # **
    button_logo = QtWidgets.QPushButton(None)
    button_logo.setFlat(True)
    button_logo.setObjectName('button_logo')
    button_logo.setMinimumSize(QtCore.QSize(350, 99))
    button_logo.setMaximumSize(QtCore.QSize(350, 99))                
    logo_path = os.path.join(resource.getIconPath(), 'logo.png')        
    image_to_button(button_logo, 350, 99, path=logo_path)
    layout.addWidget(button_logo)       
    spacer_item = QtWidgets.QSpacerItem(
        40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
    layout.addItem(spacer_item)    
    button_show = QtWidgets.QPushButton(None)
    button_show.setFlat(True)
    button_show.setObjectName('button_show')
    button_show.setMinimumSize(QtCore.QSize(176, 99))
    button_show.setMaximumSize(QtCore.QSize(176, 99))
    if show_icon:
        image_to_button(button_show, 176, 99, path=show_icon)            
    layout.addWidget(button_show)
    return button_logo, button_show
Пример #17
0
def create_menu():
    tool_kit_path = resource.getMayaToolKitPath()
    icon_path = resource.getIconPath()
    modules = common.get_modules(tool_kit_path, module_types=['maya_tool'])
    if 'maya_tool' not in modules:
        core.displayWarning('Failed!...  not found any toolkits')
        return
    maya_modules = modules['maya_tool']
    studio_uv_menu = make_menu(MENU_NAME, MENU_LABEL)
    for index, module in maya_modules.items():
        lable = module.NAME
        if hasattr(module, 'SEPARATOR'):
            if module.SEPARATOR:
                core.ui.MenuItem(d=True, p=studio_uv_menu)
        module_icon = 'unknown.png'
        if hasattr(module, 'ICON'):
            module_icon = module.ICON
        core.ui.MenuItem(l=module.NAME,
                         p=studio_uv_menu,
                         i=os.path.join(icon_path, module_icon),
                         c=partial(executeModule, module))
    core.displayInfo('// Result: %s menu created' % MENU_LABEL)
Пример #18
0
def update_widget_icon(item, icon_name):
    icon_path = os.path.join(resource.getIconPath(), icon_name)
    icon = QtGui.QIcon ()
    icon.addPixmap(QtGui.QPixmap(icon_path), QtGui.QIcon.Normal, QtGui.QIcon.Off)           
    item.setIcon (icon)  
Пример #19
0
def update_treewidget_item_icon(item, icon_name):
    icon_path = os.path.join(resource.getIconPath(), '{}.png'.format(icon_name))
    icon = QtGui.QIcon ()
    icon.addPixmap(QtGui.QPixmap(icon_path), QtGui.QIcon.Normal, QtGui.QIcon.Off)           
    item.setIcon (0, icon)  
Пример #20
0
 def setup_ui(self):
     self.setObjectName('widget_asset_push')
     self.resize(self.width, self.height)
     self.verticallayout = QtWidgets.QVBoxLayout(self)
     self.verticallayout.setObjectName('verticallayout')
     self.verticallayout.setSpacing(10)
     self.verticallayout.setContentsMargins(5, 5, 5, 5)
     self.verticallayout_item, self.button_show = swidgets.set_header(
         self, self.title, self.verticallayout, show_icon=self.show_icon)
     self.horizontallayout_output = QtWidgets.QHBoxLayout()
     self.horizontallayout_output.setObjectName('horizontallayout_output')
     self.horizontallayout_output.setSpacing(10)
     self.horizontallayout_output.setContentsMargins(5, 5, 5, 5)
     self.verticallayout_item.addLayout(self.horizontallayout_output)
     source_file = 'Current File: {}\nFile Type: {}'.format(None, None)
     self.label_source = QtWidgets.QLabel()
     self.label_source.setObjectName('label_source')
     self.label_source.setAlignment(QtCore.Qt.AlignRight
                                    | QtCore.Qt.AlignVCenter)
     self.label_source.setStyleSheet('font: 8pt;')
     self.label_source.setText(source_file)
     self.label_source.setToolTip(None)
     self.label_source.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
     self.label_source.customContextMenuRequested.connect(
         partial(self.on_context_menu, 'maya', self.label_source))
     self.horizontallayout_output.addWidget(self.label_source)
     self.horizontallayout_input = QtWidgets.QHBoxLayout()
     self.horizontallayout_input.setContentsMargins(5, 5, 5, 5)
     self.horizontallayout_input.setObjectName('horizontallayout_input')
     self.verticallayout_item.addLayout(self.horizontallayout_input)
     self.gridlayout = QtWidgets.QGridLayout(None)
     self.gridlayout.setObjectName('gridlayout')
     self.gridlayout.setSpacing(5)
     self.gridlayout.setContentsMargins(10, 0, 0, 0)
     self.verticallayout_item.addLayout(self.gridlayout)
     spacer_item = QtWidgets.QSpacerItem(20, 40,
                                         QtWidgets.QSizePolicy.Minimum,
                                         QtWidgets.QSizePolicy.Expanding)
     self.verticallayout.addItem(spacer_item)
     self.label_caption = QtWidgets.QLabel(self)
     self.label_caption.setObjectName('label_caption')
     self.label_caption.setText('Caption')
     self.label_caption.setAlignment(QtCore.Qt.AlignRight
                                     | QtCore.Qt.AlignVCenter)
     self.gridlayout.addWidget(self.label_caption, 0, 0, 1, 1)
     self.combobox_caption = QtWidgets.QComboBox(self)
     self.combobox_caption.setObjectName('combobox_caption')
     self.combobox_caption.setEditable(True)
     self.combobox_caption.setEnabled(True)
     self.combobox_caption.setInsertPolicy(QtWidgets.QComboBox.NoInsert)
     self.gridlayout.addWidget(self.combobox_caption, 0, 1, 1, 1)
     self.label_subfield = QtWidgets.QLabel(self)
     self.label_subfield.setObjectName('label_subfield')
     self.label_subfield.setText('Subfield')
     self.label_subfield.setAlignment(QtCore.Qt.AlignRight
                                      | QtCore.Qt.AlignVCenter)
     self.gridlayout.addWidget(self.label_subfield, 1, 0, 1, 1)
     self.combobox_subfield = QtWidgets.QComboBox(self)
     self.combobox_subfield.setObjectName('combobox_subfield')
     self.combobox_subfield.setEditable(True)
     self.combobox_subfield.setEnabled(True)
     self.combobox_subfield.setInsertPolicy(QtWidgets.QComboBox.NoInsert)
     self.gridlayout.addWidget(self.combobox_subfield, 1, 1, 1, 1)
     self.label_type = QtWidgets.QLabel(self)
     self.label_type.setObjectName('label_type')
     self.label_type.setText('Type')
     self.label_type.setAlignment(QtCore.Qt.AlignRight
                                  | QtCore.Qt.AlignVCenter)
     self.gridlayout.addWidget(self.label_type, 2, 0, 1, 1)
     self.combobox_type = QtWidgets.QComboBox(self)
     self.combobox_type.setObjectName('combobox_type')
     self.combobox_type.setEditable(True)
     self.combobox_type.setEnabled(True)
     self.combobox_type.setInsertPolicy(QtWidgets.QComboBox.NoInsert)
     self.gridlayout.addWidget(self.combobox_type, 2, 1, 1, 1)
     self.label_tag = QtWidgets.QLabel(self)
     self.label_tag.setObjectName('label_tag')
     self.label_tag.setText('Tag')
     self.label_tag.setAlignment(QtCore.Qt.AlignRight
                                 | QtCore.Qt.AlignVCenter)
     self.gridlayout.addWidget(self.label_tag, 3, 0, 1, 1)
     self.combobox_tag = QtWidgets.QComboBox(self)
     self.combobox_tag.setObjectName('combobox_tag')
     self.combobox_tag.setEditable(True)
     self.combobox_tag.setEnabled(True)
     self.combobox_tag.setInsertPolicy(QtWidgets.QComboBox.NoInsert)
     self.gridlayout.addWidget(self.combobox_tag, 3, 1, 1, 1)
     self.label_dependency = QtWidgets.QLabel(self)
     self.label_dependency.setObjectName('label_dependency')
     self.label_dependency.setText('Available Model Dependencies')
     self.label_dependency.setAlignment(QtCore.Qt.AlignRight
                                        | QtCore.Qt.AlignVCenter)
     self.gridlayout.addWidget(self.label_dependency, 4, 0, 1, 1)
     self.combobox_dependency = QtWidgets.QComboBox(self)
     self.combobox_dependency.setObjectName('combobox_dependency')
     self.combobox_dependency.setEditable(True)
     self.combobox_dependency.setEnabled(True)
     self.combobox_dependency.setInsertPolicy(QtWidgets.QComboBox.NoInsert)
     self.gridlayout.addWidget(self.combobox_dependency, 4, 1, 1, 1)
     self.label_thumbnail = QtWidgets.QLabel(self)
     self.label_thumbnail.setObjectName('label_thumbnail')
     self.label_thumbnail.setText('Thumbnail')
     self.label_thumbnail.setAlignment(QtCore.Qt.AlignRight
                                       | QtCore.Qt.AlignVCenter)
     self.gridlayout.addWidget(self.label_thumbnail, 5, 0, 1, 1)
     self.button_thumbnail = QtWidgets.QPushButton(self)
     self.button_thumbnail.setObjectName('button_thumbnail')
     size_policy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                         QtWidgets.QSizePolicy.Preferred)
     self.button_thumbnail.setSizePolicy(size_policy)
     self.button_thumbnail.setMinimumSize(QtCore.QSize(256, 180))
     self.button_thumbnail.setMaximumSize(QtCore.QSize(256, 180))
     self.button_thumbnail.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
     self.button_thumbnail.customContextMenuRequested.connect(
         partial(self.on_context_menu, 'image', self.button_thumbnail))
     swidgets.image_to_button(self.button_thumbnail,
                              256,
                              180,
                              path=os.path.join(resource.getIconPath(),
                                                'screenshot.png'))
     self.button_thumbnail.clicked.connect(
         partial(self.take_thumbnail, self.button_thumbnail))
     self.gridlayout.addWidget(self.button_thumbnail, 5, 1, 1, 1)
     self.label_description = QtWidgets.QLabel(self)
     self.label_description.setObjectName('label_description')
     self.label_description.setText('Description')
     self.label_description.setAlignment(QtCore.Qt.AlignRight
                                         | QtCore.Qt.AlignVCenter)
     self.gridlayout.addWidget(self.label_description, 6, 0, 1, 1)
     self.textedit_description = QtWidgets.QTextEdit(self)
     self.textedit_description.setObjectName('textedit_description')
     size_policy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                         QtWidgets.QSizePolicy.Preferred)
     self.textedit_description.setSizePolicy(size_policy)
     self.textedit_description.setMinimumSize(QtCore.QSize(0, 90))
     self.textedit_description.setMaximumSize(QtCore.QSize(16777215, 90))
     self.gridlayout.addWidget(self.textedit_description, 6, 1, 1, 1)
     self.label_version = QtWidgets.QLabel(self)
     self.label_version.setObjectName('label_version')
     self.label_version.setText('version')
     self.label_version.setAlignment(QtCore.Qt.AlignRight
                                     | QtCore.Qt.AlignVCenter)
     self.gridlayout.addWidget(self.label_version, 7, 0, 1, 1)
     self.combobox_version = QtWidgets.QComboBox(self)
     self.combobox_version.setObjectName('combobox_version')
     self.combobox_version.setEditable(True)
     self.combobox_version.setEnabled(True)
     self.combobox_version.setInsertPolicy(QtWidgets.QComboBox.NoInsert)
     self.gridlayout.addWidget(self.combobox_version, 7, 1, 1, 1)
     self.label_latest_version = QtWidgets.QLabel(self)
     self.label_latest_version.setObjectName('label_latest_version')
     self.label_latest_version.setText('Latest Version')
     self.label_latest_version.setAlignment(QtCore.Qt.AlignRight
                                            | QtCore.Qt.AlignVCenter)
     self.gridlayout.addWidget(self.label_latest_version, 8, 0, 1, 1)
     self.combobox_latest_version = QtWidgets.QComboBox(self)
     self.combobox_latest_version.setObjectName('combobox_latest_version')
     self.combobox_latest_version.setEditable(True)
     self.combobox_latest_version.setEnabled(False)
     self.combobox_latest_version.setInsertPolicy(
         QtWidgets.QComboBox.NoInsert)
     self.gridlayout.addWidget(self.combobox_latest_version, 8, 1, 1, 1)
     self.label_next_version = QtWidgets.QLabel(self)
     self.label_next_version.setObjectName('label_next_version')
     self.label_next_version.setText('Next Version')
     self.label_next_version.setAlignment(QtCore.Qt.AlignRight
                                          | QtCore.Qt.AlignVCenter)
     self.gridlayout.addWidget(self.label_next_version, 9, 0, 1, 1)
     self.combobox_next_version = QtWidgets.QComboBox(self)
     self.combobox_next_version.setObjectName('combobox_next_version')
     self.combobox_next_version.setEditable(True)
     self.combobox_next_version.setEnabled(False)
     self.combobox_next_version.setInsertPolicy(
         QtWidgets.QComboBox.NoInsert)
     self.gridlayout.addWidget(self.combobox_next_version, 9, 1, 1, 1)
     self.horizontallayout_button = QtWidgets.QHBoxLayout()
     self.horizontallayout_button.setObjectName('horizontallayout_button')
     self.horizontallayout_button.setSpacing(10)
     self.horizontallayout_button.setContentsMargins(5, 5, 5, 5)
     self.verticallayout.addLayout(self.horizontallayout_button)
     spacer_item = QtWidgets.QSpacerItem(40, 20,
                                         QtWidgets.QSizePolicy.Expanding,
                                         QtWidgets.QSizePolicy.Minimum)
     self.horizontallayout_button.addItem(spacer_item)
     self.button_cancel = QtWidgets.QPushButton(self)
     self.button_cancel.setObjectName('button_cancel')
     self.button_cancel.setText('Cancel')
     self.horizontallayout_button.addWidget(self.button_cancel)
     self.button_publish = QtWidgets.QPushButton(self)
     self.button_publish.setObjectName('button_create')
     self.button_publish.setText('Publish')
     self.horizontallayout_button.addWidget(self.button_publish)
     spacer_item = QtWidgets.QSpacerItem(20, 40,
                                         QtWidgets.QSizePolicy.Minimum,
                                         QtWidgets.QSizePolicy.Expanding)
     self.combobox_caption.editTextChanged.connect(self.set_current_caption)
     self.combobox_subfield.currentIndexChanged.connect(
         self.set_current_version)
     self.combobox_version.currentIndexChanged.connect(
         self.set_current_version)
     self.button_publish.clicked.connect(self.do_publish)
     self.button_cancel.clicked.connect(self.close)
Пример #21
0
 def setup_ui(self):
     self.setObjectName('mainwindow_asset_composition')
     self.resize(self.width, self.height)
     self.centralwidget = QtWidgets.QWidget(self)
     self.centralwidget.setObjectName('centralwidget')
     self.setCentralWidget(self.centralwidget)
     self.verticallayout = QtWidgets.QVBoxLayout(self.centralwidget)
     self.verticallayout.setObjectName('verticallayout')
     self.verticallayout.setSpacing(0)
     self.verticallayout.setContentsMargins(5, 5, 5, 5)  
     
     self.verticallayout_item, self.button_show = swidgets.set_header(
         self, self.title, self.verticallayout, show_icon=self.show_icon)            
     
     
     
     self.splitter = QtWidgets.QSplitter(self)
     self.splitter.setObjectName("splitter")        
     self.splitter.setOrientation(QtCore.Qt.Horizontal)
     self.verticallayout_item.addWidget(self.splitter)
     self.layout_widget = QtWidgets.QWidget(self.splitter)
     self.layout_widget.setObjectName("layout_widget")        
     self.gridlayout = QtWidgets.QGridLayout(self.layout_widget)
     self.gridlayout.setObjectName('gridlayout')
     self.label_caption = QtWidgets.QLabel(self)
     self.label_caption.setObjectName('label_caption')
     self.label_caption.setText('Caption')
     self.label_caption.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
     self.gridlayout.addWidget(self.label_caption, 0, 0, 1, 1)
     self.combobox_caption = QtWidgets.QComboBox(self)
     self.combobox_caption.setObjectName('combobox_caption')
     self.combobox_caption.setEditable(True)
     self.combobox_caption.setEnabled(True)
     self.combobox_caption.setInsertPolicy(QtWidgets.QComboBox.NoInsert)
     self.gridlayout.addWidget(self.combobox_caption, 0, 1, 1, 1) 
     self.label_composition = QtWidgets.QLabel(self)
     self.label_composition.setObjectName('label_composition')
     self.label_composition.setText('Composition')
     self.label_composition.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
     self.gridlayout.addWidget(self.label_composition, 2, 0, 1, 1)
     self.treewidget_composition = QtWidgets.QTreeWidget(self)
     self.treewidget_composition.setObjectName('treewidget_composition')
     self.treewidget_composition.header().setVisible(False)
     self.treewidget_composition.setStyleSheet('font: 9pt \'Sans Serif\';')
     self.treewidget_composition.setAlternatingRowColors(True)   
     self.treewidget_composition.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
     self.treewidget_composition.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)        
     self.treewidget_composition.customContextMenuRequested.connect(
         partial(self.on_context_menu, self.treewidget_composition))                 
     self.gridlayout.addWidget(self.treewidget_composition, 2, 1, 1, 1)
     self.label_thumbnail = QtWidgets.QLabel(self)
     self.label_thumbnail.setObjectName('label_thumbnail')
     self.label_thumbnail.setText('Thumbnail')
     self.label_thumbnail.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
     self.gridlayout.addWidget(self.label_thumbnail, 3, 0, 1, 1)
     self.button_thumbnail = QtWidgets.QPushButton(self)
     self.button_thumbnail.setObjectName('button_thumbnail')
     size_policy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
     self.button_thumbnail.setSizePolicy(size_policy)
     self.button_thumbnail.setMinimumSize(QtCore.QSize(256, 180))
     self.button_thumbnail.setMaximumSize(QtCore.QSize(256, 180))
     screenshot_icon = os.path.join(resource.getIconPath(), 'screenshot.png')
     swidgets.image_to_button(
         self.button_thumbnail,
         256,
         180,
         path=screenshot_icon
         )
     self.button_thumbnail.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)        
     self.button_thumbnail.customContextMenuRequested.connect(
         partial(self.on_context_menu, self.button_thumbnail))  
     self.button_thumbnail.clicked.connect(partial(self.take_thumbnail, self.button_thumbnail))
     self.gridlayout.addWidget(self.button_thumbnail, 3, 1, 1, 1)  
     self.label_description = QtWidgets.QLabel(self)
     self.label_description.setObjectName('label_description')
     self.label_description.setText('Description')
     self.label_description.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
     self.gridlayout.addWidget(self.label_description, 4, 0, 1, 1)
     self.textedit_description = QtWidgets.QTextEdit(self)
     self.textedit_description.setObjectName('textedit_description')
     size_policy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
     self.textedit_description.setSizePolicy(size_policy)
     self.textedit_description.setMinimumSize(QtCore.QSize(0, 90))
     self.textedit_description.setMaximumSize(QtCore.QSize(16777215, 90))          
     self.gridlayout.addWidget(self.textedit_description, 4, 1, 1, 1)  
     self.label_version = QtWidgets.QLabel(self)
     self.label_version.setObjectName('label_version')
     self.label_version.setText('version')
     self.label_version.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
     self.gridlayout.addWidget(self.label_version, 5, 0, 1, 1)
     self.combobox_version = QtWidgets.QComboBox(self)
     self.combobox_version.setObjectName('combobox_version')
     self.combobox_version.setEditable(True)
     self.combobox_version.setEnabled(True)
     self.combobox_version.setInsertPolicy(QtWidgets.QComboBox.NoInsert)
     self.gridlayout.addWidget(self.combobox_version, 5, 1, 1, 1)                  
     self.label_latest_version = QtWidgets.QLabel(self)
     self.label_latest_version.setObjectName('label_latest_version')
     self.label_latest_version.setText('Latest Version')
     self.label_latest_version.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
     self.gridlayout.addWidget(self.label_latest_version, 6, 0, 1, 1)
     self.combobox_latest_version = QtWidgets.QComboBox(self)
     self.combobox_latest_version.setObjectName('combobox_latest_version')
     self.combobox_latest_version.setEditable(True)
     self.combobox_latest_version.setEnabled(False)
     self.combobox_latest_version.setInsertPolicy(QtWidgets.QComboBox.NoInsert)
     self.gridlayout.addWidget(self.combobox_latest_version, 6, 1, 1, 1)
     self.label_next_version = QtWidgets.QLabel(self)
     self.label_next_version.setObjectName('label_next_version')
     self.label_next_version.setText('Next Version')
     self.label_next_version.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
     self.gridlayout.addWidget(self.label_next_version, 7, 0, 1, 1)
     self.combobox_next_version = QtWidgets.QComboBox(self)
     self.combobox_next_version.setObjectName('combobox_next_version')
     self.combobox_next_version.setEditable(True)
     self.combobox_next_version.setEnabled(False)
     self.combobox_next_version.setInsertPolicy(QtWidgets.QComboBox.NoInsert)
     self.gridlayout.addWidget(self.combobox_next_version, 7, 1, 1, 1)  
     self.treewidget_input = QtWidgets.QTreeWidget(self.splitter)
     self.treewidget_input.setObjectName('treewidget_input')
     self.treewidget_input.header().setVisible(False)
     self.treewidget_input.setStyleSheet('font: 12pt \'Sans Serif\';')
     self.treewidget_input.setAlternatingRowColors(True)
     self.treewidget_input.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
     self.treewidget_input.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)        
     self.treewidget_input.customContextMenuRequested.connect(
         partial(self.on_context_menu, self.treewidget_input))        
     self.treewidget_input.currentItemChanged.connect(self.current_catalogue_select)        
     self.splitter.addWidget(self.comp_catalogue)
     self.horizontallayout_button = QtWidgets.QHBoxLayout()
     self.horizontallayout_button.setObjectName('horizontallayout_button')
     self.horizontallayout_button.setSpacing(10)
     self.horizontallayout_button.setContentsMargins(5, 5, 5, 5)        
     self.verticallayout.addLayout(self.horizontallayout_button)  
     spacer_item = QtWidgets.QSpacerItem(
         40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
     self.horizontallayout_button.addItem(spacer_item)
     self.button_cancel = QtWidgets.QPushButton(self)
     self.button_cancel.setObjectName('button_cancel')
     self.button_cancel.setText('cancel')
     self.horizontallayout_button.addWidget(self.button_cancel)
     self.button_publish = QtWidgets.QPushButton(self)
     self.button_publish.setObjectName('button_publish')
     self.button_publish.setText('publish')
     self.horizontallayout_button.addWidget(self.button_publish)
 
     self.button_cancel.clicked.connect(self.close)     
     self.button_publish.clicked.connect(self.publish)
     self.combobox_caption.editTextChanged.connect(self.set_current_caption)
     self.combobox_version.currentIndexChanged.connect(self.set_current_version)        
     self.splitter.setSizes ([373, 350, 272])