예제 #1
0
 def load_publish_to_layout(self, listwidget, items):
     publish_files = []
     for each_item in items:
         curren_path = each_item.toolTip(0)
         if not os.path.isdir(curren_path):
             continue
         publish_datas = os.listdir(curren_path)
         for each_publish in publish_datas:
             if not os.path.isfile(os.path.join(curren_path, each_publish)):
                 continue
             if not each_publish.endswith('.%s' % self.publish_format):
                 continue
             publish_files.append(os.path.join(curren_path, each_publish))
     listwidget.clear()
     for each_file in publish_files:
         item = QtWidgets.QListWidgetItem()
         listwidget.addItem(item)
         label = os.path.basename(os.path.splitext(each_file)[0])
         item.setText(label)
         item.setToolTip(each_file)
         icon = QtGui.QIcon()
         icon_path = each_file.replace('.%s' % self.publish_format,
                                       '.%s' % self.image_format)
         if not os.path.isfile(icon_path):
             icon_path = os.path.join(resources.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)
         thread.start_new_thread(self.validte_asset_publish, (
             each_file,
             item,
         ))
예제 #2
0
 def __init__(self, path=None, name=None, format='png'):
     self.name = name
     self.format = format
     if not path:
         self.image_file = os.path.join(
             tempfile.gettempdir(),
             'studio_image_snapshot.%s' % self.format)
     elif path and name:
         self.image_file = os.path.join(path, '%s.%s' % (name, format))
     self.unknown_icon = os.path.join(resources.getIconPath(),
                                      'unknown.png')
예제 #3
0
 def set_icons(self):
     actions = self.findChildren(QtWidgets.QAction)
     buttons = self.findChildren(QtWidgets.QPushButton)
     for each_action in actions + buttons:
         objectName = each_action.objectName()
         if not objectName:
             continue
         current_icon = '{}.png'.format(objectName.split('_')[-1])
         icon_path = os.path.join(resources.getIconPath(), current_icon)
         icon = QtGui.QIcon()
         icon.addPixmap(QtGui.QPixmap(icon_path), QtGui.QIcon.Normal,
                        QtGui.QIcon.Off)
         each_action.setIcon(icon)
예제 #4
0
 def image_to_button(self, button=None, path=None, width=None, height=None):
     if not button:
         button = self.button_snapshot
     if not path:
         path = os.path.join(resources.getIconPath(), 'snapshot.png')
     if not width:
         width = self._width
     if not height:
         height = self._height
     icon = QtGui.QIcon()
     icon.addPixmap(QtGui.QPixmap(path), QtGui.QIcon.Normal,
                    QtGui.QIcon.Off)
     button.setIcon(icon)
     button.setIconSize(QtCore.QSize(width - 5, height - 5))
예제 #5
0
 def __init__(self):
     self.folder_icon = os.path.join(resources.getIconPath(), 'folder.png')
