def __init__(self, parent): QSplitter.__init__(self, parent) # List Widget self.csvlist = QListWidget(self) self.csvlist.setContextMenuPolicy(Qt.ActionsContextMenu) plotCSV = QAction(self) plotCSV.setText("Plot") plotCSV.triggered.connect(self.plotCSV) delete = QAction(self) delete.setText("Remove") delete.triggered.connect(self.removeItem) extractCSV = QAction(self) extractCSV.setText("Extract to Arrays") extractCSV.triggered.connect(self.extractArray) self.csvlist.addAction(plotCSV) self.csvlist.addAction(extractCSV) self.csvlist.addAction(delete) self.addWidget(self.csvlist) # Properties widget self.properties = DataSetEditGroupBox(_("參數(Properties)"), CsvParam) self.properties.setEnabled(False) self.addWidget(self.properties)
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 __init__(self, parent): QSplitter.__init__(self, parent) self.imagelist = QListWidget(self) self.addWidget(self.imagelist) self.properties = DataSetEditGroupBox(_("Properties"), ImageParam) self.properties.setEnabled(False) self.addWidget(self.properties)
def create_list_dock(self): list_dock = QDockWidget(_('Files')) self.addDockWidget(Qt.RightDockWidgetArea, list_dock) self.list_widget = QListWidget() self.connect( self.list_widget, SIGNAL("currentItemChanged( QListWidgetItem, QListWidgetItem)"), self.change_selection) list_dock.setWidget(self.list_widget)
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, parent=None): QWidget.__init__(self, parent) self.widget_layout = QVBoxLayout() title_layout = QHBoxLayout() title_layout.addStretch() style = "<span style=\'color: #444444\'><b>%s</b></span>" title = QLabel(style % "Operations") title_layout.addWidget(title) title_layout.addStretch() self.widget_layout.addLayout(title_layout) # Create ListWidget and add 10 items to move around. self.list_widget = QListWidget() # self.list_widget.setDragDropMode(QAbstractItemView.InternalMove) self.list_widget.setSelectionMode(QAbstractItemView.ExtendedSelection) self.list_widget.setSortingEnabled(False) self.list_widget.currentItemChanged.connect(self._populate_settings_update) self.widget_layout.addWidget(self.list_widget) otitle_layout = QHBoxLayout() otitle_layout.addStretch() otitle = QLabel(style % "Operation settings") otitle_layout.addWidget(otitle) otitle_layout.addStretch() self.widget_layout.addLayout(otitle_layout) self.operations_combo = QComboBox() self.operations_combo.currentIndexChanged.connect(self._populate_settings_add) self.widget_layout.addWidget(self.operations_combo) self.operation_settings = GenericOperationWidget() self.widget_layout.addWidget(self.operation_settings) self.toolbar = QToolBar() self.toolbar.addAction(get_icon('apply.png'), "Apply/Replace", self._change_operation) self.toolbar.addAction(get_icon('editors/edit_add.png'), "Add after", self._add_operation) self.toolbar.addAction(get_icon('trash.png'), "Remove", self._remove_operation) self.widget_layout.addWidget(self.toolbar) self.setLayout(self.widget_layout)
def __init__(self, parent): QSplitter.__init__(self, parent) # List Widget self.arraylist = QListWidget(self) self.arraylist.setContextMenuPolicy(Qt.ActionsContextMenu) newArray = QAction(self) newArray.setText("Paste Array (no header name)") newArray.triggered.connect(self.pasteArray) newArrayWithName = QAction(self) newArrayWithName.setText("Paste Array (with header name)") newArrayWithName.triggered.connect(self.pasteArrayWithName) plotArray = QAction(self) plotArray.setText("Plot Array") plotArray.triggered.connect(self.plotArray) modifyArray = QAction(self) modifyArray.setText("Modify Array(Calibration)") modifyArray.triggered.connect(self.modifyArray) plotScatter = QAction(self) plotScatter.setText("Plot Scatter") plotScatter.triggered.connect(self.plotScatter) plotHist = QAction(self) plotHist.setText("Plot Histogram") plotHist.triggered.connect(self.plotHist) delete = QAction(self) delete.setText("Remove") delete.triggered.connect(self.removeItem) curveDialog = QAction(self) curveDialog.setText("Open Curve Dialog") curveDialog.triggered.connect(self.openCurveDialog) self.arraylist.addAction(newArray) self.arraylist.addAction(newArrayWithName) self.arraylist.addAction(plotArray) self.arraylist.addAction(plotScatter) self.arraylist.addAction(plotHist) self.arraylist.addAction(modifyArray) self.arraylist.addAction(curveDialog) self.arraylist.addAction(delete) self.addWidget(self.arraylist) # Properties widget self.properties = DataSetEditGroupBox(_("參數(Properties)"), CsvParam) self.properties.setEnabled(False) self.addWidget(self.properties)
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 create_info_dock(self): info_dock = QDockWidget(_('Info')) self.addDockWidget(Qt.RightDockWidgetArea, info_dock) self.info_widget = QListWidget() info_dock.setWidget(self.info_widget)