Exemplo n.º 1
0
    def __init__(self,
                 main_model: MainModel,
                 notification_controller: NotificationController,
                 running: bool = False):
        Thread.__init__(self)
        QObject.__init__(self)

        self.setName("Algoritmo V5")
        self.setDaemon(True)
        self.env_settings = QSettings()
        self.settings_model: SettingsModel = main_model.settings_model

        self.refresh: int = (lambda: self.settings_model.get_sync_time())
        self.running = running
        self.notification_controller = notification_controller

        # set istanza di NetworkModel nei moduli per poter gestire i segnali di errore
        tree_builder.set_model(main_model.network_model)
        os_handler.set_network_model(main_model.network_model)
        os_handler.set_settings_model(main_model.settings_model)

        self.main_model = main_model

        self.compare_snap_client = CompareSnapClient()
        self.strategy: dict[Policy, Strategy] = {
            Policy.Client: ClientStrategy(),
            Policy.Manual: ManualStrategy()
        }

        self.logger = logging.getLogger("decision_engine")
        self.condition = Condition()
Exemplo n.º 2
0
Arquivo: ledger.py Projeto: flmnvd/jal
 def __init__(self):
     QObject.__init__(self)
     self.amounts = LedgerAmounts(
         "amount_acc")  # store last amount for [book, account, asset]
     self.values = LedgerAmounts(
         "value_acc")  # together with corresponding value
     self.main_window = None
     self.progress_bar = None
Exemplo n.º 3
0
 def eventFilter(self, obj: QObject, event: QEvent):
     if obj.objectName() == "lineEdit":
         if event.type() == QEvent.DragEnter:
             new_method.lineEdit_dragEnterEvent(event)
             return True
         if event.type() == QEvent.Drop:
             new_method.lineEdit_dropEvent(self, event)
             return True
     return QObject.eventFilter(self, obj, event)
Exemplo n.º 4
0
 def __init__(self):
     QObject.__init__(self)
     self.current = {}
     self.current_seq = -1
     self.amounts = LedgerAmounts(
     )  # store last amount for [book, account, asset]
     self.values = LedgerAmounts()  # together with corresponding value
     self.sids = {}  # and keep sid of operation that modified it
     self.main_window = None
     self.progress_bar = None
Exemplo n.º 5
0
def find_ancestor(obj: QObject, type: str = "", name: str = ""):
    """Returns the closest ancestor of obj with type and name given"""
    obj = obj.parent()
    if not obj:
        return None
    # used recursion here before but pyside
    # deleted the object before returning
    while not ((name == "" or obj.objectName() == name) and
               (type == "" or obj.metaObject().className() == str(type))):
        obj = obj.parent()
    return obj
Exemplo n.º 6
0
def find_child_text(obj: QObject, text: str):
    """Returns the child of obj with the given text"""
    for child in obj.children():
        get_text = getattr(child, "text", None)
        if callable(get_text) and get_text() == text:
            return child
    return None
Exemplo n.º 7
0
 def eventFilter(self, source, event):
     # currently the only source is the raw plot window
     if event.type() == QEvent.Close:
         self.data_changed()
         bads = self.model.current["data"].info["bads"]
         if self.bads != bads:
             self.model.history.append(f'data.info["bads"] = {bads}')
     return QObject.eventFilter(self, source, event)
Exemplo n.º 8
0
 def setMeasurement(self, value: Measurement):
     self.value = value
     if isinstance(value, Measurement):
         if not QObject.property(self, 'showUnit'):
             self.setText(value.str)
         else:
             self.setText(value.withUnit)
     else:
         self.setText(str(value))
Exemplo n.º 9
0
    def __init__(self):
        QObject.__init__(self)

        self._tableModel = DHLTableModel()
        #self._slectionModel=self.
        #self._currentList=None  # type: QStringListModel
        self._channelCount = 0  # type: int
        self._active_channel = 0  # type: int
        self._figure = None  # type: Figure
        #self._tableModelSelectIndex=0 #

        self._acqs = []  # type: typing.List[ismrmrd.Acquisition]

        # 当前行/当前通道原始数据
        self._currentLineData = None  # type: np.array

        # 当前行用于渲染的数据
        self._currentLineListModel = QStringListModel(
        )  # type: QStringListModel
        #self._currentLineListModel.setStringList(['1','2','3'])

        #self.channelCountChanged.connect(self.safe_update_list_model)
        #self.currentChannelIndexChanged.connect(self.safe_update_list_model)

        self._canvas = None  # type: FigureCanvas
        self._figure = None  # type: Figure
        self._axes = None

        self._tableview = None  # type: QTableView

        self._selectionModel = None  # type: QItemSelectionModel

        self._listview = None  # type: QListView
        self._listViewSelectionModel = None  # type: QItemSelectionModel
        self._tableModelSelectIndex = 0  # ?
        self.stop_update_whole_view = False  # global backend data fix in progress
        self.stop_update_list_data = False

        pass
Exemplo n.º 10
0
 def __init__(self):
     # Initialize the parent object. If omitted, GUI will not start
     QObject.__init__(self)
     # Initialize the counter internal value. Because we propagate count as
     # a property to QML, getter, setter and notifier must be made
     self._count = 0
Exemplo n.º 11
0
 def __init__(self, mediaPlayer):
     QObject.__init__(self)
     self.mediaPlayer = mediaPlayer
Exemplo n.º 12
0
 def __init__(self):
     QObject.__init__(self)
Exemplo n.º 13
0
 def trugh(self, text):
     return QObject.tr(self, text)
Exemplo n.º 14
0
 def __init__(self, widget, channel_name):
     QObject.__init__(self)
     self.widget = widget
     self.channel_name = channel_name
     channels_for_names[self.channel_name] = self
Exemplo n.º 15
0
 def __init__(self, queue):
     QObject.__init__(self)
     self.queue = queue
Exemplo n.º 16
0
 def __init__(self):
     QObject.__init__(self)
     os.path.join(os.path.dirname(__file__), "main.qml")
Exemplo n.º 17
0
 def __init__(self, app_core: CoreApp):
     QObject.__init__(self, None)  # parent null args removed
     self.app_core = app_core
     self.optionsMap: Dict[str, Category] = {}
Exemplo n.º 18
0
 def __init__(self):
     QObject.__init__(self)
     self._deg = 0
     self._min = 0
     self._sec = 0
     self._deg_float = 0.0
Exemplo n.º 19
0
def get_all_children(obj: QObject):
    """Returns all the children (recursive) of the given object"""
    for child in obj.children():
        yield child
        yield from get_all_children(child)
Exemplo n.º 20
0
 def __init__(self, name="", parent=None):
     QObject.__init__(self, parent)
     self.setObjectName(name)
Exemplo n.º 21
0
    def eventFilter(self, watched, event):
        if watched == QCoreApplication.instance():
            if event.type() == QEvent.ApplicationFontChange:
                self.update()

        return QObject.eventFilter(watched, event)