我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用PySide.QtGui.QIcon()。
def setupUi(self): """Bruh""" self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.setGeometry(50, 50, 600, 300) self.setWindowTitle("ZeZe's TWTools - Backtiming Calculator") self.setWindowIcon(QtGui.QIcon(resource_path("images/icon.png"))) """Background color""" self.backgroundPalette = QtGui.QPalette() self.backgroundColor = QtGui.QColor(217, 204, 170) self.backgroundPalette.setColor( QtGui.QPalette.Background, self.backgroundColor) self.setPalette(self.backgroundPalette) """Main layout & return to main menu button""" self.verticalLayout = QtGui.QVBoxLayout(self) self.buttonLayout = QtGui.QHBoxLayout(self) self.verticalLayout.addLayout(self.buttonLayout) self.returnButton = QtGui.QPushButton(" Return to the Main Menu ", self) self.returnButton.clicked.connect(self.return_function) self.buttonLayout.addWidget(self.returnButton) self.buttonSpacer = QtGui.QSpacerItem(0, 0, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.buttonLayout.addItem(self.buttonSpacer)
def __init__(self, title, icon_path): self._title = title self._icon = QtGui.QIcon(icon_path) # IDA 7+ Widgets if using_ida7api: import sip self._form = idaapi.create_empty_widget(self._title) self._widget = sip.wrapinstance(long(self._form), QtWidgets.QWidget) # NOTE: LOL # legacy IDA PluginForm's else: self._form = idaapi.create_tform(self._title, None) if using_pyqt5: self._widget = idaapi.PluginForm.FormToPyQtWidget(self._form) else: self._widget = idaapi.PluginForm.FormToPySideWidget(self._form) self._widget.setWindowIcon(self._icon)
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.form = self self.form.setWindowTitle(u"Create drill center") self.form.setWindowIcon(QtGui.QIcon(":/data/img/drill-icon.png")) # self.holeSize = QtGui.QDoubleSpinBox() self.holeSize.setValue(0.4) self.holeSize.setMinimum(0.1) self.holeSize.setSuffix('mm') self.holeSize.setSingleStep(0.1) # self.pcbColor = kolorWarstwy() self.pcbColor.setColor(getFromSettings_Color_1('CenterDrillColor', 4294967295)) self.pcbColor.setToolTip(u"Click to change color") # lay = QtGui.QGridLayout(self) lay.addWidget(QtGui.QLabel('Hole size'), 0, 0, 1, 1) lay.addWidget(self.holeSize, 0, 1, 1, 1) lay.addWidget(QtGui.QLabel(u'Color:'), 1, 0, 1, 1) lay.addWidget(self.pcbColor, 1, 1, 1, 1)
def initUI(self): self._layout = QtGui.QHBoxLayout() self.setLayout(self._layout) self._layout.setContentsMargins(10,0,10,10) self._layout.setSpacing(5) self._tabs = QtGui.QTabBar() #self._tabs.setTabsClosable(True) self._tabs.addTab("Tab1") self._tabs.addTab("Tab2") self._tabs.addTab("Tab3") icnPath = "/Users/draknova/Documents/workspace/sPipe/bin/images/icons" addIcone = QtGui.QIcon(QtGui.QPixmap("%s/add.png"%(icnPath))) panelIcone = QtGui.QIcon(QtGui.QPixmap("%s/list.png"%(icnPath))) self._addButton = QtGui.QPushButton(addIcone,"") self._panelButton = QtGui.QPushButton(panelIcone,"") self._layout.addWidget(self._tabs) self._layout.addWidget(self._addButton) self._layout.addStretch() self._layout.addWidget(self._panelButton)
def drag_to_shortcut(self): print self.drag_file if os.path.exists(self.drag_file): software_name = os.path.basename(self.drag_file).split('.')[0] software_path = self.drag_file if not software_name in self.data: software_icon = pathjoin(self.app_dir, 'resources', 'default_software_icon.png').replace('\\', '/') self.data.update({software_name: {'path': software_path, 'icon': 'default_software_icon.png', 'describe': software_name, 'order': self.software_commands.count()}}) image = QtGui.QIcon(software_icon) layer_item = QtGui.QListWidgetItem(image, software_name) layer_item.setToolTip(u'%s' % software_name) layer_item.setTextAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter) self.software_commands.addItem(layer_item) print self.data self.save_profile()
def init_tray(self): self._popup_shown = False self.trayIcon = QtGui.QSystemTrayIcon(QtGui.QIcon("icons/windows_icon.ico"),self) self.trayIconMenu = QtGui.QMenu() self.openAction = QtGui.QAction("&Show/Hide", self, triggered=self._showhide) self.startupAction = QtGui.QAction("Start &Automatically", self, triggered=self.toggle_startup) self.exitAction = QtGui.QAction("&Exit", self, triggered=self._icon_exit) self.startupAction.setCheckable(True) self.startupAction.setChecked(check_startup()) self.trayIconMenu.addAction(self.openAction) self.trayIconMenu.addSeparator() self.trayIconMenu.addAction(self.startupAction) self.trayIconMenu.addSeparator() self.trayIconMenu.addAction(self.exitAction) self.trayIcon.setContextMenu(self.trayIconMenu) self.trayIcon.activated.connect(self._icon_activated) self._show_when_systray_available()
def setupWin(self): self.setWindowTitle("TMP_UniversalToolUI_TND" + " - v" + self.version) self.setGeometry(300, 300, 800, 600) # win icon setup path = os.path.join(os.path.dirname(self.location),'icons','TMP_UniversalToolUI_TND.png') self.setWindowIcon(QtGui.QIcon(path)) # initial win drag position self.drag_position=QtGui.QCursor.pos() #self.resize(250,250) # - for frameless or always on top option #self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) # it will keep ui always on top of desktop, but to set this in Maya, dont set Maya as its parent #self.setWindowFlags(QtCore.Qt.FramelessWindowHint) # it will hide ui border frame, but in Maya, use QDialog instead as QMainWindow will disappear #self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint) # best for Maya case with QDialog without parent, for always top frameless ui # - for transparent and non-regular shape ui #self.setAttribute(QtCore.Qt.WA_TranslucentBackground) # use it if you set main ui to transparent and want to use alpha png as irregular shape window #self.setStyleSheet("background-color: rgba(0, 0, 0,0);") # black color better white color for get better look of semi trans edge, like pre-mutiply
def setupWin(self): self.setWindowTitle("UITranslator" + " - v" + self.version) self.setGeometry(300, 300, 300, 300) # win icon setup path = os.path.join(os.path.dirname(self.location),'icons','UITranslator.png') self.setWindowIcon(QtGui.QIcon(path)) # initial win drag position self.drag_position=QtGui.QCursor.pos() #self.resize(250,250) # - for frameless or always on top option #self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) # it will keep ui always on top of desktop, but to set this in Maya, dont set Maya as its parent #self.setWindowFlags(QtCore.Qt.FramelessWindowHint) # it will hide ui border frame, but in Maya, use QDialog instead as QMainWindow will disappear #self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint) # best for Maya case with QDialog without parent, for always top frameless ui # - for transparent and non-regular shape ui #self.setAttribute(QtCore.Qt.WA_TranslucentBackground) # use it if you set main ui to transparent and want to use alpha png as irregular shape window #self.setStyleSheet("background-color: rgba(0, 0, 0,0);") # black color better white color for get better look of semi trans edge, like pre-mutiply
def __init__(self, parent=None, mode=0): super_class.__init__(self, parent) #------------------------------ # class variables #------------------------------ self.version="0.1" self.help = "How to Use:\n1. Put source info in\n2. Click Process button\n3. Check result output\n4. Save memory info into a file." self.uiList={} # for ui obj storage self.memoData = {} # key based variable data storage self.location = "" if getattr(sys, 'frozen', False): # frozen - cx_freeze self.location = sys.executable else: # unfrozen self.location = os.path.realpath(__file__) # location: ref: sys.modules[__name__].__file__ self.name = self.__class__.__name__ self.iconPath = os.path.join(os.path.dirname(self.location),'icons',self.name+'.png') self.iconPix = QtGui.QPixmap(self.iconPath) self.icon = QtGui.QIcon(self.iconPath) self.fileType='.{0}_EXT'.format(self.name)
def chat_add_img_to_line(self, button): rand = hex(random.randint(0, 1000000000)).replace('0x', '') img_path = os.path.join(G.MW.db_chat.tmp_folder, ('tmp_image_' + rand + '.png')).replace('\\','/') clipboard = QtGui.QApplication.clipboard() img = clipboard.image() if img: img.save(img_path) else: G.MW.message('Cannot Image!', 2) return(False, 'Cannot Image!') button.setIcon(QtGui.QIcon(img_path)) button.setIconSize(QtCore.QSize(100, 100)) button.setText('') button.img_path = img_path return(True, 'Ok!')
def createIconGroupBox(self): self.iconGroupBox = QtGui.QGroupBox("Tray Icon") self.iconLabel = QtGui.QLabel("Icon:") self.iconComboBox = QtGui.QComboBox() self.iconComboBox.addItem(QtGui.QIcon(':/icons/miner.svg'), "Miner") self.iconComboBox.addItem(QtGui.QIcon(':/images/heart.svg'), "Heart") self.iconComboBox.addItem(QtGui.QIcon(':/images/trash.svg'), "Trash") self.showIconCheckBox = QtGui.QCheckBox("Show icon") self.showIconCheckBox.setChecked(True) iconLayout = QtGui.QHBoxLayout() iconLayout.addWidget(self.iconLabel) iconLayout.addWidget(self.iconComboBox) iconLayout.addStretch() iconLayout.addWidget(self.showIconCheckBox) self.iconGroupBox.setLayout(iconLayout)
def setupUi(self): """Bruh""" self.setGeometry(50, 50, 450, 250) self.setWindowTitle("ZeZe's TWTools - Updating Servers") self.setWindowIcon(QtGui.QIcon(resource_path("images/icon.png"))) """Background color""" self.backgroundPalette = QtGui.QPalette() self.backgroundColor = QtGui.QColor(217, 204, 170) self.backgroundPalette.setColor(QtGui.QPalette.Background, self.backgroundColor) self.setPalette(self.backgroundPalette) """Layout""" self.verticalLayout = QtGui.QVBoxLayout(self) self.text = QtGui.QLabel("Updating server list:") self.verticalLayout.addWidget(self.text) """Download bar""" self.progress_bar = QtGui.QProgressBar(self) self.progress_bar.setMinimum(0) self.progress_bar.setMaximum(27) self.progress_bar.setValue(0) self.progress_bar.setFormat("%v / %m") self.verticalLayout.addWidget(self.progress_bar) """Text browser for progress""" self.progress_text = QtGui.QTextBrowser(self) self.verticalLayout.addWidget(self.progress_text) """Button""" self.horizontalLayout = QtGui.QHBoxLayout(self) self.verticalLayout.addLayout(self.horizontalLayout) self.Spacer = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout.addItem(self.Spacer) self.cancelButton = QtGui.QPushButton("Cancel") self.horizontalLayout.addWidget(self.cancelButton) self.cancelButton.clicked.connect(self.cancel_function)
def __init__(self, *args, **kw): url = kw.pop('url', None) first = False if not url: url = "http://localhost:7070" path = os.path.join(get_path_prefix(), 'leap', 'authtoken') waiting = 20 while not os.path.isfile(path): if waiting == 0: # If we arrive here, something really messed up happened, # because touching the token file is one of the first # things the backend does, and this BrowserWindow # should be called *right after* launching the backend. raise NoAuthToken( 'No authentication token found!') time.sleep(0.1) waiting -= 1 token = open(path).read().strip() url += '#' + token first = True self.url = url self.closing = False super(QWebView, self).__init__(*args, **kw) self.setWindowTitle('Bitmask') self.bitmask_browser = NewPageConnector(self) if first else None self.loadPage(self.url) self.proxy = AppProxy(self) if first else None self.frame.addToJavaScriptWindowObject( "bitmaskApp", self.proxy) icon = QtGui.QIcon() icon.addPixmap( QtGui.QPixmap(":/mask-icon.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.setWindowIcon(icon)
def createForm(self): title, iconPath, idGDT, dialogWidgets, ContainerOfData = self.initArgs self.form = GDTGuiClass( title, idGDT, dialogWidgets, ContainerOfData) self.form.setWindowTitle( title ) self.form.setWindowIcon( QtGui.QIcon( iconPath ) )
def generateWidget( self, idGDT, ContainerOfData ): self.idGDT = idGDT self.ContainerOfData = ContainerOfData if self.Text == 'Primary:': self.k=0 elif self.Text == 'Secondary:': self.k=1 elif self.Text == 'Tertiary:': self.k=2 elif self.Text == 'Characteristic:': self.k=3 elif self.Text == 'Datum system:': self.k=4 elif self.Text == 'Active annotation plane:': self.k=5 else: self.k=6 self.ContainerOfData.combo[self.k] = QtGui.QComboBox() for i in range(len(self.List)): if self.Icons <> None: self.ContainerOfData.combo[self.k].addItem( QtGui.QIcon(self.Icons[i]), self.List[i] ) else: if self.List[i] == None: self.ContainerOfData.combo[self.k].addItem( '' ) else: self.ContainerOfData.combo[self.k].addItem( self.List[i].Label ) if self.Text == 'Secondary:' or self.Text == 'Tertiary:': self.ContainerOfData.combo[self.k].setEnabled(False) if self.ToolTip <> None: self.ContainerOfData.combo[self.k].setToolTip( self.ToolTip[0] ) self.comboIndex = self.ContainerOfData.combo[self.k].currentIndex() if self.k <> 0 and self.k <> 1: self.updateDate(self.comboIndex) self.ContainerOfData.combo[self.k].activated.connect(lambda comboIndex = self.comboIndex: self.updateDate(comboIndex)) return GDTDialog_hbox(self.Text,self.ContainerOfData.combo[self.k])
def __init__(self, obj): self.mainObject = obj self.form = explodeWizardWidget() self.form.setWindowTitle('Explode settings - editing `{0}`'.format(self.mainObject.Label)) self.form.setWindowIcon(QtGui.QIcon(":/data/img/explode.png"))
def __init__(self): self.form = explodeWizardWidget() self.form.setWindowTitle('Explode settings') self.form.setWindowIcon(QtGui.QIcon(":/data/img/explode.png"))
def __init__(self, parent=None, updateModel=None): partsManaging.__init__(self) self.form = updateWizardWidget() self.form.setWindowTitle('Update model') self.form.setWindowIcon(QtGui.QIcon(":/data/img/updateParts.spng")) self.updateModel = updateModel self.setDatabase()
def __init__(self, searchPhrase=None, parent=None): QtGui.QWidget.__init__(self, parent) # self.form = self self.form.setWindowIcon(QtGui.QIcon(":/data/img/downloadModel.png")) # if searchPhrase: self.form.setWindowTitle('Download model for {0}'.format(searchPhrase)) url_1 = odnosnik("<a href='http://sourceforge.net/projects/eaglepcb2freecad/files/models/'>FreeCAD-PCB</a>") url_2 = odnosnik("<a href='http://www.tracepartsonline.net/(S(q4odzm45rnnypc4513kjgy45))/content.aspx?SKeywords={0}'>trace<b>parts</b></a>".format(searchPhrase)) url_3 = odnosnik("<a href='http://www.3dcontentcentral.com/Search.aspx?arg={0}'>3D ContentCentral</a>".format(searchPhrase)) else: self.form.setWindowTitle('Download model') url_1 = odnosnik("<a href='http://sourceforge.net/projects/eaglepcb2freecad/files/models/'>FreeCAD-PCB</a>") url_2 = odnosnik("<a href='http://www.tracepartsonline.net/(S(q4odzm45rnnypc4513kjgy45))/content.aspx'>trace<b>parts</b></a>") url_3 = odnosnik("<a href='http://www.3dcontentcentral.com/'>3D ContentCentral</a>") # lay = QtGui.QGridLayout(self) lay.addWidget(dodatkowaIkonka_lista(), 0, 0, 1, 1) lay.addWidget(url_1, 0, 1, 1, 1) lay.addWidget(dodatkowaIkonka_lista(), 1, 0, 1, 1) lay.addWidget(url_2, 1, 1, 1, 1) lay.addWidget(dodatkowaIkonka_klucz(), 1, 2, 1, 1) lay.addWidget(dodatkowaIkonka_lista(), 2, 0, 1, 1) lay.addWidget(url_3, 2, 1, 1, 1) lay.addWidget(dodatkowaIkonka_klucz(), 2, 2, 1, 1) lay.addItem(QtGui.QSpacerItem(5, 20), 3, 0, 1, 3) lay.addWidget(QtGui.QLabel('Printed Circuit Board supported formats: IGS, STEP'), 3, 0, 1, 3) lay.setColumnStretch(1, 10)
def joinIconPaths(self): # Icon's aren't pathed properly if the CWD is somewhere else than the source folder, so... self.source_dir = os.path.dirname( os.path.realpath(__file__) ) # Join all the icons and reload them icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(os.path.join( self.source_dir, "icons/CINAlogo.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.MainWindow.setWindowIcon(icon) self.label_2.setPixmap(QtGui.QPixmap(os.path.join( self.source_dir, "icons/CINAlogo.png"))) icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap(os.path.join( self.source_dir, "icons/folder.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.tbOpenCachePath.setIcon(icon1) self.tbOpenQsubHeader.setIcon(icon1) self.tbGautoOpenTemplate.setIcon(icon1) self.ui_FileLocDialog.tbOpenGainRefPath.setIcon(icon1) self.ui_FileLocDialog.tbOpenFiguresPath.setIcon(icon1) self.ui_FileLocDialog.tbOpenInputPath.setIcon(icon1) self.ui_FileLocDialog.tbOpenOutputPath.setIcon(icon1) self.ui_FileLocDialog.tbOpenRawPath.setIcon(icon1) self.ui_FileLocDialog.tbOpenSumPath.setIcon(icon1) self.ui_FileLocDialog.tbOpenAlignPath.setIcon(icon1) self.ui_OrienGainRefDialog.tbOrientGain_GainRef.setIcon(icon1) self.ui_OrienGainRefDialog.tbOrientGain_TargetStack.setIcon(icon1) icon2 = QtGui.QIcon() icon2.addPixmap(QtGui.QPixmap(os.path.join( self.source_dir, "icons/go-next.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.tbRun.setIcon(icon2) icon3 = QtGui.QIcon() icon3.addPixmap(QtGui.QPixmap(os.path.join( self.source_dir, "icons/process-stop.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.tbKillAll.setIcon(icon3) icon4 = QtGui.QIcon() icon4.addPixmap(QtGui.QPixmap(os.path.join( self.source_dir, "icons/user-trash.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.tbDeleteFile.setIcon(icon4) icon5 = QtGui.QIcon() icon5.addPixmap(QtGui.QPixmap(os.path.join( self.source_dir, "icons/boxes.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.tbParticlePick.setIcon(icon5) icon6 = QtGui.QIcon() icon6.addPixmap(QtGui.QPixmap(os.path.join( self.source_dir, "icons/view-refresh.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.tbReprocess.setIcon(icon6)
def joinIconPaths(self): # Icon's aren't pathed properly if the CWD is somewhere else than the source folder, so... self.source_dir = os.path.dirname( os.path.realpath(__file__) ) # Join all the icons and reload them icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(os.path.join( self.source_dir, "icons/application-resize.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.tbPopoutView.setIcon(icon) icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap(os.path.join( self.source_dir, "icons/monitor-dead.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) icon1.addPixmap(QtGui.QPixmap(os.path.join( self.source_dir, "icons/monitor-live.png")), QtGui.QIcon.Normal, QtGui.QIcon.On) self.tbLive.setIcon(icon1) icon2 = QtGui.QIcon() icon2.addPixmap(QtGui.QPixmap(os.path.join( self.source_dir, "icons/color.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.tbChangeColormap.setIcon(icon2) icon3 = QtGui.QIcon() icon3.addPixmap(QtGui.QPixmap(os.path.join( self.source_dir, "icons/colorbar.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.tbToggleColorbar.setIcon(icon3) icon4 = QtGui.QIcon() icon4.addPixmap(QtGui.QPixmap(os.path.join( self.source_dir, "icons/magnifier-zoom-in.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.tbZoomIn.setIcon(icon4) icon5 = QtGui.QIcon() icon5.addPixmap(QtGui.QPixmap(os.path.join( self.source_dir, "icons/magnifier-zoom-out.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.tbZoomOut.setIcon(icon5) icon6 = QtGui.QIcon() icon6.addPixmap(QtGui.QPixmap(os.path.join( self.source_dir, "icons/boxes.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.tbShowBoxes.setIcon(icon6) icon7 = QtGui.QIcon() icon7.addPixmap(QtGui.QPixmap(os.path.join( self.source_dir, "icons/logscale.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.tbLogIntensity.setIcon(icon7) icon8 = QtGui.QIcon() icon8.addPixmap(QtGui.QPixmap(os.path.join( self.source_dir, "icons/histogram.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.tbToggleHistogramContrast.setIcon(icon8) icon9 = QtGui.QIcon() icon9.addPixmap(QtGui.QPixmap(os.path.join( self.source_dir, "icons/arrow-180.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.tbPrevImage.setIcon(icon9) icon10 = QtGui.QIcon() icon10.addPixmap(QtGui.QPixmap(os.path.join( self.source_dir, "icons/arrow.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.tbNextImage.setIcon(icon10)
def initUI(self): l = QtGui.QVBoxLayout(self) l.setContentsMargins(0,0,0,0) w = QtGui.QFrame(self) l.addWidget(w) self._layout = QtGui.QVBoxLayout() #self.setLayout(self._layout) w.setLayout(self._layout) self._layout.setContentsMargins(0,0,0,0) icnPath = "/Users/draknova/Documents/workspace/sPipe/bin/images/icons/" icn1 = QtGui.QIcon(QtGui.QPixmap("%s/home.png"%(icnPath))) icn2 = QtGui.QIcon(QtGui.QPixmap("%s/server.png"%(icnPath))) icn3 = QtGui.QIcon(QtGui.QPixmap("%s/database.png"%(icnPath))) icn4 = QtGui.QIcon(QtGui.QPixmap("%s/network.png"%(icnPath))) icn5 = QtGui.QIcon(QtGui.QPixmap("%s/settings.png"%(icnPath))) b1 = QtGui.QPushButton(icn1,"") b2 = QtGui.QPushButton(icn2,"") b3 = QtGui.QPushButton(icn3,"") b4 = QtGui.QPushButton(icn4,"") b5 = QtGui.QPushButton(icn5,"") self._layout.addWidget(b1) self._layout.addWidget(b2) self._layout.addWidget(b3) self._layout.addWidget(b4) self._layout.addWidget(b5) self._layout.addStretch()
def search_software(self): self.software_commands.clear() result = [] soft_name = self.search_text.text() pattem = '.*?'.join(soft_name.lower()) regex = re.compile(pattem) Manager.sort_data(self.data) for software_name in self.data.keys(): match = regex.search(software_name.lower()) if match: result.append((len(match.group()), match.start(), software_name)) if result: sorted_result = [x for _, _, x in sorted(result)] for r in sorted_result: icon_name = self.data[r]['icon'] if icon_name: image_path = pathjoin(self.app_dir, 'resources', icon_name) else: image_path = pathjoin(self.app_dir, 'resources', 'default_software_icon.png') if not os.path.isfile(image_path): image_path = pathjoin(self.app_dir, 'resources', 'default_software_icon.png') image = QtGui.QIcon(image_path) layer_item = QtGui.QListWidgetItem(image, r) describe_msg = 'Describe:\n\t{0}\nPath:\n\t{1}'.format(r, self.data[r].get('path')) layer_item.setToolTip(describe_msg) layer_item.setTextAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter) self.software_commands.addItem(layer_item)
def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.resize(680, 403) self.gridLayout = QtGui.QGridLayout(Dialog) self.gridLayout.setObjectName("gridLayout") self.labelVersion = QtGui.QLabel(Dialog) self.labelVersion.setObjectName("labelVersion") self.gridLayout.addWidget(self.labelVersion, 0, 0, 1, 1) self.labelSupport = QtGui.QLabel(Dialog) self.labelSupport.setObjectName("labelSupport") self.gridLayout.addWidget(self.labelSupport, 1, 0, 1, 1) self.labelLicense = QtGui.QLabel(Dialog) self.labelLicense.setObjectName("labelLicense") self.gridLayout.addWidget(self.labelLicense, 2, 0, 1, 1) self.pushButton = QtGui.QPushButton(Dialog) self.pushButton.setText("") icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/icon/mpowertcx icon flat.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.pushButton.setIcon(icon) self.pushButton.setIconSize(QtCore.QSize(256, 256)) self.pushButton.setFlat(True) self.pushButton.setObjectName("pushButton") self.gridLayout.addWidget(self.pushButton, 3, 1, 1, 1) spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.gridLayout.addItem(spacerItem, 4, 1, 1, 1) self.licenseEdit = QtGui.QPlainTextEdit(Dialog) self.licenseEdit.setFrameShape(QtGui.QFrame.Box) self.licenseEdit.setReadOnly(True) self.licenseEdit.setObjectName("licenseEdit") self.gridLayout.addWidget(self.licenseEdit, 3, 0, 2, 1) self.buttonBox = QtGui.QDialogButtonBox(Dialog) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok) self.buttonBox.setCenterButtons(True) self.buttonBox.setObjectName("buttonBox") self.gridLayout.addWidget(self.buttonBox, 5, 0, 1, 2) self.retranslateUi(Dialog) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), Dialog.accept) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), Dialog.reject) QtCore.QMetaObject.connectSlotsByName(Dialog)
def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.resize(756, 395) self.gridLayout = QtGui.QGridLayout(Dialog) self.gridLayout.setObjectName("gridLayout") self.labelVersion = QtGui.QLabel(Dialog) self.labelVersion.setObjectName("labelVersion") self.gridLayout.addWidget(self.labelVersion, 0, 0, 1, 1) self.labelSupport = QtGui.QLabel(Dialog) self.labelSupport.setObjectName("labelSupport") self.gridLayout.addWidget(self.labelSupport, 1, 0, 1, 1) self.labelLicense = QtGui.QLabel(Dialog) self.labelLicense.setObjectName("labelLicense") self.gridLayout.addWidget(self.labelLicense, 2, 0, 1, 1) self.pushButton = QtGui.QPushButton(Dialog) self.pushButton.setText("") icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/icon/mpowertcx icon flat.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.pushButton.setIcon(icon) self.pushButton.setIconSize(QtCore.QSize(256, 256)) self.pushButton.setFlat(True) self.pushButton.setObjectName("pushButton") self.gridLayout.addWidget(self.pushButton, 3, 1, 1, 1) spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.gridLayout.addItem(spacerItem, 4, 1, 1, 1) self.licenseEdit = QtGui.QPlainTextEdit(Dialog) self.licenseEdit.setFrameShape(QtGui.QFrame.NoFrame) self.licenseEdit.setReadOnly(True) self.licenseEdit.setObjectName("licenseEdit") self.gridLayout.addWidget(self.licenseEdit, 3, 0, 2, 1) self.buttonBox = QtGui.QDialogButtonBox(Dialog) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok) self.buttonBox.setCenterButtons(True) self.buttonBox.setObjectName("buttonBox") self.gridLayout.addWidget(self.buttonBox, 5, 0, 1, 2) self.retranslateUi(Dialog) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), Dialog.accept) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), Dialog.reject) QtCore.QMetaObject.connectSlotsByName(Dialog)
def __init__(self,url,title='Help'): super().__init__() self.view = QtWebKit.QWebView(self) self.view.load(url) self.layout = QtGui.QHBoxLayout() self.layout.addWidget(self.view) self.setWindowIcon(QtGui.QIcon('icons/windows_icon.ico')) self.setLayout(self.layout) self.resize(800,600) self.setWindowTitle(title) self.show()
def init_ui(self): self.name_of_application = "upload.farm uploader v{}".format(__version__) self.setWindowTitle(self.name_of_application) self.setWindowIcon(QtGui.QIcon('icons/windows_icon.ico')) self._create_layouts_and_widgets() self.show()
def init_ui(self): self.name_of_application = "upload.farm uploader v{}".format(__version__) self.add_email_to_application_name() self.setWindowTitle(self.name_of_application) self.setWindowIcon(QtGui.QIcon('icons/windows_icon.ico')) self._create_layouts_and_widgets()
def qui_atn(self, ui_name, title, tip=None, icon=None, parent=None, key=None): self.uiList[ui_name] = QtWidgets.QAction(title, self) if icon!=None: self.uiList[ui_name].setIcon(QtGui.QIcon(icon)) if tip !=None: self.uiList[ui_name].setStatusTip(tip) if key != None: self.uiList[ui_name].setShortcut(QtGui.QKeySequence(key)) if parent !=None: if isinstance(parent, (str, unicode)) and parent in self.uiList.keys(): self.uiList[parent].addAction(self.uiList[ui_name]) elif isinstance(parent, QtWidgets.QMenu): parent.addAction(self.uiList[ui_name]) return ui_name
def quickMenuAction(self, objName, title, tip, icon, menuObj): self.uiList[objName] = QtWidgets.QAction(QtGui.QIcon(icon), title, self) self.uiList[objName].setStatusTip(tip) menuObj.addAction(self.uiList[objName])
def quickMenuAction(self, objName, title, tip, icon, menuObj): self.uiList[objName] = QtGui.QAction(QtGui.QIcon(icon), title, self) self.uiList[objName].setStatusTip(tip) menuObj.addAction(self.uiList[objName])
def __init__(self, parent=None, mode=0): super_class.__init__(self, parent) #------------------------------ # class variables #------------------------------ self.version="0.1" self.help = "How to Use:\n1. Put source info in\n2. Click Process button\n3. Check result output\n4. Save memory info into a file." self.uiList={} # for ui obj storage self.memoData = {} # key based variable data storage self.location = "" if getattr(sys, 'frozen', False): # frozen - cx_freeze self.location = sys.executable else: # unfrozen self.location = os.path.realpath(__file__) # location: ref: sys.modules[__name__].__file__ self.name = self.__class__.__name__ self.iconPath = os.path.join(os.path.dirname(self.location),'icons',self.name+'.png') self.iconPix = QtGui.QPixmap(self.iconPath) self.icon = QtGui.QIcon(self.iconPath) self.fileType='.{0}_EXT'.format(self.name) # Custom user variable #------------------------------ # initial data #------------------------------ self.memoData['data']=[] self.setupStyle() if isinstance(self, QtWidgets.QMainWindow): self.setupMenu() self.setupWin() self.setupUI() self.Establish_Connections() self.loadData() self.loadLang()
def __init__(self, parent=None): super(InstructionDialog, self).__init__(parent) self.setupUi(self) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":img/icon.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.setWindowIcon(icon) self.setWindowFlags(QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint) self.pushButton_OK.clicked.connect(self.close)
def main(): app = QtGui.QApplication(sys.argv) w = QtGui.QWidget() trayIcon = SystemTrayIcon(QtGui.QIcon("C:\Python34\C.png"), w) trayIcon.show() sys.exit(app.exec_())
def __init__(self, mssg=''): super(Notification, self).__init__() MSSG = mssg self.desktop = QtGui.QDesktopWidget() self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.SubWindow) self.setupUi(self) self.app_dir = os.path.dirname(__file__) self.f = 1.0 self.x = self.desktop.availableGeometry().width() self.workThread = WorkThread() self.set_transparency(True) self.label_icon.setIcon(QtGui.QIcon(self.add_icon('push-notification.png'))) self.createNotification(MSSG)
def __init__(self,winTitle='Title',btn1Text='Button1',btn2Text='Button2',initVal='someVal',units='someUnit', icon='flamingo.svg'): super(prototypeForm,self).__init__() self.setWindowFlags(Qt.WindowStaysOnTopHint) self.setWindowTitle(winTitle) iconPath=join(dirname(abspath(__file__)),"icons",icon) from PySide.QtGui import QIcon Icon=QIcon() Icon.addFile(iconPath) self.setWindowIcon(Icon) self.move(QPoint(100,250)) self.mainVL=QVBoxLayout() self.setLayout(self.mainVL) self.inputs=QWidget() self.inputs.setLayout(QFormLayout()) self.edit1=QLineEdit(initVal) self.edit1.setMinimumWidth(40) self.edit1.setAlignment(Qt.AlignHCenter) self.edit1.setMaximumWidth(60) self.inputs.layout().addRow(units,self.edit1) self.mainVL.addWidget(self.inputs) self.radio1=QRadioButton() self.radio1.setChecked(True) self.radio2=QRadioButton() self.radios=QWidget() self.radios.setLayout(QFormLayout()) self.radios.layout().setAlignment(Qt.AlignHCenter) self.radios.layout().addRow('move',self.radio1) self.radios.layout().addRow('copy',self.radio2) self.mainVL.addWidget(self.radios) self.btn1=QPushButton(btn1Text) self.btn1.setDefault(True) self.btn1.setFocus() self.btn2=QPushButton(btn2Text) self.buttons=QWidget() self.buttons.setLayout(QHBoxLayout()) self.buttons.layout().addWidget(self.btn1) self.buttons.layout().addWidget(self.btn2) self.mainVL.addWidget(self.buttons)
def __init__(self,winTitle='Rotate WP', icon='rotWP.svg'): super(rotWPForm,self).__init__() self.move(QPoint(100,250)) self.setWindowFlags(Qt.WindowStaysOnTopHint) self.setWindowTitle(winTitle) iconPath=join(dirname(abspath(__file__)),"icons",icon) from PySide.QtGui import QIcon Icon=QIcon() Icon.addFile(iconPath) self.setWindowIcon(Icon) self.grid=QGridLayout() self.setLayout(self.grid) self.radioX=QRadioButton('X') self.radioX.setChecked(True) self.radioY=QRadioButton('Y') self.radioZ=QRadioButton('Z') self.lab1=QLabel('Angle:') self.edit1=QLineEdit('45') self.edit1.setAlignment(Qt.AlignCenter) self.edit1.setValidator(QDoubleValidator()) self.btn1=QPushButton('Rotate working plane') self.btn1.clicked.connect(self.rotate) self.grid.addWidget(self.radioX,0,0,1,1,Qt.AlignCenter) self.grid.addWidget(self.radioY,0,1,1,1,Qt.AlignCenter) self.grid.addWidget(self.radioZ,0,2,1,1,Qt.AlignCenter) self.grid.addWidget(self.lab1,1,0,1,1) self.grid.addWidget(self.edit1,1,1,1,2) self.grid.addWidget(self.btn1,2,0,1,3,Qt.AlignCenter) self.show() self.sg=FreeCADGui.ActiveDocument.ActiveView.getSceneGraph() s=FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").GetInt("gridSize") sc=[float(x*s) for x in [1,1,.2]] from polarUtilsCmd import arrow self.arrow =arrow(FreeCAD.DraftWorkingPlane.getPlacement(),scale=sc,offset=s)
def setupUi(self): """Bruh""" self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.setGeometry(50, 50, 850, 425) self.setWindowTitle("ZeZe's TWTools - Coord Extractor") self.setWindowIcon(QtGui.QIcon(resource_path("images/icon.png"))) """Background color""" self.backgroundPalette = QtGui.QPalette() self.backgroundColor = QtGui.QColor(217, 204, 170) self.backgroundPalette.setColor(QtGui.QPalette.Background, self.backgroundColor) self.setPalette(self.backgroundPalette) """Main layout & return to main menu button""" self.verticalLayout = QtGui.QVBoxLayout(self) self.buttonLayout = QtGui.QHBoxLayout(self) self.verticalLayout.addLayout(self.buttonLayout) self.returnButton = QtGui.QPushButton(" Return to the Main Menu ", self) self.returnButton.clicked.connect(self.return_function) self.buttonLayout.addWidget(self.returnButton) self.buttonSpacer = QtGui.QSpacerItem(0, 0, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.buttonLayout.addItem(self.buttonSpacer) """Line Spacer and line""" self.lineSpacer = QtGui.QSpacerItem(40, 5, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.verticalLayout.addItem(self.lineSpacer) self.line = QtGui.QFrame(self) self.line.setFrameShape(QtGui.QFrame.HLine) self.line.setFrameShadow(QtGui.QFrame.Sunken) self.verticalLayout.addWidget(self.line) """Text input label and edit""" self.Spacer = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout.addItem(self.Spacer) self.inputLabel = QtGui.QLabel("Input text with coordinates here:") self.verticalLayout.addWidget(self.inputLabel) self.plainTextEdit = QtGui.QPlainTextEdit(self) self.verticalLayout.addWidget(self.plainTextEdit) """Coordinates output label and edit""" self.Spacer1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout.addItem(self.Spacer1) self.outputLabel = QtGui.QLabel("Output coordinates magically appear here:") self.verticalLayout.addWidget(self.outputLabel) self.plainTextEdit_2 = QtGui.QPlainTextEdit(self) self.verticalLayout.addWidget(self.plainTextEdit_2) """Extract coordinates button""" self.horizontalLayout = QtGui.QHBoxLayout() self.verticalLayout.addLayout(self.horizontalLayout) self.Spacer2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout.addItem(self.Spacer2) self.extractButton = QtGui.QPushButton(" Extract Coordinates ", self) self.extractButton.clicked.connect(self.extract_function) self.horizontalLayout.addWidget(self.extractButton)
def setupUi(self): """Bruh""" self.setGeometry(50, 50, 300, 150) self.setWindowTitle("ZeZe's TWTools - Input Speeds") self.setWindowIcon(QtGui.QIcon(resource_path("images/icon.png"))) """Background color""" self.backgroundPalette = QtGui.QPalette() self.backgroundColor = QtGui.QColor(217, 204, 170) self.backgroundPalette.setColor(QtGui.QPalette.Background, self.backgroundColor) self.setPalette(self.backgroundPalette) """Form layout""" self.formLayout = QtGui.QFormLayout(self) self.formLayout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow) """World speed label & input box""" self.world_speedLabel = QtGui.QLabel("World Speed:", self) self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.world_speedLabel) self.world_speedBox = QtGui.QDoubleSpinBox(self) self.world_speedBox.setDecimals(1) self.world_speedBox.setMaximum(1000.0) self.world_speedBox.setSingleStep(0.5) self.world_speedBox.setProperty("value", 1.0) self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.world_speedBox) """Unit speed label & input box""" self.unit_speedLabel = QtGui.QLabel("Unit Speed:", self) self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.unit_speedLabel) self.unit_speedBox = QtGui.QDoubleSpinBox(self) self.unit_speedBox.setDecimals(1) self.unit_speedBox.setMaximum(1000.0) self.unit_speedBox.setSingleStep(0.5) self.unit_speedBox.setProperty("value", 1.0) self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.unit_speedBox) """Spacer""" self.Spacer = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.formLayout.setItem(2, QtGui.QFormLayout.FieldRole, self.Spacer) """Ok button""" self.okButton = QtGui.QPushButton("Ok", self) self.formLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.okButton) self.okButton.clicked.connect(self.get_data)
def tabCategories(self): tab = QtGui.QWidget() # buttons selectAll = QtGui.QPushButton() selectAll.setFlat(True) selectAll.setToolTip('Select all') selectAll.setIcon(QtGui.QIcon(":/data/img/checkbox_checked_16x16.png")) selectAll.setStyleSheet('''border:1px solid rgb(237, 237, 237);''') self.connect(selectAll, QtCore.SIGNAL("clicked()"), self.selectAllCategories) unselectAll = QtGui.QPushButton() unselectAll.setFlat(True) unselectAll.setToolTip('Deselect all') unselectAll.setIcon(QtGui.QIcon(":/data/img/checkbox_unchecked_16x16.PNG")) unselectAll.setStyleSheet('''border:1px solid rgb(237, 237, 237);''') self.connect(unselectAll, QtCore.SIGNAL("clicked()"), self.unselectAllCategories) # table self.categoriesTable = QtGui.QTableWidget() self.categoriesTable.setStyleSheet('''border:0px solid red;''') self.categoriesTable.setColumnCount(5) self.categoriesTable.setGridStyle(QtCore.Qt.DashDotLine) self.categoriesTable.setHorizontalHeaderLabels([' Active ', 'ID', 'Name', 'Description', 'Action']) self.categoriesTable.verticalHeader().hide() self.categoriesTable.horizontalHeader().setResizeMode(0, QtGui.QHeaderView.ResizeToContents) self.categoriesTable.horizontalHeader().setStretchLastSection(True) self.categoriesTable.hideColumn(1) # main lay layTableButtons = QtGui.QHBoxLayout() layTableButtons.addWidget(selectAll) layTableButtons.addWidget(unselectAll) layTableButtons.addStretch(10) lay = QtGui.QGridLayout(tab) lay.addLayout(layTableButtons, 0, 0, 1, 1) lay.addWidget(self.categoriesTable, 1, 0, 1, 1) lay.setRowStretch(1, 10) lay.setColumnStretch(0, 10) lay.setContentsMargins(5, 5, 5, 5) return tab
def tabModels(self): tab = QtGui.QWidget() # table self.modelsTable = QtGui.QTreeWidget() #self.modelsTable.setSelectionMode(QtGui.QAbstractItemView.NoSelection) self.modelsTable.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) self.modelsTable.setHeaderLabels([u'Name', u'Description', u'Paths', u'Softwares']) self.modelsTable.setStyleSheet(''' QTreeWidget {border:0px solid #FFF;} ''') self.connect(self.modelsTable, QtCore.SIGNAL("itemPressed (QTreeWidgetItem*,int)"), self.showInfoF) # buttons selectAll = QtGui.QPushButton() selectAll.setFlat(True) selectAll.setToolTip('Select all') selectAll.setIcon(QtGui.QIcon(":/data/img/checkbox_checked_16x16.png")) selectAll.setStyleSheet('''border:1px solid rgb(237, 237, 237);''') self.connect(selectAll, QtCore.SIGNAL("clicked()"), self.selectAllModels) unselectAll = QtGui.QPushButton() unselectAll.setFlat(True) unselectAll.setToolTip('Deselect all') unselectAll.setIcon(QtGui.QIcon(":/data/img/checkbox_unchecked_16x16.PNG")) unselectAll.setStyleSheet('''border:1px solid rgb(237, 237, 237);''') self.connect(unselectAll, QtCore.SIGNAL("clicked()"), self.unselectAllModels) collapseAll = QtGui.QPushButton() collapseAll.setFlat(True) collapseAll.setToolTip('Collapse all') collapseAll.setIcon(QtGui.QIcon(":/data/img/collapse.png")) collapseAll.setStyleSheet('''border:1px solid rgb(237, 237, 237);''') self.connect(collapseAll, QtCore.SIGNAL("clicked()"), self.modelsTable.collapseAll) expandAll = QtGui.QPushButton() expandAll.setFlat(True) expandAll.setToolTip('Expand all') expandAll.setIcon(QtGui.QIcon(":/data/img/expand.png")) expandAll.setStyleSheet('''border:1px solid rgb(237, 237, 237);''') self.connect(expandAll, QtCore.SIGNAL("clicked()"), self.modelsTable.expandAll) # info self.showInfo = QtGui.QLabel('') self.showInfo.setStyleSheet('border:1px solid rgb(237, 237, 237); padding:5px 2px;') # main lay layTableButtons = QtGui.QHBoxLayout() layTableButtons.addWidget(selectAll) layTableButtons.addWidget(unselectAll) layTableButtons.addWidget(collapseAll) layTableButtons.addWidget(expandAll) layTableButtons.addStretch(10) lay = QtGui.QGridLayout(tab) lay.addLayout(layTableButtons, 0, 0, 1, 1) lay.addWidget(self.modelsTable, 1, 0, 1, 1) lay.addWidget(self.showInfo, 2, 0, 1, 1) lay.setRowStretch(1, 10) lay.setColumnStretch(0, 10) lay.setContentsMargins(5, 5, 5, 5) return tab
def __init__(self, parent=None): reload(PCBconf) QtGui.QWidget.__init__(self, parent) freecadSettings = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/PCB") self.form = self self.form.setWindowTitle(u"Create PCB") self.form.setWindowIcon(QtGui.QIcon(":/data/img/board.png")) # self.gruboscPlytki = QtGui.QDoubleSpinBox(self) self.gruboscPlytki.setSingleStep(0.1) self.gruboscPlytki.setValue(freecadSettings.GetFloat("boardThickness", 1.5)) self.gruboscPlytki.setSuffix(u" mm") # self.pcbBorder = QtGui.QLineEdit('') self.pcbBorder.setReadOnly(True) pickPcbBorder = pickSketch(self.pcbBorder) # self.pcbHoles = QtGui.QLineEdit('') self.pcbHoles.setReadOnly(True) pickPcbHoles = pickSketch(self.pcbHoles) # self.pcbColor = kolorWarstwy() self.pcbColor.setColor(self.pcbColor.PcbColorToRGB(PCBconf.PCB_COLOR)) self.pcbColor.setToolTip(u"Click to change color") # lay = QtGui.QGridLayout() lay.addWidget(QtGui.QLabel(u'Border:'), 0, 0, 1, 1) lay.addWidget(self.pcbBorder, 0, 1, 1, 1) lay.addWidget(pickPcbBorder, 0, 2, 1, 1) lay.addWidget(QtGui.QLabel(u'Holes:'), 1, 0, 1, 1) lay.addWidget(self.pcbHoles, 1, 1, 1, 1) lay.addWidget(pickPcbHoles, 1, 2, 1, 1) lay.addWidget(QtGui.QLabel(u'Thickness:'), 2, 0, 1, 1) lay.addWidget(self.gruboscPlytki, 2, 1, 1, 2) lay.addWidget(QtGui.QLabel(u'Color:'), 3, 0, 1, 1) lay.addWidget(self.pcbColor, 3, 1, 1, 2) # self.setLayout(lay)
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) freecadSettings = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/PCB") # self.listaBibliotek = QtGui.QComboBox() libraryFrame = QtGui.QGroupBox(u'Library:') libraryFrameLay = QtGui.QHBoxLayout(libraryFrame) libraryFrameLay.addWidget(self.listaBibliotek) # self.listaElementow = updateObjectTable() przSelectAllT = QtGui.QPushButton('') przSelectAllT.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) przSelectAllT.setFlat(True) przSelectAllT.setIcon(QtGui.QIcon(":/data/img/checkbox_checked_16x16.png")) przSelectAllT.setToolTip('Select all') self.connect(przSelectAllT, QtCore.SIGNAL('pressed ()'), self.selectAllObj) przSelectAllTF = QtGui.QPushButton('') przSelectAllTF.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) przSelectAllTF.setFlat(True) przSelectAllTF.setIcon(QtGui.QIcon(":/data/img/checkbox_unchecked_16x16.PNG")) przSelectAllTF.setToolTip('Deselect all') self.connect(przSelectAllTF, QtCore.SIGNAL('pressed ()'), self.unselectAllObj) self.adjustParts = QtGui.QCheckBox(u'Adjust part name/value') self.adjustParts.setChecked(freecadSettings.GetBool("adjustNameValue", False)) self.groupParts = QtGui.QCheckBox(u'Group parts') self.groupParts.setChecked(freecadSettings.GetBool("groupParts", False)) self.plytkaPCB_elementyKolory = QtGui.QCheckBox(u"Colorize elements") self.plytkaPCB_elementyKolory.setChecked(freecadSettings.GetBool("partsColorize", True)) packagesFrame = QtGui.QGroupBox(u'Packages:') packagesFrameLay = QtGui.QGridLayout(packagesFrame) packagesFrameLay.addWidget(przSelectAllT, 0, 0, 1, 1) packagesFrameLay.addWidget(przSelectAllTF, 1, 0, 1, 1) packagesFrameLay.addWidget(self.listaElementow, 0, 1, 3, 1) # lay = QtGui.QVBoxLayout() lay.addWidget(libraryFrame) lay.addWidget(packagesFrame) lay.addWidget(self.adjustParts) lay.addWidget(self.groupParts) lay.addWidget(self.plytkaPCB_elementyKolory) lay.setStretch(1, 10) self.setLayout(lay) # self.readLibs()
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.form = self self.form.setWindowTitle(u"Layers settings") self.form.setWindowIcon(QtGui.QIcon(":/data/img/layers.png")) # nr = 0 lay = QtGui.QGridLayout() PCBlayers["Parts"] = [2, [0, 0, 0], None, 'PCBpart', "Parts"] PCBlayers["Parts Name"] = [2, [0, 0, 0], None, ['PCBannotation', 'anno_name'], "Parts Name"] PCBlayers["Parts Value"] = [2, [0, 0, 0], None, ['PCBannotation', 'anno_value'], "Parts Value"] # for i, j in PCBconstraintAreas.items(): PCBlayers[j[0]] = [2, [0, 0, 0], None, j[1], j[4]] for i, j in OrderedDict(sorted(PCBlayers.items(), key=lambda t: t[0])).items(): infoPrz = przycisk() infoPrz.setToolTip(u"Info") infoPrz.setIcon(QtGui.QIcon(":/data/img/info_16x16.png")) par = partial(self.showInfo, j[4]) self.connect(infoPrz, QtCore.SIGNAL("clicked ()"), par) showAll = przycisk() showAll.setToolTip(u"Show All") showAll.setIcon(QtGui.QIcon(":/data/img/show.png")) par = partial(self.showAll, j[3]) self.connect(showAll, QtCore.SIGNAL("clicked ()"), par) hideAll = przycisk() hideAll.setToolTip(u"Hide All") hideAll.setIcon(QtGui.QIcon(":/data/img/hide.png")) par = partial(self.hideAll, j[3]) self.connect(hideAll, QtCore.SIGNAL("clicked ()"), par) # lay.addWidget(QtGui.QLabel(i), nr, 0, 1, 1) lay.addWidget(showAll, nr, 1, 1, 1) lay.addWidget(hideAll, nr, 2, 1, 1) lay.addWidget(infoPrz, nr, 3, 1, 1) # nr += 1 # lay.setColumnStretch(0, 10) self.setLayout(lay)