Example #1
0
    def __init__(self):
        super().__init__(EmcMainLoop.instance())  # mainloop is the gui parent

        # setup default ini values
        ini.set_default('general', 'theme', 'blackmirror')
        ini.set_default('general', 'fps', 30)
        ini.set_default('general', 'scale', 1.0)
        ini.set_default('general', 'fullscreen', False)
        ini.set_default('general', 'hide_mouse', False)
        ini.set_default('general', 'time_format', '%H:%M')
        ini.set_default('general', 'date_format', '%A %d %B')
        ini.set_default('general', 'keyb_layouts', 'en_abc symbols')

        # public members
        self._theme_name = ini.get('general', 'theme')

        # protected memebrs
        self._boot_in_fullscreen = ini.get_bool('general', 'fullscreen')

        # private members
        self._key_down_func = None
        self._mouse_hide_timer = EmcTimer(3.0,
                                          self._mouse_hide_timer_cb,
                                          parent=self)

        # listen for input events
        input_events.listener_add('EmcGuiBase', self._input_events_cb)
Example #2
0
    def item_selected(self, url, user_data):
        dia = EmcDialog(self._lbl,
                        style='list',
                        done_cb=self._dia_list_selected_cb)

        if self._mul:
            choosed = ini.get_string_list(self._sec, self._opt)
        else:
            choosed = [ini.get(self._sec, self._opt)]

        item = None
        for code2, (code3, code5, name) in sorted(utils.iso639_table.items(),
                                                  key=lambda x: x[1][2]):
            if name is not None:
                if code2 in choosed:
                    item = dia.list_item_append(name, end='icon/check_on')
                    item.data['code2'] = code2
                else:
                    it = dia.list_item_append(name)
                    it.data['code2'] = code2
        dia.list_go()

        if item:
            item.show()
            item.selected = True
Example #3
0
def init():
    global _memorydb
    global _topbar_fman

    # _memorydb = EmcDatabase('browser_view_memory', BROWSER_MEMORY_DB_VERSION)

    # setup default configs
    ini.get('general', 'back_in_lists', default_value='True')
    ini.get('general', 'ignore_views_restrictions', default_value='False')
    ini.get('general', 'view_postergrid_size', default_value=150)
    ini.get('general', 'view_covergrid_size', default_value=150)
Example #4
0
 def item_selected(self, url, user_data):
     dia = EmcDialog(self._lbl,
                     style='list',
                     done_cb=self._dia_list_selected_cb)
     for string in self._sli:
         if string == ini.get(self._sec, self._opt):
             it = dia.list_item_append(string, end='icon/check_on')
             it.selected = True
         else:
             dia.list_item_append(string)
     dia.list_go()
Example #5
0
    def __new__(cls, *args, **kargs):

        # get the backend to use from ini [backend] backendable_pkg
        backend_name = ini.get('backend', cls.backendable_pkg)
        if not backend_name:
            raise RuntimeError(
                'Cannot find backend "%s" in ini file section "backend"' %
                cls.backendable_pkg)

        # import the backend package (fe: nepymc.mainloop.qt)
        pkg_name = '.'.join(('nepymc', cls.backendable_pkg, backend_name))
        pkg = importlib.import_module(pkg_name)

        # instantiate the class from the backend package
        pkg_cls = getattr(pkg, cls.backendable_cls)
        return super().__new__(pkg_cls)
