def createActions(self): self.nameLabel = QLabel(self.mobile.name) self.nameLabel.setMinimumSize(80, 23) self.nameLabelAction = QWidgetAction(self) self.nameLabelAction.setDefaultWidget(self.nameLabel) self.addAction(self.nameLabelAction) self.enableAction = QAction("Enable Display", self) self.enableAction.setCheckable(True) self.enableAction.setChecked(True) icon = QIcon(':/plugins/PosiView/ledgrey.png') icon.addFile(':/plugins/PosiView/ledgreen.png', QSize(), QIcon.Normal, QIcon.On) self.enableAction.setIcon(icon) self.addAction(self.enableAction) self.enableAction.triggered.connect(self.onEnableClicked) self.enableAction.triggered.connect(self.mobile.setEnabled) self.addSeparator() self.posLabel = QLabel("--:--:-- 0.000000 0.000000\nd = 0.0") self.posLabel.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter) self.posLabel.setMinimumSize(180, 23) self.posLabel.setStyleSheet('background: red; font-size: 8pt') self.posLabelAction = QWidgetAction(self) self.posLabelAction.setDefaultWidget(self.posLabel) self.addAction(self.posLabelAction) self.centerAction = QAction(QIcon(':/plugins/PosiView/center.png'), "Center &Map", self) self.addAction(self.centerAction) self.deleteTrackAction = QAction(QIcon(':/plugins/PosiView/deletetrack.png'), 'Delete &Track', self) self.addAction(self.deleteTrackAction) self.deleteTrackAction.triggered.connect(self.mobile.deleteTrack) self.centerAction.triggered.connect(self.mobile.centerOnMap)
def getIcon(icon_name): icon = QIcon.fromTheme(icon_name) if icon.isNull(): icon = QIcon() icon.addFile(':/main/images/' + icon_name + '16.png', QSize(16, 16)) icon.addFile(':/main/images/' + icon_name + '32.png', QSize(32, 32)) return icon
def _mkicon(name, toggle_name=None, icondir=_icondir): icon = QIcon() for size in os.listdir(icondir): current_dir = os.path.join(icondir, size) icon.addFile(os.path.join(current_dir, name + ".png")) if toggle_name: icon.addFile(os.path.join(current_dir, toggle_name + ".png"), QSize(), QIcon.Active, QIcon.On) return icon
def createAction(self, provider): icon = QIcon(':/plugins/PosiView/ledgreen.png') icon.addFile(':/plugins/PosiView/ledgrey.png', QSize(), QIcon.Disabled, QIcon.Off) action = QAction(icon, provider.name, None) button = QToolButton() button.setDefaultAction(action) action.setEnabled(False) provider.deviceConnected.connect(action.setEnabled) provider.deviceDisconnected.connect(action.setDisabled) self.signalMapper.setMapping(action, provider.name) action.triggered.connect(self.signalMapper.map) self.addAction(action) self.actions.append(action)
def initGui(self): self.connect(self, SIGNAL('triggered()'), self.closeEvent) self.connect(self.actionNew_Game_F2, SIGNAL("triggered()"), self.newGame) for i in range(6): self.connect(self.whiteButtons[i], SIGNAL("clicked()"), lambda n="w" + str(i): self.runButton(n)) self.connect(self.blackButtons[i], SIGNAL("clicked()"), lambda n="b" + str(i): self.runButton(n)) for i in range(64): self.connect(self.boardButtons[i], SIGNAL("clicked()"), lambda n="n" + str(i): self.runButton(n)) self.iconMap = {} list = listdir("./Images/") for item in list: icon = QIcon() icon.addFile("./Images/" + item) self.iconMap[item[0] + item[1]] = icon for i in range(0, 6): self.whiteButtons[i].setIcon(self.iconMap["W"+self.piece[i]]) self.blackButtons[i].setIcon(self.iconMap["B"+self.piece[i]])
def init_combo(self): self.m_comboBox_limbaj.clear() self.lista_dictionare = [] localePath = os.path.join(os.path.dirname(__file__), 'i18n', '*.qm') _index = 0 for file_name in glob.glob(localePath): if file_name.endswith('.qm'): _str_initial = os.path.splitext(os.path.basename(file_name))[0] _dict_name = get_denumire_dictionar(_str_initial, __file__) self.lista_dictionare.append(_dict_name) _icon = QIcon() _icon.addFile(self.f_get_icon_path(_index)) _str = get_denumire_tara(get_locale_from_dictionary_filename( "extradictionary_", ".qm", file_name)) self.m_comboBox_limbaj.addItem(_icon, unicode(_str)) _index = _index + 1
def get(self, name, default=None): path = self.find(name) if not path: path = self.find(self.DEFAULT_ICON if default is None else default) if not path: raise IOError(2, "Cannot find %r in %s" % \ (name, self.search_paths())) if self.is_icon_glob(path): icons = self.icon_glob(path) else: icons = [path] from PyQt4.QtGui import QIcon icon = QIcon() for path in icons: icon.addFile(path) return icon
def get(self, name, default=None): path = self.find(name) if not path: path = self.find(self.DEFAULT_ICON if default is None else default) if not path: raise IOError(2, "Cannot find %r in %s" % (name, self.search_paths())) if self.is_icon_glob(path): icons = self.icon_glob(path) else: icons = [path] from PyQt4.QtGui import QIcon icon = QIcon() for path in icons: icon.addFile(path) return icon
def get(self, name, default=None): if name: path = self.find(name) else: path = None if path is None: path = self.find(self.DEFAULT_ICON if default is None else default) if path is None: return QIcon() if self.is_icon_glob(path): icons = self.icon_glob(path) else: icons = [path] icon = QIcon() for path in icons: icon.addFile(path) return icon
def __init__(self,parent = None,name = None,modal = 0,fl = 0): QDialog.__init__(self,parent) # Set up the user interface from Designer. self.__ui = Ui_PluginDialog() self.__ui.setupUi(self) # The default display strategy is to use a separate dialog box # to select the input data. self.viewInputFrame(False) # The icon are supposed to be located in the plugin folder, # i.e. in the same folder than this python module file iconfolder=os.path.dirname(os.path.abspath(__file__)) icon = QIcon() icon.addFile(os.path.join(iconfolder,"input.png")) self.__ui.btnInput.setIcon(icon) icon = QIcon() icon.addFile(os.path.join(iconfolder,"compute.png")) self.__ui.btnCompute.setIcon(icon) icon = QIcon() icon.addFile(os.path.join(iconfolder,"refresh.png")) self.__ui.btnRefresh.setIcon(icon) icon = QIcon() icon.addFile(os.path.join(iconfolder,"publish.png")) self.__ui.btnPublish.setIcon(icon) icon = QIcon() icon.addFile(os.path.join(iconfolder,"clear.png")) self.__ui.btnClear.setIcon(icon) # Then, we can connect the slot to there associated button event self.connect(self.__ui.btnInput, SIGNAL('clicked()'), self.onInput ) self.connect(self.__ui.btnCompute, SIGNAL('clicked()'), self.onCompute ) self.connect(self.__ui.btnRefresh, SIGNAL('clicked()'), self.onRefresh ) self.connect(self.__ui.btnPublish, SIGNAL('clicked()'), self.onPublish ) self.connect(self.__ui.btnClear, SIGNAL('clicked()'), self.onClear ) self.clear() self.setupJobManager()
def main(): try: app = QApplication([]) app_icon = QIcon() app_icon.addFile('PTR_ICON.ico') app.setWindowIcon(app_icon) form = PythonTestRunner() form.setWindowTitle('Python Test Runner') timer = QTimer() timer.setInterval(1000) timer.timeout.connect(form.timerTick) timer.start() form.consoleLogWindow() form.show() app.exec_() except KeyboardInterrupt: print("Shutdown requested...exiting") except Exception: traceback.print_exc(file=sys.stdout) sys.exit(0)
def main(): # Assign this program an App ID so that the task bar icon will appear on Windows. if platform.system() == "Windows": import ctypes ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(u'aiudirog.checkersoverip.main.1') app = QApplication(sys.argv) # Create and set application icon app_icon = QIcon() app_icon.addFile(os.path.join(Gl.Graphics, "Logos", 'Logo16x16.png'), QSize(16, 16)) app_icon.addFile(os.path.join(Gl.Graphics, "Logos", 'Logo24x24.png'), QSize(24, 24)) app_icon.addFile(os.path.join(Gl.Graphics, "Logos", 'Logo32x32.png'), QSize(32, 32)) app_icon.addFile(os.path.join(Gl.Graphics, "Logos", 'Logo48x48.png'), QSize(48, 48)) app_icon.addFile(os.path.join(Gl.Graphics, "Logos", 'Logo.png'), QSize(108, 108)) app_icon.addFile(os.path.join(Gl.Graphics, "Logos", 'Logo256x256.png'), QSize(256, 256)) Gl.AppIcon = app_icon app.setWindowIcon(Gl.AppIcon) Gl.mainWindow = Window(app.desktop().screenGeometry()) sys.exit(app.exec_())
# attempt to load gui; fallback if import error if not options.no_gui: try: # Import here to avoid importing QT in CLI mode from SWParser.gui import gui from PyQt4.QtGui import QApplication, QIcon from PyQt4.QtCore import QSize except ImportError: print "Failed to load GUI dependencies. Switching to CLI mode" options.no_gui = True if options.no_gui: logger.addHandler(logging.StreamHandler()) start_proxy_server(options) else: app = QApplication(sys.argv) # set the icon icons_path = os.path.join(os.getcwd(), resource_path("icons/")) app_icon = QIcon() app_icon.addFile(icons_path +'16x16.png', QSize(16,16)) app_icon.addFile(icons_path + '24x24.png', QSize(24,24)) app_icon.addFile(icons_path + '32x32.png', QSize(32,32)) app_icon.addFile(icons_path + '48x48.png', QSize(48,48)) app_icon.addFile(icons_path + '256x256.png', QSize(256,256)) app.setWindowIcon(app_icon) win = gui.MainWindow(get_external_ip(), options.port) logger.addHandler(gui.GuiLogHandler(win)) win.show() sys.exit(app.exec_())
def __init__(self, parent=None, iface=None): """Constructor. :param parent: Optional widget to use as parent :type parent: QWidget :param iface: An instance of QGisInterface :type iface: QGisInterface """ super(SymbologySharingDialog, self).__init__(parent) self.setupUi(self) self.iface = iface self.repository_manager = RepositoryManager() # Init the message bar self.message_bar = QgsMessageBar(self) self.message_bar.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed) self.vlayoutRightColumn.insertWidget(0, self.message_bar) # Mock plugin manager dialog self.resize(796, 594) self.setMinimumSize(QSize(790, 0)) self.setModal(True) self.button_edit.setEnabled(False) self.button_delete.setEnabled(False) # Set QListWidgetItem # All icon_all = QIcon() icon_all.addFile( resources_path('img', 'plugin.svg'), QSize(), QIcon.Normal, QIcon.Off) item_all = QListWidgetItem() item_all.setIcon(icon_all) item_all.setText(self.tr('All')) # Installed icon_installed = QIcon() icon_installed.addFile( resources_path('img', 'plugin-installed.svg'), QSize(), QIcon.Normal, QIcon.Off) item_installed = QListWidgetItem() item_installed.setIcon(icon_installed) item_installed.setText(self.tr('Installed')) item_all.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled) # Settings icon_settings = QIcon() icon_settings.addFile( resources_path('img', 'settings.svg'), QSize(), QIcon.Normal, QIcon.Off) item_settings = QListWidgetItem() item_settings.setIcon(icon_settings) item_settings.setText(self.tr('Settings')) item_all.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled) # Add the list widget item to the widget self.menu_list_widget.addItem(item_all) self.menu_list_widget.addItem(item_installed) self.menu_list_widget.addItem(item_settings) # Slots self.button_add.clicked.connect(self.add_repository) self.button_edit.clicked.connect(self.edit_repository) self.button_delete.clicked.connect(self.delete_repository) self.menu_list_widget.currentRowChanged.connect(self.set_current_tab) # Creating progress dialog for downloading stuffs self.progress_dialog = QProgressDialog(self) self.progress_dialog.setAutoClose(False) title = self.tr('Symbology Sharing') self.progress_dialog.setWindowTitle(title) # Populate tree repositories with registered repositories self.populate_tree_repositories()
edit_current_action = QAction(mw) edit_current_action.setText(_(u"Edit current")) edit_current_action.setIcon(QIcon(os.path.join(icons_dir, 'edit_current.png'))) edit_current_action.setToolTip(_(u"Edit the current note.")) mw.connect(edit_current_action, SIGNAL("triggered()"), go_edit_current) edit_layout_action = QAction(mw) edit_layout_action.setText(_(u"Edit layout")) edit_layout_action.setIcon(QIcon(os.path.join(icons_dir, 'edit_layout.png'))) edit_layout_action.setToolTip(_(u"Edit the layout of the current card.")) mw.connect(edit_layout_action, SIGNAL("triggered()"), go_edit_layout) toggle_mark_action = QAction(mw) toggle_mark_action.setText(_(u"Mark")) toggle_mark_action.setCheckable(True) toggle_mark_action.setToolTip(_(u"Mark or unmark the current note.")) toggle_mark_icon = QIcon() toggle_mark_icon.addFile(os.path.join(icons_dir, 'mark_off.png')) toggle_mark_icon.addFile(os.path.join(icons_dir, 'mark_on.png'), QSize(), QIcon.Normal, QIcon.On) toggle_mark_action.setIcon(toggle_mark_icon) mw.connect(toggle_mark_action, SIGNAL("triggered()"), mw.reviewer.onMark) toggle_last_card_action = QAction(mw) toggle_last_card_action.setText(_(u"Last card")) toggle_last_card_action.setCheckable(True) toggle_last_card_action.setChecked(False) toggle_last_card_action.setToolTip(_(u"Make this card the last to review.")) toggle_last_card_icon = QIcon() toggle_last_card_icon.addFile(os.path.join(icons_dir, 'last_card_off.png')) toggle_last_card_icon.addFile(os.path.join(icons_dir, 'last_card_on.png'), QSize(), QIcon.Normal, QIcon.On) toggle_last_card_action.setIcon(toggle_last_card_icon) bury_action = QAction(mw)
def definir_icono(self, boton, ruta): icon = QIcon() archivo = pilasengine.utils.obtener_ruta_al_recurso(ruta) icon.addFile(archivo, QtCore.QSize(), QIcon.Normal, QIcon.Off) boton.setIcon(icon) boton.setText('')
def __init__(self): self.internal_net = '' self.external_net = '' self.unconfigured = True self.searchfound = False self.foundunenc = False self.foundunprot = False self.foundprot = False if os.path.exists('tapioca.cfg'): with open('tapioca.cfg') as f: configlines = f.readlines() for line in configlines: if line.startswith('external_net'): line = line.rstrip() self.external_net = line.split('=')[1] if line.startswith('internal_net'): line = line.rstrip() self.internal_net = line.split('=')[1] if self.external_net != 'WAN_DEVICE' and self.internal_net != 'LAN_DEVICE': self.unconfigured = False QWidget.__init__(self) self.setWindowTitle('Tapioca') app_icon = QIcon() app_icon.addFile('cert.ico', QtCore.QSize(32, 32)) self.setWindowIcon(app_icon) self.lblupstream = QLabel('<b>Upstream-network device:</b>') self.lblupstreamval = QLabel(self.external_net) self.lblupstreamval.setToolTip( 'Ethernet device used for internet connectivity') self.lbllocal = QLabel('<b>Locally-provided-network device:</b>') self.lbllocalval = QLabel(self.internal_net) self.lbllocalval.setToolTip( 'Ethernet device used for connectivity to device under test') self.spacer = QLabel() self.net_status = QLabel() self.appname = '' self.lblapp = QLabel('<b>Capture session:</b>') self.cboapp = QComboBox() self.cboapp.setEditable(True) self.cboapp.setToolTip( 'Select an existing session from the dropdown or type a new one') #self.leapp = QLineEdit() self.btntcpdump = QPushButton('Capture - All traffic with tcpdump') self.btntcpdump.setToolTip( 'Launch tcpdump to capture all traffic without interception') self.lbltcpdump = QLabel() self.chkrewrite = QCheckBox('Modify mitmproxy traffic') self.chkrewrite.setToolTip( 'Edit mitmproxy rules for traffic modification.\nOnly affects "Verify SSL Validation" and "Full HTTPS inspection" tests' ) self.btnrewrite = QPushButton('Edit modification rules') self.btnrewrite.setToolTip('Modify mitmproxy traffic rewriting rules') self.btnrewrite.setEnabled(False) self.btnssl = QPushButton('Capture - Verify SSL validation') self.btnssl.setToolTip( 'Launch mitmproxy to capture HTTP(S) traffic with an invalid certificate' ) self.lblssltest = QLabel() self.btnfull = QPushButton('Capture - Full HTTPS inspection') self.btnfull.setToolTip( 'Launch mitmproxy to capture HTTP(S) traffic with an installed certificate' ) self.lblfull = QLabel() self.btnstop = QPushButton('Stop current capture') self.allreports = QPushButton('Generate reports') self.allreports.setToolTip( 'Generate reports for all tests performed for this capture') self.lblsslresults = QLabel('<b>SSL test results:</b>') self.lblsslresultsval = QLabel() self.lblcryptoresults = QLabel('<b>Crypto test results:</b>') self.lblcryptoresultsval = QLabel() self.lblnetresults = QLabel( '<b>Network connectivity test results:</b>') self.lblnetresultsval = QLabel() self.lblsearch = QLabel('<b>Search term:</b>') self.searchbox = QLineEdit() self.searchbox.setToolTip( 'Case-insensitive perl-compatible regex pattern') self.chksearch = QCheckBox('Search multiple encodings') self.chksearch.setToolTip( 'Search for base64, md5, and sha1 encodings as well - INCOMPATIBLE with Regex' ) self.btnsearch = QPushButton('Search') self.btnsearch.setToolTip( 'Search for term (perl-compatible regex) in all captures') self.lblsearchresults = QLabel() self.lblsearchfound = QLabel() self.lblsearchunprotfound = QLabel() self.lblsearchprotfound = QLabel() #layout = QVBoxLayout(self) layout = QFormLayout(self) layout.addRow(self.lblupstream, self.lblupstreamval) layout.addRow(self.lbllocal, self.lbllocalval) layout.addRow(self.net_status) #layout.addRow(self.lblapp, self.leapp) layout.addRow(self.lblapp, self.cboapp) layout.addRow(self.btntcpdump, self.lbltcpdump) layout.addRow(self.btnssl, self.lblssltest) layout.addRow(self.btnfull, self.lblfull) layout.addRow(self.chkrewrite, self.btnrewrite) layout.addRow(self.btnstop) layout.addRow(self.spacer) layout.addRow(self.spacer) layout.addRow(self.lblsearch, self.searchbox) layout.addRow(self.chksearch, self.btnsearch) layout.addRow(self.lblsearchresults, self.lblsearchfound) layout.addRow(self.spacer, self.lblsearchunprotfound) layout.addRow(self.spacer, self.lblsearchprotfound) layout.addRow(self.allreports) layout.addRow(self.lblsslresults, self.lblsslresultsval) layout.addRow(self.lblcryptoresults, self.lblcryptoresultsval) layout.addRow(self.lblnetresults, self.lblnetresultsval) self.setFixedSize(480, 420) self.center() if self.unconfigured: self.net_status.setText( '<font color="red"><b>Please enable soft AP or configure networks</b></font>' ) self.disabletests() self.disablestop() if not self.checklan(): self.net_status.setText( '<font color="red"><b>LAN device %s not found</b></font>' % self.internal_net) self.disabletests() self.disablestop()
def set_icon(self, boton, ruta, text=''): icon = QIcon() archivo = pilasengine.utils.obtener_ruta_al_recurso(ruta) icon.addFile(archivo, QSize(), QIcon.Normal, QIcon.Off) boton.setIcon(icon) boton.setText(text)
def setupUi(self): super(ScreensharingToolbox, self).setupUi(self) # fix the SVG icons, as the generated code loads them as pixmaps, losing their ability to scale -Dan scale_icon = QIcon() scale_icon.addFile(Resources.get('icons/scale.svg'), mode=QIcon.Normal, state=QIcon.Off) viewonly_icon = QIcon() viewonly_icon.addFile(Resources.get('icons/viewonly.svg'), mode=QIcon.Normal, state=QIcon.Off) screenshot_icon = QIcon() screenshot_icon.addFile(Resources.get('icons/screenshot.svg'), mode=QIcon.Normal, state=QIcon.Off) fullscreen_icon = QIcon() fullscreen_icon.addFile(Resources.get('icons/fullscreen.svg'), mode=QIcon.Normal, state=QIcon.Off) fullscreen_icon.addFile(Resources.get('icons/fullscreen-exit.svg'), mode=QIcon.Normal, state=QIcon.On) fullscreen_icon.addFile(Resources.get('icons/fullscreen-exit.svg'), mode=QIcon.Active, state=QIcon.On) fullscreen_icon.addFile(Resources.get('icons/fullscreen-exit.svg'), mode=QIcon.Disabled, state=QIcon.On) fullscreen_icon.addFile(Resources.get('icons/fullscreen-exit.svg'), mode=QIcon.Selected, state=QIcon.On) minimize_icon = QIcon() minimize_icon.addFile(Resources.get('icons/minimize.svg'), mode=QIcon.Normal, state=QIcon.Off) minimize_icon.addFile(Resources.get('icons/minimize-active.svg'), mode=QIcon.Active, state=QIcon.Off) close_icon = QIcon() close_icon.addFile(Resources.get('icons/close.svg'), mode=QIcon.Normal, state=QIcon.Off) close_icon.addFile(Resources.get('icons/close-active.svg'), mode=QIcon.Active, state=QIcon.Off) self.scale_action.setIcon(scale_icon) self.viewonly_action.setIcon(viewonly_icon) self.screenshot_action.setIcon(screenshot_icon) self.fullscreen_action.setIcon(fullscreen_icon) self.minimize_action.setIcon(minimize_icon) self.close_action.setIcon(close_icon) self.scale_button.setIcon(scale_icon) self.viewonly_button.setIcon(viewonly_icon) self.screenshot_button.setIcon(screenshot_icon) self.fullscreen_button.setIcon(fullscreen_icon) self.minimize_button.setIcon(minimize_icon) self.close_button.setIcon(close_icon) self.scale_button.setDefaultAction(self.scale_action) self.viewonly_button.setDefaultAction(self.viewonly_action) self.screenshot_button.setDefaultAction(self.screenshot_action) self.fullscreen_button.setDefaultAction(self.fullscreen_action) self.minimize_button.setDefaultAction(self.minimize_action) self.close_button.setDefaultAction(self.close_action) self.color_depth_button.clear() self.color_depth_button.addItem('Default Color Depth', ServerDefault) self.color_depth_button.addItem('TrueColor (24 bits)', TrueColor) self.color_depth_button.addItem('HighColor (16 bits)', HighColor) self.color_depth_button.addItem('LowColor (8 bits)', LowColor)
# attempt to load gui; fallback if import error if not options.no_gui: try: # Import here to avoid importing QT in CLI mode from SWParser.gui import gui from PyQt4.QtGui import QApplication, QIcon from PyQt4.QtCore import QSize except ImportError: print "Failed to load GUI dependencies. Switching to CLI mode" options.no_gui = True if options.no_gui: logger.addHandler(logging.StreamHandler()) start_proxy_server(options) else: app = QApplication(sys.argv) # set the icon icons_path = os.path.join(os.getcwd(), resource_path("icons/")) app_icon = QIcon() app_icon.addFile(icons_path + '16x16.png', QSize(16, 16)) app_icon.addFile(icons_path + '24x24.png', QSize(24, 24)) app_icon.addFile(icons_path + '32x32.png', QSize(32, 32)) app_icon.addFile(icons_path + '48x48.png', QSize(48, 48)) app_icon.addFile(icons_path + '256x256.png', QSize(256, 256)) app.setWindowIcon(app_icon) win = gui.MainWindow(get_external_ip(), options.port) logger.addHandler(gui.GuiLogHandler(win)) win.show() sys.exit(app.exec_())
edit_current_action = QAction(mw) edit_current_action.setText(_(u"Edit current")) edit_current_action.setIcon(QIcon(os.path.join(icons_dir, 'edit_current.png'))) edit_current_action.setToolTip(_(u"Edit the current note.")) mw.connect(edit_current_action, SIGNAL("triggered()"), go_edit_current) edit_layout_action = QAction(mw) edit_layout_action.setText(_(u"Edit layout")) edit_layout_action.setIcon(QIcon(os.path.join(icons_dir, 'edit_layout.png'))) edit_layout_action.setToolTip(_(u"Edit the layout of the current card.")) mw.connect(edit_layout_action, SIGNAL("triggered()"), go_edit_layout) toggle_mark_action = QAction(mw) toggle_mark_action.setText(_(u"Mark")) toggle_mark_action.setCheckable(True) toggle_mark_action.setToolTip(_(u"Mark or unmark the current note.")) toggle_mark_icon = QIcon() toggle_mark_icon.addFile(os.path.join(icons_dir, 'mark_off.png')) toggle_mark_icon.addFile(os.path.join(icons_dir, 'mark_on.png'), QSize(), QIcon.Normal, QIcon.On) toggle_mark_action.setIcon(toggle_mark_icon) mw.connect(toggle_mark_action, SIGNAL("triggered()"), mw.reviewer.onMark) toggle_last_card_action = QAction(mw) toggle_last_card_action.setText(_(u"Last card")) toggle_last_card_action.setCheckable(True) toggle_last_card_action.setChecked(False) toggle_last_card_action.setToolTip(_(u"Make this card the last to review.")) toggle_last_card_icon = QIcon() toggle_last_card_icon.addFile(os.path.join(icons_dir, 'last_card_off.png')) toggle_last_card_icon.addFile(os.path.join(icons_dir, 'last_card_on.png'), QSize(), QIcon.Normal, QIcon.On) toggle_last_card_action.setIcon(toggle_last_card_icon) mute_action = QAction(mw)
def SWProxyStart(ip, port, log): # parser = argparse.ArgumentParser(description='SWParser') # parser.add_argument('-d', '--debug', action="store_true", default=False) # parser.add_argument('-g', '--no-gui', action="store_true", default=False) # parser.add_argument('-p', '--port', type=int, default=8080) # options, unknown_args = parser.parse_known_args() unknown_args = '' options = Option(ip=ip, port=port, debug=log, no_gui=True) # Set up logger level = "DEBUG" if options.debug else "INFO" logging.basicConfig( level=level, filename="proxy.log", format='%(asctime)s: %(name)s - %(levelname)s - %(message)s') logger.setLevel(logging.INFO) print get_usage_text() # Check if a PCAP file was passed in pcap_filename = None for arg in unknown_args: if arg.endswith('.pcap'): pcap_filename = arg break if pcap_filename: # Parse a PCAP file print "Parsing PCAP file..." parse_pcap(sys.argv[1]) raw_input("Press Enter to exit...") else: # Run the proxy # attempt to load gui; fallback if import error if not options.no_gui: try: # Import here to avoid importing QT in CLI mode from SWParser.gui import gui from PyQt4.QtGui import QApplication, QIcon from PyQt4.QtCore import QSize except ImportError: print "Failed to load GUI dependencies. Switching to CLI mode" options.no_gui = True if options.no_gui: logger.addHandler(logging.StreamHandler()) start_proxy_server(options) else: app = QApplication(sys.argv) # set the icon icons_path = os.path.join(os.getcwd(), resource_path("icons/")) app_icon = QIcon() app_icon.addFile(icons_path + '16x16.png', QSize(16, 16)) app_icon.addFile(icons_path + '24x24.png', QSize(24, 24)) app_icon.addFile(icons_path + '32x32.png', QSize(32, 32)) app_icon.addFile(icons_path + '48x48.png', QSize(48, 48)) app_icon.addFile(icons_path + '256x256.png', QSize(256, 256)) app.setWindowIcon(app_icon) win = gui.MainWindow(options.ip, options.port) logger.addHandler(gui.GuiLogHandler(win)) win.show() sys.exit(app.exec_())
def makeIcon( name ) : icon = QIcon() for res in '16 22 32'.split() : icon.addFile( ':/images/%s%s.png' % (name,res) ) return icon
def __init__(self, parent=None, name="InputDialog", modal=0): """ This initializes a dialog windows to define the input data of the plugin function. The input data consist in a list of meshes characterizes each by a name, a pointer to the smesh servant object, a type and a group name (see data model in the inputdata.py). """ GenericDialog.__init__(self, parent, name, modal) # Set up the user interface from Designer. self.__ui = Ui_InputFrame() # BE CAREFULL HERE, the ui form is NOT drawn in the global # dialog (already containing some generic widgets) but in the # center panel created in the GenericDialog as a void # container for the form. The InputFrame form is supposed # here to create only the widgets to be placed in the center # panel. Then, the setupUi function of this form draws itself # in the specified panel, i.e. the panel returned by # self.getPanel(). self.__ui.setupUi(self.getPanel()) self.setWindowTitle("Specification of input files") # The icon are supposed to be located in the plugin folder, # i.e. in the same folder than this python module file iconfolder=os.path.dirname(os.path.abspath(__file__)) icon = QIcon() icon.addFile(os.path.join(iconfolder,"select.png")) self.__ui.btnSmeshObject.setIcon(icon) icon = QIcon() icon.addFile(os.path.join(iconfolder,"addinput.png")) self.__ui.btnAddInput.setIcon(icon) icon = QIcon() icon.addFile(os.path.join(iconfolder,"deleteinput.png")) self.__ui.btnDeleteInput.setIcon(icon) # We specify here the items in the combo box (even if already # defined in the designer) so that we can be sure of the item # indexation. self.MESHTYPE_ICONS = {} meshTypeIndex = InputData.MESHTYPES.CONCRETE self.__ui.cmbMeshType.setItemText(meshTypeIndex, "Béton") icon = QIcon() icon.addFile(os.path.join(iconfolder,"concrete.png")) self.__ui.cmbMeshType.setItemIcon(meshTypeIndex, icon) self.MESHTYPE_ICONS[meshTypeIndex] = icon meshTypeIndex = InputData.MESHTYPES.STEELBAR self.__ui.cmbMeshType.setItemText(meshTypeIndex, "Acier") icon = QIcon() icon.addFile(os.path.join(iconfolder,"steelbar.png")) self.__ui.cmbMeshType.setItemIcon(meshTypeIndex, icon) self.MESHTYPE_ICONS[meshTypeIndex] = icon # The click on btnSmeshObject (signal clicked() emitted by the # button btnSmeshObject) is connected to the slot # onSelectSmeshObject, etc ... self.connect(self.__ui.btnSmeshObject, SIGNAL('clicked()'), self.onSelectSmeshObject ) self.connect(self.__ui.btnAddInput, SIGNAL('clicked()'), self.onAddInput ) self.connect(self.__ui.btnDeleteInput, SIGNAL('clicked()'), self.onDeleteInput ) # Set up the model of the Qt table list self.__inputModel = QStandardItemModel(0,2) self.__inputModel.setHorizontalHeaderLabels(InputDialog.TBL_HEADER_LABEL) self.__ui.tblListInput.setModel(self.__inputModel) self.__ui.tblListInput.verticalHeader().hide() self.__ui.tblListInput.horizontalHeader().setStretchLastSection(True) # Note that the type is not display explicitly in the Qt table # because it is specified using an icon on the text of the # name item. # Note that PADDER does not support group name longer than 8 # characters. We apply then this limit in the gui field. self.__ui.txtGroupName.setMaxLength(GROUPNAME_MAXLENGTH) self.clear() self.smeshStudyTool = SMeshStudyTools()
def __init__(self, parent=None, iface=None): """Constructor. :param parent: Optional widget to use as parent :type parent: QWidget :param iface: An instance of QGisInterface :type iface: QGisInterface """ super(SymbologySharingDialog, self).__init__(parent) self.setupUi(self) self.iface = iface self.repository_manager = RepositoryManager() # Init the message bar self.message_bar = QgsMessageBar(self) self.message_bar.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed) self.vlayoutRightColumn.insertWidget(0, self.message_bar) # Mock plugin manager dialog self.resize(796, 594) self.setMinimumSize(QSize(790, 0)) self.setModal(True) self.button_edit.setEnabled(False) self.button_delete.setEnabled(False) # Set QListWidgetItem # All icon_all = QIcon() icon_all.addFile(resources_path('img', 'plugin.svg'), QSize(), QIcon.Normal, QIcon.Off) item_all = QListWidgetItem() item_all.setIcon(icon_all) item_all.setText(self.tr('All')) # Installed icon_installed = QIcon() icon_installed.addFile(resources_path('img', 'plugin-installed.svg'), QSize(), QIcon.Normal, QIcon.Off) item_installed = QListWidgetItem() item_installed.setIcon(icon_installed) item_installed.setText(self.tr('Installed')) item_all.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled) # Settings icon_settings = QIcon() icon_settings.addFile(resources_path('img', 'settings.svg'), QSize(), QIcon.Normal, QIcon.Off) item_settings = QListWidgetItem() item_settings.setIcon(icon_settings) item_settings.setText(self.tr('Settings')) item_all.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled) # Add the list widget item to the widget self.menu_list_widget.addItem(item_all) self.menu_list_widget.addItem(item_installed) self.menu_list_widget.addItem(item_settings) # Slots self.button_add.clicked.connect(self.add_repository) self.button_edit.clicked.connect(self.edit_repository) self.button_delete.clicked.connect(self.delete_repository) self.menu_list_widget.currentRowChanged.connect(self.set_current_tab) # Creating progress dialog for downloading stuffs self.progress_dialog = QProgressDialog(self) self.progress_dialog.setAutoClose(False) title = self.tr('Symbology Sharing') self.progress_dialog.setWindowTitle(title) # Populate tree repositories with registered repositories self.populate_tree_repositories()