def main(): locale = QLocale(QLocale.C) locale.setNumberOptions(QLocale.RejectGroupSeparator) QLocale.setDefault(locale) config = Config() config.removeOldFiles() app = QApplication([]) window = MainWindow() window.show() sys.exit(app.exec_())
def main(): app = QApplication([]) # This must be done after the application is instantiated. locale = QLocale(QLocale.C) locale.setNumberOptions(QLocale.OmitGroupSeparator) QLocale.setDefault(locale) config = Config() config.removeOldFiles() setUpLoggers() logger.info("Starting the application.") window = MainWindow() window.show() logger.info("Ready.") sys.exit(app.exec_())
def main(): import sys from PyQt5.QtWidgets import QApplication from PyQt5.QtCore import Qt, QLocale from .gui.main import MainWindow from silx.resources import register_resource_directory register_resource_directory('crispy', 'crispy.resources') locale = QLocale(QLocale.C) locale.setNumberOptions(QLocale.RejectGroupSeparator) QLocale.setDefault(locale) app = QApplication(sys.argv) window = MainWindow() window.show() app.setAttribute(Qt.AA_UseHighDpiPixmaps) sys.exit(app.exec_())
def main(): setUpLoggers() app = QApplication([]) # This must be done after the application is instantiated. locale = QLocale(QLocale.C) locale.setNumberOptions(QLocale.OmitGroupSeparator) QLocale.setDefault(locale) config = Config() config.removeOldFiles() settings = config.read() # Set default values if the config file is empty or was not created. if not settings.allKeys(): logger.debug("Loading default settings.") config.loadDefaults() logger.info("Starting the application.") window = MainWindow() window.show() logger.info("Ready.") sys.exit(app.exec_())
def main(): locale = QLocale(QLocale.English) locale.setNumberOptions(QLocale.RejectGroupSeparator) QLocale.setDefault(locale) app = App(sys.argv) sys.exit(app.exec_())
def add_subscriber(self, full_description: variable_full_description, q_obj_ref): """ Adding subscriber for plc data readout. :param full_description: variable_full_description :param q_obj_ref: QObject - Reference for QObject :return: """ read_subscriber_added_flag = False write_trigger_added_flag = False if isinstance(q_obj_ref, QLabel): data = BaseData(full_description) if q_obj_ref.pixmap() is not None: slot = lambda val: q_obj_ref.setEnabled(bool(val)) else: slot = lambda val: q_obj_ref.setText(str(val)) self.populate_bytes_readout(data) self._visu_variable_list.append(self.visu_object(data, slot)) read_subscriber_added_flag = True elif isinstance(q_obj_ref, QPushButton): if full_description.action in (Action.TOGGLE, Action.RESET, Action.SET): data = WritableBitData(full_description) q_obj_ref.clicked.connect( lambda: self.populate_write_request_by_bit_variable(data)) write_trigger_added_flag = True else: data = BaseData(full_description) if q_obj_ref.isCheckable(): slot = lambda val: self.slot_handling_qpushbutton( q_obj_ref, data, val) self.populate_bytes_readout(data) self._visu_variable_list.append(self.visu_object(data, slot)) read_subscriber_added_flag = True elif isinstance(q_obj_ref, QSlider) or isinstance(q_obj_ref, QDial): data = WritableNumericData(full_description) if full_description.action == Action.WRITE: q_obj_ref.setTracking(False) q_obj_ref.valueChanged.connect( lambda val: self.populate_write_request_by_int_variable( data, val)) write_trigger_added_flag = True slot = lambda val: self.slot_handling_qslider(q_obj_ref, data, val) self.populate_bytes_readout(data) self._visu_variable_list.append(self.visu_object(data, slot)) read_subscriber_added_flag = True elif isinstance(q_obj_ref, QProgressBar): slot = lambda val: q_obj_ref.setValue(int(val)) data = BaseData(full_description) self.populate_bytes_readout(data) self._visu_variable_list.append(self.visu_object(data, slot)) read_subscriber_added_flag = True elif isinstance(q_obj_ref, QLineEdit): if full_description.action == Action.WRITE: data = WritableNumericData(full_description) if data.data_type == DataType.REAL: validator = QDoubleValidator(*data.value_range, 24) locale = QLocale(QLocale.C) locale.setNumberOptions(QLocale.RejectGroupSeparator) validator.setLocale(locale) q_obj_ref.editingFinished.connect( lambda: self.populate_write_request_by_int_variable( data, float(q_obj_ref.text()))) else: validator = DoubleWordValidator(*data.value_range) q_obj_ref.editingFinished.connect( lambda: self.populate_write_request_by_int_variable( data, int(q_obj_ref.text()))) q_obj_ref.setValidator(validator) write_trigger_added_flag = True else: data = BaseData(full_description) q_obj_ref.setReadOnly(True) slot = lambda val: self.slot_handling_qlineedit( q_obj_ref, data, val) self.populate_bytes_readout(data) self._visu_variable_list.append(self.visu_object(data, slot)) read_subscriber_added_flag = True if not (read_subscriber_added_flag or write_trigger_added_flag): logger.warning('No supported widget, or operation for: ' + q_obj_ref.objectName()) else: if read_subscriber_added_flag: logger.debug('Subscriber added for reading: ' + q_obj_ref.objectName()) if write_trigger_added_flag: logger.debug('Added trigger for write operation: ' + q_obj_ref.objectName())
def main(values=None, filename=None): locale = QLocale(QLocale.English) locale.setNumberOptions(QLocale.RejectGroupSeparator) QLocale.setDefault(locale) app = Analyze(sys.argv, values, filename) sys.exit(app.exec_())