Esempio n. 1
0
    def __init__(self, window, parent=None):
        super().__init__(parent)
        self.setupUi(self)

        self.setWindowTitle("Settings")
        self.setWindowModality(QtCore.Qt.WindowModal)
        self.setFixedSize(self.size())

        self.spinTomat.setValue(self.read_settings('ttime'))
        self.spinLong.setValue(self.read_settings('lpause'))
        self.spinShort.setValue(self.read_settings('spause'))

        self.start_edit.setText(
            config.read_conf('run_commands', 'before', True))
        self.finish_edit.setText(
            config.read_conf('run_commands', 'after', True))

        enable_start = config.read_conf('run_commands', 'active_before')
        enable_finish = config.read_conf('run_commands', 'active_after')

        if enable_start == 1:
            self.start_run.setChecked(True)

        if enable_finish == 1:
            self.finish_run.setChecked(True)

        self.btnOk.clicked.connect(self.btn_ok_click)
        self.btnCnl.clicked.connect(self.btn_cnl_click)
        self.app = window
Esempio n. 2
0
 def on_btn_stop(self):
     enable_finish = config.read_conf('run_commands', 'active_after')
     if enable_finish == 1 and \
             isinstance(self.fms.state, state.TomatoState):
         utils.run('after')
     icon = utils.image_tray('init-tomat.png')
     self.trayIcon.setIcon(icon)
     self.fms.next_state(state.StopEvent(), time.time())
Esempio n. 3
0
 def on_btn_start(self):
     icon = utils.image_tray('red-tomat.png')
     enable_start = config.read_conf('run_commands', 'active_before')
     if enable_start == 1:
         utils.run('before')
     self.trayIcon.setIcon(icon)
     self.fms.next_state(state.StartEvent, time.time())
     self.timer.start(100)
Esempio n. 4
0
 def update_time(self):
     self.app.fms.tomat = config.read_conf("Settings", 'ttime') * 60
     self.app.fms.lpause = config.read_conf("Settings", 'lpause') * 60
     self.app.fms.spause = config.read_conf("Settings", 'spause') * 60
Esempio n. 5
0
 def read_settings(self, key):
     value = config.read_conf("Settings", key)
     return value
Esempio n. 6
0
 def set_position(self):
     self.width = config.read_conf("Settings", "width")
     self.height = config.read_conf("Settings", "height")
     self.move(self.width, self.height)