예제 #1
0
파일: app.py 프로젝트: doonny/gkraken
    def __init__(self, database: SqliteDatabase, view: MainView,
                 presenter: MainPresenter, builder: MainBuilder,
                 udev_interactor: UdevInteractor, *args: Any,
                 **kwargs: Any) -> None:
        LOG.debug("init Application")
        GLib.set_application_name(_(APP_NAME))
        super().__init__(*args,
                         application_id=APP_ID,
                         flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE,
                         **kwargs)

        database.connect()
        database.create_tables(
            [SpeedProfile, SpeedStep, CurrentSpeedProfile, Setting])

        if SpeedProfile.select().count() == 0:
            load_db_default_data()

        self.add_main_option_entries(self._get_main_option_entries())
        self._view = view
        self._presenter = presenter
        self._presenter.application_quit = self.quit
        self._window: Optional[Gtk.ApplicationWindow] = None
        self._builder: Gtk.Builder = builder
        self._udev_interactor = udev_interactor
        self._start_hidden: bool = False
예제 #2
0
파일: main.py 프로젝트: Raiu/gkraken
 def _get_profile_list(channel: ChannelType) -> List[Tuple[int, str]]:
     return [(p.id, p.name) for p in SpeedProfile.select().where(
         SpeedProfile.channel == channel.value)]