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)
python类QIcon()的实例源码
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()
universal_tool_template_v7.3.py 文件源码
项目:universal_tool_template.py
作者: shiningdesign
项目源码
文件源码
阅读 25
收藏 0
点赞 0
评论 0
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
UITranslator_v1.0.py 文件源码
项目:universal_tool_template.py
作者: shiningdesign
项目源码
文件源码
阅读 31
收藏 0
点赞 0
评论 0
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
universal_tool_template_0903.py 文件源码
项目:universal_tool_template.py
作者: shiningdesign
项目源码
文件源码
阅读 27
收藏 0
点赞 0
评论 0
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 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 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()
universal_tool_template_1020.py 文件源码
项目:universal_tool_template.py
作者: shiningdesign
项目源码
文件源码
阅读 24
收藏 0
点赞 0
评论 0
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