本文整理汇总了Python中mamewah_ini.MameWahIni.write方法的典型用法代码示例。如果您正苦于以下问题:Python MameWahIni.write方法的具体用法?Python MameWahIni.write怎么用?Python MameWahIni.write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mamewah_ini.MameWahIni
的用法示例。
在下文中一共展示了MameWahIni.write方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: WinSetup
# 需要导入模块: from mamewah_ini import MameWahIni [as 别名]
# 或者: from mamewah_ini.MameWahIni import write [as 别名]
class WinSetup(GladeSupport, WahCade):
"""wahcade setup - main window"""
def __init__(self, glade_filename, window_name, config_opts, config_args):
"""build the window"""
WahCade.__init__(self)
GladeSupport.__init__(self, glade_filename, window_name, APP_NAME)
#command-line options
self.config_opts = config_opts
#set default config location (create / update as necessary)
self.config_dir = CONFIG_DIR
if not os.path.exists(self.config_dir):
self.copy_user_config('all')
else:
#update current config
self.copy_user_config()
#keys list
self.tvwKeys, self.lsKeys, self.tvwsKeys = self.setup_treeview(
columns = ['Function', 'Key'],
column_types = [gobject.TYPE_STRING, gobject.TYPE_STRING],
container = self.scwKeys,
resizeable_cols = False)
self.lsKeys.set_sort_column_id(0, gtk.SORT_ASCENDING)
self.tvwKeys.connect('row-activated', self.on_tvwKeys_row_activated)
self.tvwKeys.set_tooltip_text(_('Double-Click a row to change a Key...'))
#set max width for keys column (stops window getting too wide)
col = self.tvwKeys.get_column(1)
col.set_max_width(200)
#get ini files
self.wahcade_ini = MameWahIni(os.path.join(self.config_dir, 'wahcade.ini'))
self.histview_ini = MameWahIni(os.path.join(self.config_dir, 'histview.ini'))
self.cpviewer_ini = MameWahIni(os.path.join(self.config_dir, 'cpviewer.ini'))
self.ctrlr_ini = MameWahIni(os.path.join(self.config_dir, 'ctrlr', 'default.ini'), 'ctrlr')
#emu stuff
self.emu_list_gen_types = [
[['rom_folder'], 'Rom Directory'],
[['rom_folder_vs_listxml', 'list_xml'], 'XML File'],
[['rom_folder_vs_dat_file', 'dat_file'], 'DAT File']]
self.emu_scrsave_types = [
['blank_screen', 'Blank Screen'],
['slideshow', 'Slide Show'],
['movie', 'Movies'],
['launch_scr', 'Launch External Screen Saver']]
self.emu_list_types = [
['normal', 'Normal'],
['most_played', 'Most Played'],
['longest_played', 'Longest Played']]
self.music_movie_mix = [
['mute_movies', 'Mute Movies'],
['merge', 'Mix with Music']]
self.emu_artwork_txe = [
self.txeEmuArt1, self.txeEmuArt2, self.txeEmuArt3, self.txeEmuArt4,
self.txeEmuArt5, self.txeEmuArt6, self.txeEmuArt7, self.txeEmuArt8,
self.txeEmuArt9, self.txeEmuArt10]
self.emu_artwork_btn = [
self.btnEmuArt1, self.btnEmuArt2, self.btnEmuArt3, self.btnEmuArt4,
self.btnEmuArt5, self.btnEmuArt6, self.btnEmuArt7, self.btnEmuArt8,
self.btnEmuArt9, self.btnEmuArt10]
#setup combo boxes
self.setup_combo_box(self.cboEmuScrSaver, [r[1] for r in self.emu_scrsave_types])
self.setup_combo_box(self.cboEmuListGen, [r[1] for r in self.emu_list_gen_types])
self.setup_combo_box(self.cboEmuListType, [r[1] for r in self.emu_list_types])
self.setup_combo_box(self.cboWCMovieMix, [r[1] for r in self.music_movie_mix])
#global joy
self.joystick = joystick.joystick()
self.joystick.use_all_controls()
#get default window size & pos
self.do_events()
w, h = self.wahcade_ini.get('setup_window_size', 'default', '400x400').split('x')
self.winSetup.resize(width=int(w), height=int(h))
#load settings
self.load_settings()
self.setup_altered = False
#set icon sizes
settings = gtk.settings_get_default()
settings.set_string_property('gtk-icon-sizes', 'gtk-button=16,16', '')
def on_winSetup_delete_event(self, *args):
"""done, quit the application"""
#save settings
self.save_setups()
#save default window size & pos
win_size = self.winSetup.get_size()
self.wahcade_ini.set('setup_window_size', '%sx%s' % (win_size))
self.wahcade_ini.write()
#exit gtk loop
gtk.main_quit()
return False
def on_Setup_changed(self, widget, *args):
"""widget has been modified, update altered flag"""
self.setup_altered = True
def on_mnuFSave_activate(self, *args):
"""save settings"""
self.save_setups(False)
def on_mnuFReset_activate(self, *args):
"""reset settings"""
dlg = gtk.MessageDialog(
#.........这里部分代码省略.........