当前位置: 首页>>代码示例>>Python>>正文


Python MameWahIni.getint方法代码示例

本文整理汇总了Python中mamewah_ini.MameWahIni.getint方法的典型用法代码示例。如果您正苦于以下问题:Python MameWahIni.getint方法的具体用法?Python MameWahIni.getint怎么用?Python MameWahIni.getint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mamewah_ini.MameWahIni的用法示例。


在下文中一共展示了MameWahIni.getint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from mamewah_ini import MameWahIni [as 别名]
# 或者: from mamewah_ini.MameWahIni import getint [as 别名]
class WahCade:
    """Common functions for Wah!Cade"""

    def __init__(self):
        """initialise common wahcade class"""
        #set default icon for windows
        gtk.window_set_default_icon_from_file(
            os.path.join(APP_PATH, 'pixmaps', 'wahcade.png'))
        ### LOGFILE
        if os.path.exists(CONFIG_DIR):
            self.log_filename = os.path.join(CONFIG_DIR, 'wahcade.log')
            try:
                f = open(self.log_filename, 'w')
                self.log_msg("//======================= NEW LOG RUN =======================//")
                f.close
            except:
                print "ERROR opening LOG FILE, %s, check for orphaned processes" % self.log_filename

    def hide_mouse_cursor(self, win):
        """hide mouse cursor"""
        gtk_col = gtk.gdk.Color()
        pixmap = gtk.gdk.Pixmap(None, 1, 1, 1)
        invisible_cursor = gtk.gdk.Cursor(
            pixmap, pixmap, gtk_col, gtk_col, 0, 0)
        win.window.set_cursor(invisible_cursor)

    def get_layout_item_properties(self, lines, offset):
        """get properties for item in layout"""
        d={}
        d['visible'] = (lines[offset].lower() == 'true')
        d['transparent'] = (lines[offset + 1] == '1')
        d['background-col'] = self.get_colour(int(lines[offset + 2]))
        d['text-col'] = self.get_colour(int(lines[offset + 3]))
        d['font'] = lines[offset + 4]
        d['font-bold'] = (lines[offset + 5].lower() == 'true')
        d['font-italic'] = (lines[offset + 6].lower() == 'true')
        d['font-size'] = float(lines[offset + 7])
        align_rot = lines[offset + 8].split(';')
        d['text-align'] = int(align_rot[0])
        d['text-rotation'] = 0
        if len(align_rot) > 1:
            d['text-rotation'] = int(align_rot[1])
        d['x'] = int(lines[offset + 9])
        d['y'] = int(lines[offset + 10])
        d['width'] = int(lines[offset + 11])
        d['height'] = int(lines[offset + 12])
        #done
        return d

    def get_colorbutton_info(self, clr_widget):
        """get gtk.ColorButton widgets current colour in gdk and hex format"""
        clr = clr_widget.get_color()
        hex_clr = '#%s%s%s' % (
            hex(clr.red/256)[2:].rjust(2, '0'),
            hex(clr.green/256)[2:].rjust(2, '0'),
            hex(clr.blue/256)[2:].rjust(2, '0'))
        return clr, hex_clr

    def get_colour(self, col):
        """convert decimal colour into format suitable for gtk colour"""
        hex_col = hex(col)[2:].rjust(6, '0').upper()
        #re-arrange
        hex_col = '#%s%s%s' % (hex_col[4:6], hex_col[2:4], hex_col[0:2])
        return hex_col

    def reverse_get_colour(self, hex_col):
        """reverse get_colour method - convert hex colour (#RRGGBB) into
           wahcade's decimal format"""
        r = int(hex_col[1:3], 16)
        g = int(hex_col[3:5], 16)
        b = int(hex_col[5:7], 16)
        col = (b * 256 * 256) + (g * 256) + r
        return col

    def get_matching_filename(self, file_prefixes, file_formats):
        """return the filename if it exists from given formats & path
              file_prefixes = [(dir_name, filename), ...]
              file_formats = [file_ext1, file_ext2, ...]
        """
        p = re.compile('(\.[^\.]+$)|(\s(\(|\[).+(?<=(\)|\]|\s))\.[^\.]+$)')
        self.wahcade_ini = MameWahIni(os.path.join(CONFIG_DIR, 'wahcade.ini'))
        l = self.wahcade_ini.get('layout')
        fz = self.wahcade_ini.getint('fuzzy_artwork_search')
        #check lower & upper case filenames for each given prefix & format
        for dirname, fp in file_prefixes:
            if fp == '##random##':
                for ff in file_formats:
                    fnl = walk_dir(dirname, False, '*.%s' % ff.lower(), False) + \
                        walk_dir(dirname, False, '*.%s' % ff.upper(), False)
                    #return first valid match
                    for filename in fnl:
                        if os.path.isfile(filename):
                            return filename
            elif fp != '':
                if file_formats != '':
                    # Check if this is a layout
                    if l not in dirname:
                        if fz:
                            # NB: we append a fake extension here to support the regex currently - sairuk
                            #     handles . appearing in filename being treated as an ext