예제 #6
0
 def setup_ui(self):
     self.resize(self.width, self.height)
     self.setStyleSheet('font: 12pt \"MS Shell Dlg 2\";')
     self.setObjectName('mainwindow_%s' % self.tool_kit_object)
     self.setWindowTitle(self.tool_kit_titile)
     title_icon = os.path.join(resources.getIconPath(), 'title.png')
     self.setWindowIcon(QtGui.QIcon(title_icon))
     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.addWidget(self.catalogue.splitter)
     self.catalogue.splitter.addWidget(self.asset.groupbox_asset)
     self.treewidget = self.catalogue.treewidget_folder
     self.listwidget = self.catalogue.listwidget_catalogue
     self.label_filepath = self.asset.label_filepath
     self.lineedit_filepath = self.asset.lineedit_filepath
     self.pushbutton_filepath = self.asset.pushbutton_filepath
     self.label_imagepath = self.asset.label_imagepath
     self.lineedit_imagepath = self.asset.lineedit_imagepath
     self.pushbutton_imagepath = self.asset.pushbutton_imagepath
     self.lineedit_label = self.asset.lineedit_label
     self.button_publish = self.asset.button_publish
     self.button_build = self.asset.button_build
     self.textedit_history = self.asset.textedit_history
     self.button_snapshot = self.asset.button_snapshot
     self.textedit_console = self.asset.textedit_console
     self.pushbutton_filepath = self.asset.pushbutton_filepath
     self.groupbox_path = self.asset.groupbox_path
     if not self.standalone:
         self.textedit_console.hide()
         self.pushbutton_filepath.setContextMenuPolicy(
             QtCore.Qt.CustomContextMenu)
         self.pushbutton_filepath.customContextMenuRequested.connect(
             partial(self.on_context_path, self.pushbutton_filepath))
         self.path_menu = QtWidgets.QMenu(self)
         self.action_scene = QtWidgets.QAction(self)
         self.action_scene.setObjectName('action_scene')
         self.action_scene.setText('Current Scene')
         self.path_menu.addAction(self.action_scene)
         self.action_scene.triggered.connect(
             partial(self.set_current_scene, self.lineedit_filepath))
     self.treewidget.itemClicked.connect(
         partial(self.load_current_folder, self.treewidget))
     self.button_snapshot.clicked.connect(
         partial(self.snapshot, self.button_snapshot))
     self.lineedit_label.returnPressed.connect(
         partial(self.rename_model, self.lineedit_label))
     self.listwidget.itemClicked.connect(
         partial(self.builds, 'load', self.listwidget))
     self.listwidget.itemSelectionChanged.connect(
         partial(self.builds, 'load', self.listwidget))
     self.button_build.clicked.connect(
         partial(self.builds, 'build', self.listwidget))
     # self.listwidget.itemDoubleClicked.connect(
     #     partial(self.builds, 'build', self.listwidget))
     self.pushbutton_filepath.clicked.connect(
         partial(self.set_source_file_path, self.lineedit_filepath))
     self.pushbutton_imagepath.clicked.connect(
         partial(self.set_source_image_path, self.lineedit_imagepath))
     self.treewidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
     self.treewidget.customContextMenuRequested.connect(
         partial(self.on_context_menu, self.treewidget))
     self.menu_bar = QtWidgets.QMenuBar(self)
     self.menu_bar.setGeometry(QtCore.QRect(0, 0, 960, 25))
     self.menu_bar.setObjectName('menu_bar')
     self.setMenuBar(self.menu_bar)
     self.menu_file = QtWidgets.QMenu(self.menu_bar)
     self.menu_file.setObjectName('menu_file')
     self.menu_file.setTitle('File')
     self.menu_settings = QtWidgets.QMenu(self.menu_bar)
     self.menu_settings.setObjectName('menu_settings')
     self.menu_settings.setTitle('Settings')
     self.menu_help = QtWidgets.QMenu(self.menu_bar)
     self.menu_help.setObjectName('menu_help')
     self.menu_help.setTitle('Help')
     self.action_create = QtWidgets.QAction(self)
     self.action_create.setObjectName('action_create')
     self.action_create.setText('Create Folder')
     self.menu_default = QtWidgets.QMenu(self.menu_file)
     self.menu_default.setObjectName('menu_default')
     self.menu_default.setTitle('Default Folders')
     self.default_menu(self.menu_default)
     self.action_remove = QtWidgets.QAction(self)
     self.action_remove.setObjectName('action_remove')
     self.action_remove.setText('Remove Folder')
     self.action_rename = QtWidgets.QAction(self)
     self.action_rename.setObjectName('action_rename')
     self.action_rename.setText('Rename Folder')
     self.action_refresh = QtWidgets.QAction(self)
     self.action_refresh.setObjectName('action_refresh')
     self.action_refresh.setText('Refresh')
     self.action_expand = QtWidgets.QAction(self)
     self.action_expand.setObjectName('action_expand')
     self.action_expand.setText('Expand')
     self.action_collapse = QtWidgets.QAction(self)
     self.action_collapse.setObjectName('action_collapse')
     self.action_collapse.setText('Collapse')
     self.action_quit = QtWidgets.QAction(self)
     self.action_quit.setObjectName('action_quit')
     self.action_quit.setText('Quit')
     self.action_preferences = QtWidgets.QAction(self)
     self.action_preferences.setObjectName('action_preferences')
     self.action_preferences.setText('Preferences')
     self.action_aboutool = QtWidgets.QAction(self)
     self.action_aboutool.setObjectName('action_aboutool')
     self.action_aboutool.setText('About Tool')
     self.action_abouttoolkits = QtWidgets.QAction(self)
     self.action_abouttoolkits.setObjectName('action_abouttoolkits')
     self.action_abouttoolkits.setText('About Tool Kits')
     self.menu_bar.addAction(self.menu_file.menuAction())
     self.menu_bar.addAction(self.menu_settings.menuAction())
     self.menu_bar.addAction(self.menu_help.menuAction())
     self.menu_file.addAction(self.action_create)
     self.menu_file.addSeparator()
     self.menu_file.addAction(self.menu_default.menuAction())
     self.menu_file.addSeparator()
     self.menu_file.addAction(self.action_rename)
     self.menu_file.addAction(self.action_remove)
     self.menu_file.addSeparator()
     self.menu_file.addAction(self.action_refresh)
     self.menu_file.addSeparator()
     self.menu_file.addAction(self.action_quit)
     self.menu_settings.addAction(self.action_preferences)
     self.menu_help.addAction(self.action_aboutool)
     self.menu_help.addAction(self.action_abouttoolkits)
     self.action_preferences.triggered.connect(self.show_preference)
     self.action_create.triggered.connect(self.create)
     self.action_rename.triggered.connect(self.rename)
     self.action_remove.triggered.connect(self.remove)
     self.action_refresh.triggered.connect(self.refresh)
     self.action_quit.triggered.connect(self.close_library)
     self.action_expand.triggered.connect(
         partial(self.expand, self.treewidget))
     self.action_collapse.triggered.connect(
         partial(self.collapse, self.treewidget))
     self.asset.button_publish.clicked.connect(self.publish)
     self.preference.button_apply.clicked.connect(self.set_preference)
     self.preference.button_cancel.clicked.connect(self.cancel_preference)
     self.action_aboutool.triggered.connect(self.toolkit_help_link)
     self.action_abouttoolkits.triggered.connect(self.toolkit_link)
