def __init__(self): QMainWindow.__init__(self) icons = myIcons() self.getIcon = icons.getIcon self.setWindowTitle('IRAM GUI') self.resize(QSize(1200, 800)) self.setWindowIcon(self.getIcon('Jupiter')) self.measurements = None self.centralwidget = CentralWidget(self) self.setCentralWidget(self.centralwidget) self.HKvalues = self.centralwidget.HKvalues self.Controlvalues = self.centralwidget.Controlvalues self.sBar = self.centralwidget.sBar self.init = False self.running = False self.measureThread = measure(self) self.timer = QTimer() self.timer.timeout.connect(self.updateTimer) self.timer.start(200) self.time = localtime() self.closeEvent = self.closeApp
def __init__(self): QMainWindow.__init__(self) self.setWindowIcon(get_icon(os.path.join(APP_RESOURCES, 'icons', 'python.png'))) self.setupUi(self) # Redirect output to GUI's QTextEdit sys.stdout = OutLog(self.outputTextEdit, sys.stdout) sys.stderr = OutLog(self.outputTextEdit, sys.stderr, QColor(255,0,0) ) settings = QSettings() size = settings.value("MainWindow/Size", QVariant(QSize(600, 500))).toSize() self.resize(size) position = settings.value("MainWindow/Position", QVariant(QPoint(0, 0))).toPoint() self.move(position) self.restoreState( settings.value("MainWindow/State").toByteArray()) self.logger = Logger('Zupport.GUIloader') self.logger.debugging = settings.value("Logging/debugging").toBool() # Set up a ZupportManager to deal with the plugins self.manager = Manager(self) self.plugins = {} # Set up the extents menu self.extent = ExtentContainer() self.menuExtent = QMenu("Extent") resolutions = self.extent.resolutions self.extenactiongroup = QActionGroup(self.menuExtent) noneaction = QAction("None", self.menuExtent) self.extenactiongroup.addAction(noneaction) self.menuExtent.addAction(noneaction) for resolution in resolutions: resolution_text = str(resolution) submenu = self.menuExtent.addMenu(resolution_text) self.menuExtent.addMenu(submenu) for area in self.extent.get_names(resolution): subaction = QAction(str(area) + ": %s" % resolution_text, submenu) subaction.setCheckable(True) self.extenactiongroup.addAction(subaction) submenu.addAction(subaction) noneaction.isChecked() self.menuSettings.addMenu(self.menuExtent) self.actionDebugging_messages.setChecked(self.logger.debugging) self.setWindowTitle("Zupport GUI") self.load_tools() self.toolTreeWidget.itemSelectionChanged.connect(self.update_ui) self.actionDebugging_messages.toggled.connect(self._set_debugging) self.menuExtent.triggered.connect(self.update_ui) self.actionLoad_tool.triggered.connect(self.show_tool_gui) self.toolTreeWidget.doubleClicked.connect(self.show_tool_gui)
def sizeHint(self): hint = QLabel.sizeHint(self) width, height = hint.width(), hint.height() angle = self.angle * pi / 180 rotated_width = abs(width * cos(angle)) + abs(height * sin(angle)) rotated_height = abs(width * sin(angle)) + abs(height * cos(angle)) return QSize(rotated_width, rotated_height)
def __init__(self, package, parent=None): QSplitter.__init__(self, parent) self.setWindowTitle(_("Tests - %s module") % package.__name__) self.setWindowIcon(get_icon("%s.svg" % package.__name__, "guidata.svg")) test_package_name = '%s.tests' % package.__name__ _temp = __import__(test_package_name) test_package = sys.modules[test_package_name] tests = get_tests(test_package) listwidget = QListWidget(self) listwidget.addItems([osp.basename(test.filename) for test in tests]) self.properties = TestPropertiesWidget(self) self.addWidget(listwidget) self.addWidget(self.properties) self.properties.run_button.clicked.connect( lambda: tests[listwidget.currentRow()].run()) self.properties.quit_button.clicked.connect(self.close) listwidget.currentRowChanged.connect( lambda row: self.properties.set_item(tests[row])) listwidget.itemActivated.connect( lambda: tests[listwidget.currentRow()].run()) listwidget.setCurrentRow(0) QShortcut(QKeySequence("Escape"), self, self.close) self.setSizes([150, 1]) self.setStretchFactor(1, 1) self.resize(QSize(950, 600)) self.properties.set_item(tests[0])
def test_update(self): obj = QwtSymbol(QwtSymbol.Rect, QBrush(Qt.black), QPen(Qt.yellow), QSize(3, 3)) sym = SymbolParam(_("Symbol")) sym.update_param(obj) self.assertEqual(sym.marker, "Rect") self.assertEqual(sym.size, 3) self.assertEqual(sym.edgecolor, "#ffff00") self.assertEqual(sym.facecolor, "#000000")
def __init__(self, parent=None): QSplitter.__init__(self, parent) self.setWindowTitle(MAIN_WINDOW_TITLE) self.setWindowIcon(get_icon("agent.svg")) self.sysTray = SystemTray(self) self.connect(self.sysTray, SIGNAL("activated(QSystemTrayIcon::ActivationReason)"), self.__icon_activated) checks = get_checks() datadog_conf = DatadogConf(get_config_path(), description="Agent settings file: datadog.conf") self.log_file = LogFile() listwidget = QListWidget(self) listwidget.addItems([osp.basename(check.module_name).replace("_", " ").title() for check in checks]) self.properties = PropertiesWidget(self) self.addWidget(listwidget) self.addWidget(self.properties) self.connect(self.properties.enable_button, SIGNAL("clicked()"), lambda: enable_check(self.properties)) self.connect(self.properties.disable_button, SIGNAL("clicked()"), lambda: disable_check(self.properties)) self.connect(self.properties.save_button, SIGNAL("clicked()"), lambda: save_file(self.properties)) self.connect(listwidget, SIGNAL('currentRowChanged(int)'), lambda row: self.properties.set_item(checks[row])) self.connect(self.properties.edit_datadog_conf_button, SIGNAL('clicked()'), lambda: self.properties.set_datadog_conf(datadog_conf)) self.connect(self.properties.view_log_button, SIGNAL('clicked()'), lambda: self.properties.set_log_file(self.log_file)) self.manager_menu = Menu(self) self.connect(self.properties.menu_button, SIGNAL("clicked()"), lambda: self.manager_menu.popup(self.properties.menu_button.mapToGlobal(QPoint(0,0)))) listwidget.setCurrentRow(0) self.setSizes([150, 1]) self.setStretchFactor(1, 1) self.resize(QSize(950, 600)) self.properties.set_datadog_conf(datadog_conf) self.do_refresh()
def __init__(self, start_freq, bandwidth, numpts, bg7dev, mdev, max_cycle_count=5, atten_step=2): QMainWindow.__init__(self) self.setWindowIcon(get_icon('python.png')) self.setWindowTitle(APP_NAME + ' ' + VERS + ' Running on ' + bg7dev + ' & ' + mdev) dt = QDesktopWidget() print(dt.numScreens(), dt.screenGeometry()) sz = dt.screenGeometry() self.resize(QSize(sz.width() * 6 / 10, 256)) # Welcome message in statusbar: status = self.statusBar() status.showMessage( _("Welcome to the NetworkAnalyser Calibration application!"), 5000) self.prog = QProgressBar(self) self.prog.setMaximumHeight(32) self.mainwidget = self.prog self.prog.show() self.bg7 = BG7(start_freq, bandwidth, numpts, sport=bg7dev) self.reset_data() self.fp_micro = serial.Serial(mdev, 115200, timeout=4) self.bg7.measurement_progress.connect(self.measurement_progress) self.bg7.measurement_complete.connect(self.measurement_complete) self.fname = 'cal_' + str(start_freq) + '_' + str( bandwidth) + '_' + str(numpts) + '.pkl' self.max_cycle_count = max_cycle_count self.max_atten_val = 62 self.atten_val = 0 self.atten_step = atten_step self.update_atten() self.count_data = 0 self.show() self.bg7.start() print('done BG7 start')
def setup(self): """Setup window parameters""" self.setWindowIcon(QIcon("Chicken.png")) self.setWindowTitle(APP_NAME) self.resize(QSize(800, 600)) # Welcome message in statusbar: status = self.statusBar() status.showMessage( _("Welcome to guiqwt application example! 有人注意到這邊有字嗎"), 5000) # File menu file_menu = self.menuBar().addMenu(_("File")) new_action = create_action(self, _("New..."), shortcut="Ctrl+N", icon=get_icon('filenew.png'), tip=_("Create a new image, Ctrl+N"), triggered=self.new_csv) open_action = create_action(self, _("Open..."), shortcut="Ctrl+O", icon=get_icon('fileopen.png'), tip=_("Open a CSV file, Ctrl+O"), triggered=self.open_csv) quit_action = create_action(self, _("Quit"), shortcut="Ctrl+Q", icon=get_std_icon("DialogCloseButton"), tip=_("Quit application, Ctrl+Q"), triggered=self.close) add_actions(file_menu, (new_action, open_action, None, quit_action)) # # Help menu help_menu = self.menuBar().addMenu("?") about_action = create_action( self, _("About..."), icon=get_std_icon('MessageBoxInformation'), triggered=self.about) add_actions(help_menu, (about_action, )) main_toolbar = self.addToolBar("Main") add_actions(main_toolbar, ( new_action, open_action, )) # # Set central widget: toolbar = self.addToolBar("default") # Image toolbar: Image self.mainwidget = CentralWidget(self, toolbar) self.setCentralWidget(self.mainwidget)
def __init__(self): QMainWindow.__init__(self) icons = myIcons() self.getIcon = icons.getIcon self.setWindowTitle('IRAM GUI') self.resize(QSize(1200, 800)) self.setWindowIcon(self.getIcon('Jupiter')) self.measurements = None self.centralwidget = CentralWidget(self) self.setCentralWidget(self.centralwidget) self.HKvalues = self.centralwidget.HKvalues self.Controlvalues = self.centralwidget.Controlvalues self.sBar = self.centralwidget.sBar self.init = False self.running = False try: self.dbr = dbr() self.dbr.init() except: self.dum_dbr = dummy_hardware('DBR') self.dum_dbr.init() try: self.sensors = sensors() self.sensors.init() except: self.dum_HK = dummy_hardware('HOUSEKEEPING') self.dum_HK.init() try: self.chopper = chopper() self.chopper.init() except: self.dum_chop = dummy_hardware('CHOPPER') self.dum_chop.init() self.measureThread = measure(self) self.timer = QTimer() self.timer.timeout.connect(self.updateTimer) self.timer.start(200) self.time = localtime() self.closeEvent = self.closeApp
def __init__(self): QMainWindow.__init__(self) for p in sys.path: if exists(p + '/data/DW.png'): icon_path = p + '/data/DW.png' break if exists(p + '/dw/data/DW.png'): icon_path = p + '/dw/data/DW.png' break self.setWindowIcon(get_icon(icon_path)) self.setWindowTitle(APP_NAME) self.resize(QSize(1024, 768)) self.data = None
def test_changeconfig(self): obj = QwtSymbol(QwtSymbol.Rect, QBrush(Qt.black), QPen(Qt.yellow), QSize(3, 3)) sym = SymbolParam(_("Symbol")) sym.update_param(obj) sym.write_config(CONF, "sym", "") sym = SymbolParam(_("Symbol")) sym.read_config(CONF, "sym", "") self.assertEqual(sym.marker, "Rect") self.assertEqual(sym.size, 3) self.assertEqual(sym.edgecolor, "#ffff00") self.assertEqual(sym.facecolor, "#000000") sym.build_symbol()
def __init__(self, getIcon, *args, **kwargs): QStatusBar.__init__(self, *args, **kwargs) self.ActionIcon = QLabel(u"") self.ActionInfo = QLabel(u"") self.ActionInfo.setFixedWidth(200) self.StreamInfo = QLabel(u"") self.addPermanentWidget(self.ActionIcon) self.addPermanentWidget(self.ActionInfo) openIcon = QLabel(u"") openIcon.setPixmap(getIcon("arrow").pixmap(QSize(16, 16))) self.addPermanentWidget(openIcon) self.addPermanentWidget(self.StreamInfo, 1) self.getIcon = getIcon self._stdout = sys.stdout self._txtStream = io.StringIO() sys.stdout = self._txtStream
def __init__(self): QMainWindow.__init__(self) icons = myIcons() self.getIcon = icons.getIcon self.setWindowTitle('WVR GUI') self.resize(QSize(1200, 800)) self.setWindowIcon(self.getIcon('spectrum')) self.measurements = None self.centralwidget = CentralWidget(self) self.oem = oemWidget(self.centralwidget.tabs, [21, 23]) self.setCentralWidget(self.centralwidget) self.HKvalues = self.centralwidget.HKvalues self.Controlvalues = self.centralwidget.Controlvalues self.sBar = self.centralwidget.sBar self.init = False self.running = False self.oeminit = False self.oemrunning = False self.oemThread = measure2(self.oem) self.measureThread = measure(self) self.timer = QTimer() self.timer.timeout.connect(self.updateTimer) self.timer.start(200) self.time = localtime() self.closeEvent = self.closeApp self._Tc = 0 self._Th = 0
def __init__(self): """Instantiate the main window and setup some parameter""" QMainWindow.__init__(self) for p in sys.path: if exists(p + '/data/'): self.icon_path = p + '/data/' break if exists(p + '/dw/data/'): self.icon_path = p + '/dw/data/' break self.setWindowIcon(get_icon(self.icon_path + 'DW.png')) self.setWindowTitle(APP_NAME) self.resize(QSize(1024, 768)) # Welcome message in statusbar: status = self.statusBar() status.showMessage(_("Welcome to Dish Washer! Open a file to start."), 7000) # File menu & Main toolbar self.set_menu() # Set central widget: self.toolbar = self.addToolBar("Image")
def setup(self, TestGUI): icondir = os.path.dirname(os.path.abspath("__file__")) + "/icons/" icons = [f for f in os.listdir(icondir) if f.find('.png') > -1] self.Icons = {f[0:f.find('.png')]: QIcon(icondir + f) for f in icons} self.setWindowTitle('IRAM GUI') self.resize(QSize(1200, 800)) self.setWindowIcon(self.Icons['Jupiter']) # self.measurements=measurements(sweep=False) self.measurements = None self.mainwidget = CentralWidget(self) self.setCentralWidget(self.mainwidget) self.controlpanel = self.mainwidget.controlpanel self.HKvalues = self.controlpanel.HKvalues self.Controlvalues = self.controlpanel.Controlvalues self.statusbar = self.mainwidget.statusbar self.autoYlim = True self.TestGUI = TestGUI self.init = False self.running = False self.measureThread = measure(self) self.timer = QTimer() self.timer.timeout.connect(self.updateTimer) self.timer.start(100) self.time = localtime() self.closeEvent = self.closeApp
def setActionInfo(self, txt="", icon_name=None): if icon_name is not None: self.mainwidget.ActionIcon.setPixmap(self.Icons[icon_name].pixmap( QSize(16, 16))) self.mainwidget.ActionInfo.setText(txt) self.statusbar.repaint()
def __init__(self, parent=None): log_conf = get_logging_config() QSplitter.__init__(self, parent) self.setWindowTitle(MAIN_WINDOW_TITLE) self.setWindowIcon(get_icon("agent.svg")) self.sysTray = SystemTray(self) self.connect(self.sysTray, SIGNAL("activated(QSystemTrayIcon::ActivationReason)"), self.__icon_activated) checks = get_checks() datadog_conf = DatadogConf(get_config_path()) self.create_logs_files_windows(log_conf) listwidget = QListWidget(self) listwidget.addItems([ osp.basename(check.module_name).replace("_", " ").title() for check in checks ]) self.properties = PropertiesWidget(self) self.setting_button = QPushButton(get_icon("info.png"), "Logs and Status", self) self.menu_button = QPushButton(get_icon("settings.png"), "Actions", self) self.settings = [ ("Forwarder Logs", lambda: [ self.properties.set_log_file(self.forwarder_log_file), self.show_html(self.properties.group_code, self.properties. html_window, False) ]), ("Collector Logs", lambda: [ self.properties.set_log_file(self.collector_log_file), self.show_html(self.properties.group_code, self.properties. html_window, False) ]), ("Dogstatsd Logs", lambda: [ self.properties.set_log_file(self.dogstatsd_log_file), self.show_html(self.properties.group_code, self.properties. html_window, False) ]), ("JMX Fetch Logs", lambda: [ self.properties.set_log_file(self.jmxfetch_log_file), self.show_html(self.properties.group_code, self.properties. html_window, False) ]), ] if Platform.is_windows(): self.settings.extend([ ("Service Logs", lambda: [ self.properties.set_log_file(self.service_log_file), self.show_html(self.properties.group_code, self.properties. html_window, False) ]), ]) self.settings.extend([ ("Agent Status", lambda: [ self.properties.html_window.setHtml(self.properties.html_window .latest_status()), self.show_html(self.properties.group_code, self.properties. html_window, True), self.properties.set_status() ]), ]) self.agent_settings = QPushButton(get_icon("edit.png"), "Settings", self) self.connect( self.agent_settings, SIGNAL("clicked()"), lambda: [ self.properties.set_datadog_conf(datadog_conf), self.show_html(self.properties.group_code, self.properties. html_window, False) ]) self.setting_menu = SettingMenu(self.settings) self.connect( self.setting_button, SIGNAL("clicked()"), lambda: self.setting_menu.popup( self.setting_button.mapToGlobal(QPoint(0, 0)))) self.manager_menu = Menu(self) self.connect( self.menu_button, SIGNAL("clicked()"), lambda: self.manager_menu.popup( self.menu_button.mapToGlobal(QPoint(0, 0)))) holdingBox = QGroupBox("", self) Box = QVBoxLayout(self) Box.addWidget(self.agent_settings) Box.addWidget(self.setting_button) Box.addWidget(self.menu_button) Box.addWidget(listwidget) holdingBox.setLayout(Box) self.addWidget(holdingBox) self.addWidget(self.properties) self.connect(self.properties.enable_button, SIGNAL("clicked()"), lambda: enable_check(self.properties)) self.connect(self.properties.disable_button, SIGNAL("clicked()"), lambda: disable_check(self.properties)) self.connect(self.properties.save_button, SIGNAL("clicked()"), lambda: save_file(self.properties)) self.connect( self.properties.refresh_button, SIGNAL("clicked()"), lambda: [ self.properties.set_log_file(self.properties.current_file), self.properties.html_window.setHtml(self.properties.html_window .latest_status()) ]) self.connect( listwidget, SIGNAL('currentRowChanged(int)'), lambda row: [ self.properties.set_item(checks[row]), self.show_html(self.properties.group_code, self.properties. html_window, False) ]) listwidget.setCurrentRow(0) self.setSizes([150, 1]) self.setStretchFactor(1, 1) self.resize(QSize(950, 600)) self.properties.set_datadog_conf(datadog_conf) self.do_refresh()
def setup(self, start_freq, bandwidth, numpts, max_hold): """Setup window parameters""" self.setWindowIcon(get_icon('python.png')) self.setWindowTitle(APP_NAME + ' ' + VERS + ' Running on ' + self.dev) dt = QDesktopWidget() print dt.numScreens(), dt.screenGeometry() sz = dt.screenGeometry() self.resize(QSize(sz.width() * 9 / 10, sz.height() * 9 / 10)) # Welcome message in statusbar: status = self.statusBar() status.showMessage(_("Welcome to the NetworkAnalyser application!"), 5000) # File menu file_menu = self.menuBar().addMenu(_("File")) open_action = create_action(self, _("Save"), shortcut="Ctrl+S", icon=get_std_icon("DialogSaveButton"), tip=_("Save a Cal File"), triggered=self.saveFileDialog) load_action = create_action(self, _("Load"), shortcut="Ctrl+L", icon=get_std_icon("FileIcon"), tip=_("Load a cal File"), triggered=self.loadFileDialog) quit_action = create_action(self, _("Quit"), shortcut="Ctrl+Q", icon=get_std_icon("DialogCloseButton"), tip=_("Quit application"), triggered=self.close) add_actions(file_menu, (open_action, load_action, None, quit_action)) # Help menu - prolly should just say "you're on your own..."!! help_menu = self.menuBar().addMenu("Help") about_action = create_action( self, _("About..."), icon=get_std_icon('MessageBoxInformation'), triggered=self.about) add_actions(help_menu, (about_action, )) main_toolbar = self.addToolBar("Main") # add_actions(main_toolbar, (new_action, open_action, )) rescan_action = create_action( self, _("Rescan"), shortcut="Ctrl+R", icon=get_std_icon("BrowserReload"), tip=_("Rescan the current frequency selection"), checkable=False, triggered=self.do_scan) max_hold_action = create_action( self, _("Max Hold"), shortcut="Ctrl+M", icon=get_std_icon("ArrowUp"), tip=_("Display the maximum value encountered"), checkable=True, triggered=self.do_max_hold) log_lin_action = create_action(self, _("Log/Lin"), shortcut="Ctrl+L", icon=get_std_icon("ArrowRight"), tip=_("Use linear power receive mode"), checkable=True, triggered=self.do_log_lin) new_plot_action = create_action(self, _("New Plot"), shortcut="Ctrl+N", icon=get_std_icon("ArrowLeft"), tip=_("Creates a new labeled plot"), checkable=False, triggered=self.do_new_plot) if max_hold is None: max_hold = self.settings.value('gui/max_hold', False) print 'Got max_hold', max_hold if type(max_hold) != bool: if max_hold in ['y', 'Y', 'T', 'True', 'true', '1']: max_hold = True else: max_hold = False max_hold_action.setChecked(max_hold) # Calibration action? add_actions(main_toolbar, (open_action, load_action, rescan_action, max_hold_action, log_lin_action, new_plot_action)) # Set central widget: toolbar = self.addToolBar("Image") self.mainwidget = CentralWidget(self, self.settings, toolbar, start_freq, bandwidth, numpts, self.dev) self.setCentralWidget(self.mainwidget) if max_hold: self.do_max_hold()
def sizeHint(self): return QSize(self._width, self.height())
def sizeHint(self): return QSize(self.width(), self._height)
def setInfo(self, txt="", icon_name=None): if icon_name is not None: self.ActionIcon.setPixmap( self.getIcon(icon_name).pixmap(QSize(16, 16))) self.ActionInfo.setText(txt) self.repaint()
def sizeHint(self): return QSize(500, 300)
def sizeHint(self): """Preferred size""" return QSize(400, 300)