#.........这里部分代码省略.........
开发者ID:FruitieX,项目名称:wahcade,代码行数:103,代码来源:wc_common.py

示例2: WinSetup

# 需要导入模块: from mamewah_ini import MameWahIni [as 别名]
# 或者: from mamewah_ini.MameWahIni import getint [as 别名]

#.........这里部分代码省略.........
    def save_setups(self, show_dialog=True):
        """save setup, prompt if show_dialog == True"""
        if self.setup_altered:
            ok_to_save = True
            if show_dialog:
                dlg = gtk.MessageDialog(
                    self.winSetup,
                    gtk.DIALOG_MODAL,
                    gtk.MESSAGE_QUESTION,
                    gtk.BUTTONS_YES_NO,
                    _('Save changes?'))
                resp = dlg.run()
                if resp != gtk.RESPONSE_YES:
                    ok_to_save = False
                dlg.destroy()
            #save?
            if ok_to_save:
                self.save_emulator_list_settings()
                self.save_emulator_settings()
                self.save_wahcade_settings()
                self.setup_altered = False

    def load_settings(self, default_emu=None):
        """load wahcade settings"""
        #build list of emulators
        self.emu_lists = self.buildemulist()
        self.current_emu = None
        self.current_emu_list = None
        #load emu combo
        l = ['%s (%s.ini)' % (e[0], e[1]) for e in self.emu_lists]
        self.setup_combo_box(self.cboEmu, l)
        #wahcade
        self.txeWCLayoutDir.set_text(self.wahcade_ini.get('layout'))
        self.chkWCFullscreen.set_active((self.wahcade_ini.getint('fullscreen', 0) == 1))
        self.spnWCScrDelay.set_value(self.wahcade_ini.getint('delay'))
        self.spnWCScrSlide.set_value(self.wahcade_ini.getint('slide_duration'))
        self.spnWCMovieDelay.set_value(self.wahcade_ini.getint('delay_before_movie_preview'))
        self.hscWCMovieVolume.set_value(self.wahcade_ini.getint('movie_volume'))
        ini_mix = self.wahcade_ini.get('music_movie_mix')
        mix_idx = [idx for idx, r in enumerate(self.music_movie_mix) if r[0] == ini_mix][0]
        self.cboWCMovieMix.set_active(mix_idx)
        self.txeWCMovieIntro.set_text(self.wahcade_ini.get('intro_movie_file'))
        self.txeWCMovieExit.set_text(self.wahcade_ini.get('exit_movie_file'))
        self.txeWCMusicDir.set_text(self.wahcade_ini.get('music_path'))
        self.chkWCMusic.set_active((self.wahcade_ini.getint('enable_music', 0) == 1))
        self.hscWCMusicVolume.set_value(self.wahcade_ini.getint('music_volume'))
        self.chkWCMusicShuffle.set_active((self.wahcade_ini.getint('shuffle_music', 0) == 1))
        self.chkWCMouseCursor.set_active((self.wahcade_ini.getint('show_cursor') == 1))
        self.chkWCWrapLists.set_active((self.wahcade_ini.getint('wrap_list') == 1))
        self.chkWCScaleImages.set_active((self.wahcade_ini.getint('keep_image_aspect') == 1))
        self.chkWCListArrows.set_active((self.wahcade_ini.getint('show_list_arrows', 0) == 1))
        #set emu
        set_idx = 0
        if default_emu:
            set_idx = [idx for idx, e in enumerate(self.emu_lists) if e[1] == default_emu][0]
        self.cboEmu.set_active(set_idx)
        #mame history viewer
        self.txeHstDatFile.set_text(self.histview_ini.get('history_dat_file'))
        self.txeHstLayout.set_text(self.histview_ini.get('history_layout'))
        #mame cp viewer
        self.txeCPVIni.set_text(self.cpviewer_ini.get('controls_ini_file'))
        self.txeCPVLayout.set_text(self.cpviewer_ini.get('viewer_layout'))
        #load keys
        self.chkKeysUseKeyboard.set_active((self.ctrlr_ini.getint('keyboard') == 1))
        self.chkKeysUseMouse.set_active((self.ctrlr_ini.getint('mouse') == 1))
        self.chkKeysUseJoystick.set_active((self.ctrlr_ini.getint('joystick') == 1))
开发者ID:gglass,项目名称:blinkywah,代码行数:70,代码来源:wc_setup.py


注:本文中的mamewah_ini.MameWahIni.getint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。