コード例 #1
0
ファイル: config.py プロジェクト: bernt/pymt
def configuration_save():
    for key in c:
        section, name = key.split('.', 1)
        value = c.get(key).get()
        if name in ('double_tap_time', 'double_tap_distance'):
            value = int(float(value))
        pymt_config.set(section, name, value)

    # modules
    if pymt_config.has_section('modules'):
        pymt_config.remove_section('modules')
    pymt_config.add_section('modules')
    modlist = eval(c_modules.get())
    for index in map(int, e_modules_list.curselection()):
        pymt_config.set('modules', modlist[index], '')

    # screen
    width, height = c_screen.get().split('x')
    pymt_config.set('graphics', 'width', width)
    pymt_config.set('graphics', 'height', height)

    # input
    if pymt_config.has_section('input'):
        pymt_config.remove_section('input')
    pymt_config.add_section('input')
    inputlist = eval(c_input.get())
    for index in map(int, e_input_list.curselection()):
        device_id, option = inputlist[index].split('=', 1)
        pymt_config.set('input', device_id, option)

    try:
        pymt_config.write()
        tkMessageBox.showinfo('PyMT', 'Configuration saved !')
    except Exception, e:
        tkMessageBox.showwarning('PyMT', 'Unable to save default configuration : ' + str(e))
コード例 #2
0
ファイル: fbo.py プロジェクト: hansent/pymt
    def __pymt_configure_fbo():

        from pymt import pymt_config

        # decide what to use
        fbo_config = pymt_config.get("graphics", "fbo")

        if fbo_config == "force-hardware":
            pymt.pymt_logger.debug("Fbo: Forcing hardware Framebuffer")
            AutoselectFbo.fbo_class = HardwareFbo
        elif fbo_config == "hardware" and bool(glGenFramebuffersEXT):
            pymt.pymt_logger.debug("Fbo: Use hardware Framebuffer")
            AutoselectFbo.fbo_class = HardwareFbo
        elif fbo_config == "software":
            pymt.pymt_logger.debug("Fbo: Use software Framebuffer")
            AutoselectFbo.fbo_class = SoftwareFbo
        else:
            pymt_config.set("graphics", "fbo", "software")
            pymt.pymt_logger.debug("Fbo: Falling back to software Framebuffer!!")
            AutoselectFbo.fbo_class = SoftwareFbo
コード例 #3
0
ファイル: fbo.py プロジェクト: gavine199/pymt
    def __pymt_configure_fbo():

        from pymt import pymt_config

        # decide what to use
        fbo_config = pymt_config.get('graphics', 'fbo')

        if fbo_config == 'force-hardware':
            pymt.pymt_logger.debug('Fbo: Forcing hardware Framebuffer')
            AutoselectFbo.fbo_class = HardwareFbo
        elif fbo_config == 'hardware' and bool(glGenFramebuffersEXT):
            pymt.pymt_logger.debug('Fbo: Use hardware Framebuffer')
            AutoselectFbo.fbo_class = HardwareFbo
        elif fbo_config == 'software':
            pymt.pymt_logger.debug('Fbo: Use software Framebuffer')
            AutoselectFbo.fbo_class = SoftwareFbo
        else:
            pymt_config.set('graphics', 'fbo', 'software')
            pymt.pymt_logger.debug('Fbo: Falling back to software Framebuffer!!')
            AutoselectFbo.fbo_class = SoftwareFbo
コード例 #4
0
ファイル: config.py プロジェクト: gavine199/pymt
def configuration_save():
    for key in c:
        section, name = key.split('.', 1)
        value = c.get(key).get()
        if name in ('double_tap_time', 'double_tap_distance'):
            value = int(float(value))
        pymt_config.set(section, name, value)

    # modules
    if pymt_config.has_section('modules'):
        pymt_config.remove_section('modules')
    pymt_config.add_section('modules')
    modlist = eval(c_modules.get())
    for index in map(int, e_modules_list.curselection()):
        pymt_config.set('modules', modlist[index], '')

    # screen
    width, height = c_screen.get().split('x')
    pymt_config.set('graphics', 'width', width)
    pymt_config.set('graphics', 'height', height)

    # input
    if pymt_config.has_section('input'):
        pymt_config.remove_section('input')
    pymt_config.add_section('input')
    inputlist = eval(c_input.get())
    for index in map(int, e_input_list.curselection()):
        device_id, option = inputlist[index].split('=', 1)
        pymt_config.set('input', device_id, option)

    try:
        pymt_config.write()
        tkMessageBox.showinfo('PyMT', 'Configuration saved !')
    except Exception, e:
        tkMessageBox.showwarning(
            'PyMT', 'Unable to save default configuration : ' + str(e))