def __init__(self): DBG('Init module') self.grab_key_func = None # set up default bindings section = 'keyboard' if not ini.has_section(section): ini.add_section(section) defs = EmcGui.instance().default_keymap_get() for key, event in defs.items(): ini.set(section, key, event) # read mapping from config self.keys = dict() for key, event in ini.get_options(section): DBG('Map key "%s" to event %s' % (key, event)) self.keys[key] = event # add an entry in the config gui section config_gui.root_item_add('keyb', 50, _('Keyboard'), icon='icon/keyboard', callback=self.config_panel_cb) # ask the gui to forward key events to us EmcGui.instance().key_down_connect(self._key_down_cb)
def event_choosed_cb(self, dia): event = str(dia.list_item_selected_get().label) key = str(self.pressed_key) # save the pressed key in mapping and config self.keys[key] = event ini.set('keyboard', key, event) # kill the dialog and refresh the browser dia.delete() bro = config_gui.browser_get() bro.refresh(hard=True)
def _dia_list_selected_cb(self, dia): item = dia.list_item_selected_get() lang = item.data['code2'] if self._mul: L = ini.get_string_list(self._sec, self._opt) L.remove(lang) if lang in L else L.append(lang) if len(L) < 1: L.append('en') ini.set_string_list(self._sec, self._opt, L) else: ini.set(self._sec, self._opt, lang) dia.delete() StdConfigItemBase.__done__(self)
def init(): global _udev_module DBG('init') ini.add_section('storage') if not ini.has_option('storage', 'show_home'): ini.set('storage', 'show_home', True) if not ini.has_option('storage', 'show_root'): ini.set('storage', 'show_root', False) device_added(EmcDevice(uniq_id='user_home', type=EmcDevType.SYSTEM, sort_key=10, mount_point=os.getenv('HOME'), label=_('User home'), icon='icon/home')) if platform.system() == 'Linux': _udev_module = EmcDeviceManagerUdev()
def volume_set(vol: float) -> None: """ Set linear volume. Float, always between 0 and 100 """ global _volume vol = utils.clamp(vol, 0, 100) vol = vol / 100.0 * ini.get_int('mediaplayer', 'volume_maximum') if vol == _volume: return _volume = vol EmcGui.instance().volume_set(vol) ini.set('mediaplayer', 'volume', _volume) # events.event_emit('VOLUME_CHANGED') if _player: _player.volume_set(volume_adjusted_get())
def save_enabled(): ini.set('general', 'modules', ' '.join(_instances.keys()))
def init_all_by_config(): if not ini.has_option('general', 'modules'): ini.set('general', 'modules', DEFAULT_MODS) for modname in ini.get_string_list('general', 'modules'): init_by_name(modname)
def item_selected(self, url, module): ini.set('general', 'theme', url) gui.set_theme_file(url) _browser.refresh()
def _btn_ok_cb(self, btn): val = self._fmt % self._val ini.set(self._sec, self._opt, val) self._dia.delete() StdConfigItemBase.__done__(self)
def _dia_list_selected_cb(self, dia): item = dia.list_item_selected_get() ini.set(self._sec, self._opt, item.data['i']) dia.delete() StdConfigItemBase.__done__(self)
def _kbd_accept_cb(self, vkeyb, text): ini.set(self._sec, self._opt, text) StdConfigItemBase.__done__(self)
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)