Example #6
0
def _sys_info():
    import pyudev
    from nepymc import __version__ as emc_version

    try:
        from efl import __version__ as efl_version
    except ImportError:
        efl_version = _('Not found')

    try:
        from PySide2 import __version__ as pyside_version
    except ImportError:
        pyside_version = _('Not found')

    # win_w, win_h = gui.win.size
    # scr_x, scr_y, scr_w, scr_h = gui.win.screen_size
    # dpi_x, dpi_y = gui.win.screen_dpi

    text = '<h3>{}</h3>' \
           '<b>{}:</b> {}<br>' \
           '<h3>{}</h3>' \
           '<b>{}:</b> {}<br>'\
           '<b>{}:</b> {}<br>' \
           '<b>{}:</b> {}' \
           '<h3>{}</h3>' \
           '<b>{}:</b> {}<br>' \
           '<b>{}:</b> {}<br>' \
           '<b>{}:</b> {} <b>{}:</b> {}<br>' \
           '<b>{}:</b> {}<br>' \
           '<b>{}:</b> {}<br>'.format(
             _('Core'),
             _('Theme'), ini.get('general', 'theme'), #gui.theme_file,  # TODO
             # _('Window size'), win_w, win_h,  # TODO
             # _('screen'), scr_w, scr_h, scr_x, scr_y,  # TODO
             # _('dpi'), dpi_x, dpi_y,  # TODO
             _('Paths'),
             _('Base folder'), utils.emc_base_dir,
             _('Config folder'), utils.user_conf_dir,
             _('Cache folder'), utils.user_cache_dir,
             _('Versions'),
             _('NepyMC'), emc_version,
             _('Python'), sys.version,
             _('Udev'), pyudev.udev_version(), _('pyudev'), pyudev.__version__,
             _('Python-EFL'), efl_version,
             _('PySide'), pyside_version,
           )
    EmcDialog(style='panel', title=_('System info'), text=text)
Example #7
0
 def label_end_get(self, url, user_data):
     if self._udm:
         return ini.get(self._sec, self._opt) + ' ' + self._udm
     else:
         return ini.get(self._sec, self._opt)
Example #8
0
 def label_end_get(self, url, user_data):
     return ini.get(self._sec, self._opt)
Example #9
0
 def label_end_get(self, url, user_data):
     val = ini.get(self._sec, self._opt)
     return '●●●●●' if self._pwd and val else val
Example #10
0
 def item_selected(self, url, user_data):
     EmcVKeyboard(
         title=self._lbl,
         accept_cb=self._kbd_accept_cb,
         text=ini.get(self._sec, self._opt) if not self._pwd else '')
Example #11
0
 def item_selected(self, url, user_data):
     if ini.get(self._sec, self._opt) == 'True':
         ini.set(self._sec, self._opt, 'False')
     else:
         ini.set(self._sec, self._opt, 'True')
     StdConfigItemBase.__done__(self)
Example #12
0
def init():
    global _volume
    global _play_db
    global video_extensions
    global audio_extensions

    # default config values
    ini.add_section('mediaplayer')
    ini.get('mediaplayer', 'volume', '75')
    ini.get('mediaplayer', 'resume_from_last_pos', '0')
    ini.get('mediaplayer', 'playlist_loop', 'False')
    ini.get('mediaplayer', 'playlist_shuffle', 'False')
    ini.get('mediaplayer', 'video_extensions', '')
    ini.get('mediaplayer', 'audio_extensions', '')
    ini.get('mediaplayer', 'volume_adjust_step', '3')
    ini.get('mediaplayer', 'volume_exponent', '2')
    ini.get('mediaplayer', 'volume_maximum', '100')
    ini.add_section('subtitles')
    ini.get('subtitles', 'langs', 'en')
    ini.get('subtitles', 'encoding', 'latin_1')
    ini.get('subtitles', 'always_try_utf8', 'True')
    ini.get('subtitles', 'opensubtitles_user', '')
    ini.get('subtitles', 'opensubtitles_pass', '')

    audio_extensions += ini.get_string_list('mediaplayer', 'audio_extensions')
    video_extensions += ini.get_string_list('mediaplayer', 'video_extensions')

    # restore volume from previous session
    _volume = ini.get_float('mediaplayer', 'volume')

    # simple db to store the count of played files
    _play_db = EmcDatabase('playcount')

    # input events
    input_events.listener_add("mediaplayer", _input_event_cb)