本文整理汇总了Python中kivy.config.ConfigParser.setdefaults方法的典型用法代码示例。如果您正苦于以下问题:Python ConfigParser.setdefaults方法的具体用法?Python ConfigParser.setdefaults怎么用?Python ConfigParser.setdefaults使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kivy.config.ConfigParser
的用法示例。
在下文中一共展示了ConfigParser.setdefaults方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_my_settings
# 需要导入模块: from kivy.config import ConfigParser [as 别名]
# 或者: from kivy.config.ConfigParser import setdefaults [as 别名]
def build_my_settings(settings, req, result):
for settable in result:
yeah_id = settable[0]
settings_format = settable[1]
my_settings = settable[2]
print yeah_id, settings_format, my_settings
config = ConfigParser()
config.setdefaults(yeah_id, my_settings)
settings.add_json_panel(my_settings['name'], config, data=dumps(settings_format))
示例2: __init__
# 需要导入模块: from kivy.config import ConfigParser [as 别名]
# 或者: from kivy.config.ConfigParser import setdefaults [as 别名]
def __init__(self, scenario_screen, block, *args, **kwargs):
super(BlockSettingsPopup, self).__init__(*args, **kwargs)
self.app = App.get_running_app()
self.title = 'Block settings'
self.block = block
self.scenario_screen = scenario_screen
self.settings = SettingsWithNoMenu()
self.settings.on_config_change = self.on_config_change
self.settings.register_type('string_long', SettingString)
self.settings.register_type('num_int', SettingNumeric)
self.settings.register_type('num', SettingNumeric)
config = ConfigParser()
config.setdefaults(block.yeah_id, block.settings)
self.settings.add_json_panel(block.settings['name'], config, data=dumps(block.settings_format))
self.content = self.settings
示例3: build_settings
# 需要导入模块: from kivy.config import ConfigParser [as 别名]
# 或者: from kivy.config.ConfigParser import setdefaults [as 别名]
def build_settings(self, req, result):
self.settings = None
self.settings = SettingsWithNoMenu()
self.settings.on_config_change = self.on_config_change
self.settings.register_type('string_long', SettingString)
self.settings.register_type('num_int', SettingNumeric)
self.settings.register_type('num', SettingNumeric)
config = ConfigParser()
print result['settings']
config.setdefaults(self.popup.device_id, result['settings'])
self.settings.add_json_panel(result['name'], config, data=dumps(result['settings_format']))
self.add_widget(self.settings)
buttons = BoxLayout(orientation = 'horizontal')
buttons.add_widget(Button(text = 'Previous',
on_release = self.popup.previous_view,
height = '50dp'))
buttons.add_widget(Button(text = 'Next',
on_release = self.popup.next_view,
height = '50dp'))
self.add_widget(buttons)
示例4: RenderGUI
# 需要导入模块: from kivy.config import ConfigParser [as 别名]
# 或者: from kivy.config.ConfigParser import setdefaults [as 别名]
class RenderGUI(Widget):
rend = None
azimuth = NumericProperty(20.0)
altitude = NumericProperty(20.0)
distance_per_pixel = NumericProperty(0.0)
stepsize = NumericProperty(0.0)
x_pixel_offset = NumericProperty(0)
y_pixel_offset = NumericProperty(0)
rend_opacity = BooleanProperty(False)
channel = NumericProperty(0)
log_offset = NumericProperty(6.0)
cbar_num = NumericProperty(10)
snap = NumericProperty(0)
rendermode = Mode.intensity
spect_analyzer = spectAnlys.Analyzer()
nlamb = NumericProperty(41)
cbsize = (30, 3000)
asym_sep = NumericProperty(0.0)
asym_width = NumericProperty(0.0)
noise_snr = NumericProperty(999.)
helptext = ('Pan l/r: a/d\n'
'Tilt u/d: w/s\n'
'zoom in/out: j/k\n'
'Shift l/r: [left]/[right]\n'
'Shift u/d: [up]/[down]\n'
'Recenter shift: c\n'
'Dynamic range inc/dec: i/u\n'
'Stepsize inc/dec: ./,\n'
'Toggle opacity: o\n'
'Change timestep: [/]')
initialized = False
def __init__(self, rend, **kwargs):
self.texture = Texture.create(size=BUF_DIMENSIONS)
self.texture_size = BUF_DIMENSIONS
self.cbtex = Texture.create(size=self.cbsize)
super(RenderGUI, self).__init__(**kwargs)
self.rend = rend
self.buffer_array = np.empty(BUF_DIMENSIONS[::-1] + (4, ), dtype='uint8')
self.distance_per_pixel = self.rend.distance_per_pixel
self.stepsize = self.rend.stepsize
self.x_pixel_offset = rend.x_pixel_offset
self.y_pixel_offset = rend.y_pixel_offset
self.snap = self.rend.snap
self.config = ConfigParser()
self.channellist = [os.path.basename(os.path.splitext(a)[0]) for a in self.rend.channellist()]
self.config.setdefaults('renderer', {'rendermode': self.rendermode,
'channel': self.channellist[0],
'snap': self.rend.snap,
'nlamb': self.nlamb,
'opacity': int(self.rend_opacity),
'altitude': self.altitude,
'azimuth': self.azimuth,
'distance_per_pixel': self.distance_per_pixel,
'stepsize': self.stepsize,
'noise_snr': self.noise_snr})
self.config.setdefaults('display', {'log_offset': self.log_offset,
'cbar_num': self.cbar_num,
'asym_sep': self.asym_sep,
'asym_width': self.asym_width})
self.spanel = SettingsPanel(settings=self.s, title='Render Settings', config=self.config)
self.s.interface.add_panel(self.spanel, 'Render Settings', self.spanel.uid)
self.dpanel = SettingsPanel(settings=self.s, title='Display Settings', config=self.config)
self.s.interface.add_panel(self.dpanel, 'Display Settings', self.dpanel.uid)
self.mode_opt = SettingOptions(title='Render Mode',
desc='What to simulate and display',
key='rendermode',
section='renderer',
options=[Mode.__dict__[x] for x in dir(Mode) if not x.startswith('_')],
panel=self.spanel)
self.spanel.add_widget(self.mode_opt)
self.chan_opt = SettingOptions(title='Channel',
desc='Emissions channel to select',
key='channel',
section='renderer',
options=self.channellist,
panel=self.spanel)
self.spanel.add_widget(self.chan_opt)
self.snap_opt = SettingNumeric(title='Snap',
desc='Snap number to select',
key='snap',
section='renderer',
panel=self.spanel)
self.spanel.add_widget(self.snap_opt)
self.nlamb_opt = SettingNumeric(title='NLamb',
desc='Number of frequencies to sample during spectra calculations',
key='nlamb',
section='renderer',
panel=self.spanel)
self.spanel.add_widget(self.nlamb_opt)
#.........这里部分代码省略.........