示例#1
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')
示例#2
0
 def set_icons(self):
     actions = self.findChildren(QtGui.QAction)
     for each_action in actions:
         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)
示例#3
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))
示例#4
0
 def setup_ui(self):
     self.setObjectName('model')
     self.resize(400, 600)
     self.setStyleSheet('font: 12pt \"MS Shell Dlg 2\";')
     self.verticallayout = QtGui.QVBoxLayout(self)
     self.verticallayout.setObjectName('verticallayout')
     self.verticallayout.setSpacing(10)
     self.verticallayout.setContentsMargins(10, 10, 10, 10)
     self.groupbox_model = QtGui.QGroupBox(self)
     self.groupbox_model.setObjectName('groupbox_model')
     self.groupbox_model.setTitle('Model')
     self.verticallayout.addWidget(self.groupbox_model)
     self.verticallayout_model = QtGui.QVBoxLayout(self.groupbox_model)
     self.verticallayout_model.setObjectName('verticallayout_model')
     self.verticallayout_model.setSpacing(10)
     self.verticallayout_model.setContentsMargins(10, 10, 10, 10)
     self.groupbox_snapshot = QtGui.QGroupBox(self.groupbox_model)
     self.groupbox_snapshot.setObjectName('groupBox_snapshot')
     self.verticallayout_model.addWidget(self.groupbox_snapshot)
     self.horizontallayout_snapshot = QtGui.QHBoxLayout(
         self.groupbox_snapshot)
     self.horizontallayout_snapshot.setObjectName(
         'horizontallayout_snapshot')
     self.horizontallayout_snapshot.setSpacing(5)
     self.horizontallayout_snapshot.setContentsMargins(5, 5, 5, 5)
     spacer_item = QtGui.QSpacerItem(
         40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
     self.horizontallayout_snapshot.addItem(spacer_item)
     self.button_snapshot = QtGui.QPushButton(self.groupbox_snapshot)
     self.button_snapshot.setObjectName('button_snapshot')
     self.button_snapshot.setText('')
     size_policy = QtGui.QSizePolicy(
         QtGui.QSizePolicy.Fixed, QtGui.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 = QtGui.QSpacerItem(
         40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
     self.horizontallayout_snapshot.addItem(spacer_item)
     self.groupbox_label = QtGui.QGroupBox(self.groupbox_model)
     self.groupbox_label.setObjectName('groupbox_label')
     self.verticallayout_model.addWidget(self.groupbox_label)
     self.horizontallayout_label = QtGui.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 = QtGui.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 = QtGui.QLineEdit(self.groupbox_label)
     self.lineEdit_label.setObjectName('lineEdit_label')
     self.lineEdit_label.setText('')
     self.horizontallayout_label.addWidget(self.lineEdit_label)
     self.textedit_history = QtGui.QTextEdit(self.groupbox_model)
     self.textedit_history.setObjectName('textedit_history')
     self.textedit_history.setStyleSheet('font: 10pt \"MS Shell Dlg 2\";')
     self.verticallayout_model.addWidget(self.textedit_history)
     self.button_publish = QtGui.QPushButton(self.groupbox_model)
     self.button_publish.setObjectName('button_publish')
     self.button_publish.setText('Publish')
     self.verticallayout_model.addWidget(self.button_publish)
     self.checkbox_build = QtGui.QCheckBox(self.groupbox_model)
     self.checkbox_build.setObjectName('checkbox_build')
     self.checkbox_build.setText('Assign To Object')
     self.checkbox_build.setToolTip('Assign to the object, if object is exists')
     self.checkbox_build.hide()
     self.verticallayout_model.addWidget(self.checkbox_build)        
     self.checkbox_assign = QtGui.QCheckBox(self.groupbox_model)
     self.checkbox_assign.setObjectName('checkbox_assign')
     self.checkbox_assign.setText('Assign To Selected Object')
     self.checkbox_assign.setToolTip('Assign to selected object')
     self.checkbox_assign.hide()                
     self.verticallayout_model.addWidget(self.checkbox_assign)
     self.button_build = QtGui.QPushButton(self.groupbox_model)
     self.button_build.setObjectName('button_build')
     self.button_build.setText('Build')
     self.button_build.hide()
     self.verticallayout_model.addWidget(self.button_build)
     self.button_logo = QtGui.QPushButton(self.groupbox_model)
     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_model.addWidget(self.button_logo)
     self.label_subin = QtGui.QLabel(self.groupbox_model)
     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_model.addWidget(self.label_subin)
示例#5
0
 def __init__(self):
     self.folder_icon = os.path.join(resources.getIconPath(), 'folder.png')