예제 #7
0
 def setup_ui(self):
     self.setObjectName('asset')
     self.resize(400, 600)
     self.setStyleSheet('font: 12pt \"MS Shell Dlg 2\";')
     self.verticallayout = QtWidgets.QVBoxLayout(self)
     self.verticallayout.setObjectName('verticallayout')
     self.verticallayout.setSpacing(10)
     self.verticallayout.setContentsMargins(10, 10, 10, 10)
     self.groupbox_asset = QtWidgets.QGroupBox(self)
     self.groupbox_asset.setObjectName('groupbox_asset')
     self.groupbox_asset.setTitle('Asset')
     self.verticallayout.addWidget(self.groupbox_asset)
     self.verticallayout_asset = QtWidgets.QVBoxLayout(self.groupbox_asset)
     self.verticallayout_asset.setObjectName('verticallayout_asset')
     self.verticallayout_asset.setSpacing(10)
     self.verticallayout_asset.setContentsMargins(10, 10, 10, 10)
     self.groupbox_snapshot = QtWidgets.QGroupBox(self.groupbox_asset)
     self.groupbox_snapshot.setObjectName('groupBox_snapshot')
     self.verticallayout_asset.addWidget(self.groupbox_snapshot)
     self.horizontallayout_snapshot = QtWidgets.QHBoxLayout(
         self.groupbox_snapshot)
     self.horizontallayout_snapshot.setObjectName(
         'horizontallayout_snapshot')
     self.horizontallayout_snapshot.setSpacing(10)
     self.horizontallayout_snapshot.setContentsMargins(10, 10, 10, 10)
     spacer_item = QtWidgets.QSpacerItem(40, 20,
                                         QtWidgets.QSizePolicy.Expanding,
                                         QtWidgets.QSizePolicy.Minimum)
     self.horizontallayout_snapshot.addItem(spacer_item)
     self.button_snapshot = QtWidgets.QPushButton(self.groupbox_snapshot)
     self.button_snapshot.setObjectName('button_snapshot')
     self.button_snapshot.setText('')
     size_policy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                         QtWidgets.QSizePolicy.Fixed)
     size_policy.setHorizontalStretch(0)
     size_policy.setVerticalStretch(0)
     size_policy.setHeightForWidth(
         self.button_snapshot.sizePolicy().hasHeightForWidth())
     self.button_snapshot.setSizePolicy(size_policy)
     self.button_snapshot.setMinimumSize(
         QtCore.QSize(self._width, self._height))
     self.button_snapshot.setMaximumSize(
         QtCore.QSize(self._width, self._height))
     self.horizontallayout_snapshot.addWidget(self.button_snapshot)
     self.image_to_button()
     spacer_item = QtWidgets.QSpacerItem(40, 20,
                                         QtWidgets.QSizePolicy.Expanding,
                                         QtWidgets.QSizePolicy.Minimum)
     self.horizontallayout_snapshot.addItem(spacer_item)
     self.groupbox_path = QtWidgets.QGroupBox(self.groupbox_asset)
     self.groupbox_path.setObjectName('groupbox_path')
     self.gridlayout_inputs = QtWidgets.QGridLayout(self.groupbox_path)
     self.gridlayout_inputs.setObjectName('gridLayout')
     self.gridlayout_inputs.setSpacing(10)
     self.gridlayout_inputs.setContentsMargins(10, 10, 10, 10)
     self.label_filepath = QtWidgets.QLabel(self.groupbox_asset)
     self.label_filepath.setObjectName('label_filepath')
     self.label_filepath.setText('File Path')
     self.label_filepath.setAlignment(QtCore.Qt.AlignRight
                                      | QtCore.Qt.AlignVCenter)
     self.gridlayout_inputs.addWidget(self.label_filepath, 0, 0, 1, 1)
     self.lineedit_filepath = QtWidgets.QLineEdit(self.groupbox_asset)
     self.lineedit_filepath.setObjectName('lineedit_filepath')
     self.gridlayout_inputs.addWidget(self.lineedit_filepath, 0, 1, 1, 1)
     self.pushbutton_filepath = QtWidgets.QPushButton(self.groupbox_asset)
     self.pushbutton_filepath.setObjectName('pushbutton_filepath')
     self.pushbutton_filepath.setText('...')
     self.gridlayout_inputs.addWidget(self.pushbutton_filepath, 0, 2, 1, 1)
     self.label_imagepath = QtWidgets.QLabel(self.groupbox_asset)
     self.label_imagepath.setObjectName('label_filepath')
     self.label_imagepath.setText('Image Path')
     self.label_imagepath.setAlignment(QtCore.Qt.AlignRight
                                       | QtCore.Qt.AlignVCenter)
     self.gridlayout_inputs.addWidget(self.label_imagepath, 1, 0, 1, 1)
     self.lineedit_imagepath = QtWidgets.QLineEdit(self.groupbox_asset)
     self.lineedit_imagepath.setObjectName('lineedit_imagepath')
     self.gridlayout_inputs.addWidget(self.lineedit_imagepath, 1, 1, 1, 1)
     self.pushbutton_imagepath = QtWidgets.QPushButton(self.groupbox_asset)
     self.pushbutton_imagepath.setObjectName('pushbutton_filepath')
     self.pushbutton_imagepath.setText('...')
     self.gridlayout_inputs.addWidget(self.pushbutton_imagepath, 1, 2, 1, 1)
     self.verticallayout_asset.addWidget(self.groupbox_path)
     self.groupbox_label = QtWidgets.QGroupBox(self.groupbox_asset)
     self.groupbox_label.setObjectName('groupbox_label')
     self.verticallayout_asset.addWidget(self.groupbox_label)
     self.horizontallayout_label = QtWidgets.QHBoxLayout(
         self.groupbox_label)
     self.horizontallayout_label.setObjectName('horizontallayout_label')
     self.horizontallayout_label.setSpacing(10)
     self.horizontallayout_label.setContentsMargins(10, 10, 10, 10)
     self.label_label = QtWidgets.QLabel(self.groupbox_label)
     self.label_label.setObjectName('label_label')
     self.label_label.setText('Name')
     self.horizontallayout_label.addWidget(self.label_label)
     self.lineedit_label = QtWidgets.QLineEdit(self.groupbox_label)
     self.lineedit_label.setObjectName('lineEdit_label')
     self.lineedit_label.setText('')
     self.horizontallayout_label.addWidget(self.lineedit_label)
     self.textedit_history = QtWidgets.QTextEdit(self.groupbox_asset)
     self.textedit_history.setObjectName('textedit_history')
     self.textedit_history.setStyleSheet('font: 10pt \"MS Shell Dlg 2\";')
     self.verticallayout_asset.addWidget(self.textedit_history)
     self.button_publish = QtWidgets.QPushButton(self.groupbox_asset)
     self.button_publish.setObjectName('button_publish')
     self.button_publish.setText('Publish')
     self.verticallayout_asset.addWidget(self.button_publish)
     self.button_build = QtWidgets.QPushButton(self.groupbox_asset)
     self.button_build.setObjectName('button_build')
     self.button_build.setText('Build')
     self.button_build.hide()
     self.verticallayout_asset.addWidget(self.button_build)
     self.button_logo = QtWidgets.QPushButton(self.groupbox_asset)
     self.button_logo.setObjectName('button_logo')
     self.button_logo.setFlat(True)
     self.button_logo.clicked.connect(self.subin_toolkits)
     log_path = os.path.join(resources.getIconPath(), 'logo.png')
     self.image_to_button(self.button_logo, log_path, self._width,
                          self._height)
     self.verticallayout_asset.addWidget(self.button_logo)
     self.label_subin = QtWidgets.QLabel(self.groupbox_asset)
     self.label_subin.setObjectName('label_logo')
     self.label_subin.setAlignment(QtCore.Qt.AlignCenter)
     self.label_subin.setText(
         'Author: Subin. Gopi\[email protected]\nwww.subins-toolkits.com\ncopyright(c) 2019, Subin Gopi'
     )
     self.label_subin.setStyleSheet('font: 11pt \"Sans Serif\";')
     self.verticallayout_asset.addWidget(self.label_subin)
     self.textedit_console = QtWidgets.QTextEdit(self.groupbox_asset)
     self.textedit_console.setObjectName('textedit_console')
     self.textedit_console.setStyleSheet('font: 10pt \"MS Shell Dlg 2\";')
     self.textedit_console.setMinimumSize(QtCore.QSize(0, 50))
     self.textedit_console.setMaximumSize(QtCore.QSize(16777215, 50))
     self.verticallayout_asset.addWidget(self.textedit_console)