Example #1
0
    def __init__(self, parent):
        self._idle_current = 0
        self._current_minute = 0  # does not need to be highest minute index
        self._current_app_title = ""
        self._current_process_exe = ""
        self._user_is_active = True
        self._active_day = track_common.today_int()
        

        # -- persist
        self._applications = track_qt.active_applications(parent)
        self._rules = track_qt.rules_model(parent)
Example #2
0
    def __init__(self, parent):
        self._idle_current = 0
        self._current_minute = 0  # does not need to be highest minute index
        self._current_app_title = ""
        self._current_process_exe = ""
        self._user_is_active = True
        self._active_day = track_common.today_int()

        # -- persist
        self._applications = active_applications_qtmodel(parent)
        self._rules = rules_model_qt(parent)

        self._rules.modified_rules.connect(self.update_categories)
Example #3
0
    def update(self):
        try:
            _today = track_common.today_int()
            self._current_minute = track_common.minutes_since_midnight()

            if self._active_day < _today:
                print("current minute is %d - it's midnight" % self._current_minute)
                #midnight!
                self.save('track-log-%d.json' % self._active_day)
                self.clear()

            self._active_day = _today

            self._current_minute = track_common.minutes_since_midnight()

            self._user_is_active = True

            self._idle_current = idle.getIdleSec()
            self._current_app_title = applicationinfo.get_active_window_title()
            try:
                self._current_process_exe = applicationinfo.get_active_process_name()
            except applicationinfo.UncriticalException as e: #necessary to run in i3
                self._current_process_exe = "Process not found"
                
            self._rules.highlight_string(self._current_app_title)
            self._rules.update_categories_time(self.get_time_per_categories())

            if self._idle_current > 10:
                self._user_is_active = False
                return

            _app = track_common.app_info(self._current_app_title, 
                            self._current_process_exe)
            _app._category = self._rules.get_first_matching_key(_app)

            _app = self._applications.update(
                        self._current_minute,
                        _app)

        except applicationinfo.UncriticalException as e:
            pass
Example #4
0
    def update(self):
        try:
            _today = track_common.today_int()
            self._current_minute = track_common.minutes_since_midnight()

            if self._active_day < _today:
                print("current minute is %d - it's midnight" % self._current_minute)
                #midnight!
                self.save('track-log-%d.json' % self._active_day)
                self.clear()

            self._active_day = _today

            self._current_minute = track_common.minutes_since_midnight()

            self._user_is_active = True

            self._idle_current = idle.getIdleSec()
            self._current_app_title = applicationinfo.get_active_window_title()
            self._current_process_exe = applicationinfo.get_active_process_name()

            self._rules.highlight_string(self._current_app_title)

            if self._idle_current > 10:
                self._user_is_active = False
                return

            _app = track_common.app_info(self._current_app_title, 
                            self._current_process_exe)
            _app._category = self._rules.get_first_matching_key(_app)

            _app = self._applications.update(
                        self._current_minute,
                        _app)

        except applicationinfo.UncriticalException as e:
            pass