本文整理汇总了Python中pyface.api.GUI类的典型用法代码示例。如果您正苦于以下问题:Python GUI类的具体用法?Python GUI怎么用?Python GUI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GUI类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: manage_multi_firmware_update
def manage_multi_firmware_update(self):
# Set up progress dialog and transfer file to Piksi using SBP FileIO
progress_dialog = PulsableProgressDialog(len(self.stm_fw.blob))
progress_dialog.title = "Transferring image file"
GUI.invoke_later(progress_dialog.open)
self._write("Transferring image file...")
try:
FileIO(self.link).write("upgrade.image_set.bin", self.stm_fw.blob,
progress_cb=progress_dialog.progress)
except Exception as e:
self._write("Failed to transfer image file to Piksi: %s\n" % e)
progress_dialog.close()
return
try:
progress_dialog.close()
except AttributeError:
pass
# Setup up pulsed progress dialog and commit to flash
progress_dialog = PulsableProgressDialog(100, True)
progress_dialog.title = "Committing to flash"
GUI.invoke_later(progress_dialog.open)
self._write("Committing file to flash...")
def log_cb(msg, **kwargs): self._write(msg.text)
self.link.add_callback(log_cb, SBP_MSG_LOG)
code = shell_command(self.link, "upgrade_tool upgrade.image_set.bin", 240)
self.link.remove_callback(log_cb, SBP_MSG_LOG)
progress_dialog.close()
if code != 0:
self._write('Failed to perform upgrade (code = %d)' % code)
return
self._write('Resetting Piksi...')
self.link(MsgReset(flags=0))
开发者ID:axlan,项目名称:piksi_tools,代码行数:34,代码来源:update_view.py
示例2: process
def process(self):
for job in self.jobs:
job.percent_complete = min(
job.percent_complete + random.randint(0, 3), 100)
if any(job.percent_complete < 100 for job in self.jobs):
GUI.invoke_after(100, self.process)
开发者ID:bergtholdt,项目名称:traitsui,代码行数:7,代码来源:Table_editor_with_progress_column.py
示例3: tracking_state_callback
def tracking_state_callback(self, sbp_msg, **metadata):
t = time.time() - self.t_init
self.time[0:-1] = self.time[1:]
self.time[-1] = t
# first we loop over all the SIDs / channel keys we have stored and set 0 in for CN0
for key, cno_array in self.CN0_dict.items():
# p
if (cno_array == 0).all():
self.CN0_dict.pop(key)
else:
new_arr = np.roll(cno_array, -1)
new_arr[-1] = 0
self.CN0_dict[key] = new_arr
# If the whole array is 0 we remove it
# for each satellite, we have a (code, prn, channel) keyed dict
# for each SID, an array of size MAX PLOT with the history of CN0's stored
# If there is no CN0 or not tracking for an epoch, 0 will be used
# each array can be plotted against host_time, t
for i, s in enumerate(sbp_msg.states):
if code_is_gps(s.sid.code):
sat = s.sid.sat
elif code_is_glo(s.sid.code):
sat = s.fcn - GLO_FCN_OFFSET
self.glo_slot_dict[sat] = s.sid.sat
key = (s.sid.code, sat, i)
if s.cn0 != 0:
self.CN0_dict[key][-1] = s.cn0 / 4.0
GUI.invoke_later(self.update_plot)
开发者ID:jkretzmer,项目名称:piksi_tools,代码行数:31,代码来源:tracking_view.py
示例4: tracking_state_callback
def tracking_state_callback(self, sbp_msg, **metadata):
t = time.time() - self.t_init
self.time[0:-1] = self.time[1:]
self.time[-1] = t
# first we loop over all the SIDs / channel keys we have stored and set 0 in for CN0
for key, cno_array in self.CN0_dict.items():
# p
if (cno_array==0).all():
self.CN0_dict.pop(key)
else:
self.CN0_dict[key][0:-1] = cno_array[1:]
self.CN0_dict[key][-1] = 0
# If the whole array is 0 we remove it
# for each satellite, we have a (code, prn, channel) keyed dict
# for each SID, an array of size MAX PLOT with the history of CN0's stored
# If there is no CN0 or not tracking for an epoch, 0 will be used
# each array can be plotted against host_time, t
for i,s in enumerate(sbp_msg.states):
prn = s.sid.sat
if code_is_gps(s.sid.code):
prn += 1
key = (s.sid.code, prn, i)
if s.state != 0:
if len(self.CN0_dict.get(key, [])) == 0:
self.CN0_dict[key] = np.zeros(NUM_POINTS)
self.CN0_dict[key][-1] = s.cn0
GUI.invoke_later(self.update_plot)
开发者ID:margaret,项目名称:piksi_tools,代码行数:27,代码来源:tracking_view.py
示例5: main
def main(argv):
""" A simple example of using the the application scripting framework in a
workbench.
"""
# Create the GUI.
gui = GUI()
# Create the workbench.
workbench = ExampleScript(state_location=gui.state_location)
window = workbench.create_window(position=(300, 300), size=(400, 300))
window.open()
# Create some objects to edit.
# FIXME v3: The need to explicitly set the style to its default value is
# due to a bug in the implementation of Scriptable.
label = Label(text="Label", style='normal')
label2 = Label(text="Label2", style='normal')
# Edit the objects.
window.edit(label)
window.edit(label2)
# Start the GUI event loop.
gui.start_event_loop()
return
开发者ID:archcidburnziso,项目名称:apptools,代码行数:28,代码来源:example.py
示例6: main
def main():
os.chdir( os.path.dirname( os.path.realpath( __file__ )))
#read the command line arguments or fetch the default values
args=cli_args(sys.argv[2:])
#generate the initial dataset
#TODO collect the "name" of the sample dataset on the command line
sample_dataset,sample_metadata,exec_script=preproc(args)
g=CvuGUI(sample_dataset,sample_metadata,quiet=args['quiet'])
sample_dataset.gui=g
#Qt does not sys.exit in response to KeyboardInterrupt
#we intercept KeyboardInterrupts in the interpreter, before even
#reaching the Qt event loop and force them to call sys.exit
signal.signal(signal.SIGINT, signal.SIG_DFL)
if exec_script is not None:
from pyface.api import GUI
gui=GUI()
def run_script():
gui.process_events()
script(exec_script, cvu_gui=g, scriptdir=sys.argv[1])
gui.invoke_later(run_script)
g.configure_traits()
开发者ID:aestrivex,项目名称:cvu,代码行数:30,代码来源:main.py
示例7: manage_nap_firmware_update
def manage_nap_firmware_update(self, check_version=False):
# Flash NAP if out of date.
try:
local_nap_version = parse_version(
self.settings['system_info']['nap_version'].value)
remote_nap_version = parse_version(self.newest_nap_vers)
nap_out_of_date = local_nap_version != remote_nap_version
except KeyError:
nap_out_of_date = True
if nap_out_of_date or check_version==False:
text = "Updating NAP"
self._write(text)
self.create_flash("M25")
nap_n_ops = self.pk_flash.ihx_n_ops(self.nap_fw.ihx)
progress_dialog = PulsableProgressDialog(nap_n_ops, True)
progress_dialog.title = text
GUI.invoke_later(progress_dialog.open)
self.pk_flash.write_ihx(self.nap_fw.ihx, self.stream, mod_print=0x40, \
elapsed_ops_cb = progress_dialog.progress)
self.stop_flash()
self._write("")
progress_dialog.close()
return True
else:
text = "NAP is already to latest version, not updating!"
self._write(text)
self._write("")
return False
开发者ID:asthakeshan,项目名称:piksi_tools,代码行数:28,代码来源:update_view.py
示例8: run
def run(self):
print "Performing expensive calculation in %s..."%self.getName(),
sleep(3)
sd = self.data.scalar_data
sd += numpy.sin(numpy.random.rand(*sd.shape)*2.0*numpy.pi)
GUI.invoke_later(self.data.update)
print 'done.'
开发者ID:B-Rich,项目名称:mayavi,代码行数:7,代码来源:compute_in_thread.py
示例9: main
def main(argv):
"""A simple example of using the workbench."""
# Create the GUI.
gui = GUI()
# Create the workbench.
#
# fixme: I wouldn't really want to specify the state location here.
# Ideally this would be part of the GUI's as DOMs idea, and the state
# location would be an attribute picked up from the DOM hierarchy. This
# would also be the mechanism for doing 'confirm' etc... Let the request
# bubble up the DOM until somebody handles it.
workbench = ExampleWorkbench(state_location=gui.state_location)
# Create the workbench window.
window = workbench.create_window(position=(300, 300), size=(800, 600))
window.open()
# This will cause a TraitsUI editor to be created.
window.edit(Person(name='fred', age=42, salary=50000))
# This will cause a toolkit specific editor to be created.
window.edit("This text is implemented by a toolkit specific widget.")
# Start the GUI event loop.
gui.start_event_loop()
开发者ID:archcidburnziso,项目名称:apptools,代码行数:27,代码来源:example.py
示例10: select_selected
def select_selected(self, initialized):
""" Force the tree editor to select the current engine selection,
and eventually collapse other scenes.
"""
# We need to explore the editors to find the one we are
# interested in, and to switch its selection to None, and then
# back to what we are interested in.
editors = self.info.ui._editors
if editors is not None:
for editor in editors:
if editor.factory is self.info.object.tree_editor:
tree_editor = editor
break
else:
return
else:
return
# We switch the selection to None, but we avoid
# trait callback, to avoid changing the engine's
# current_selection.
tree_editor.trait_set(selected=None, trait_change_notify=False)
current_selection = self.info.object.engine.current_selection
GUI.set_trait_later(tree_editor, 'selected', current_selection)
# If we are selecting a scene, collapse the others
if isinstance(current_selection, Scene) and \
hasattr(tree_editor._tree, 'Collapse'):
# The wx editor can collapse, dunno for the Qt
for scene in self.info.object.engine.scenes:
if scene is not current_selection:
tree_editor._tree.Collapse(
tree_editor._get_object_nid(scene))
开发者ID:bergtholdt,项目名称:mayavi,代码行数:33,代码来源:engine_rich_view.py
示例11: _baseline_callback_ned
def _baseline_callback_ned(self, sbp_msg, **metadata):
# Updating an ArrayPlotData isn't thread safe (see chaco issue #9), so
# actually perform the update in the UI thread.
if self.running:
#GUI.invoke_later(self.baseline_callback, sbp_msg)
soln = MsgBaselineNED(sbp_msg)
GUI.invoke_later(self.baseline_callback, soln)
cnt = self.cnt % 4
fake_sbp_msg = copy.copy(soln)
if cnt == 3:
fake_sbp_msg.e = 217371
fake_sbp_msg.n = 100837 - (cnt+1) * 10e3
else:
fake_sbp_msg.e = 217371 + cnt * 20e3
fake_sbp_msg.n = 100837 - cnt * 20e3
fake_sbp_msg.sender = 100 + cnt
fake_sbp_msg.flags = cnt
soln = fake_sbp_msg
self.cnt += 1
GUI.invoke_later(self.baseline_callback, soln)
# _threshold_satisfied()函数计算需要优化
# 或者保持数据发送频率小于2(/s)
time.sleep(0.5)
开发者ID:diti2015,项目名称:PileMonitor,代码行数:26,代码来源:baseline_view.py
示例12: run
def run(self):
cams, new_cams = register_image(self.vsfm_interface, self.imfn,
match_specified_fn = self.match_specified_fn,
max_sleep_seconds = self.max_sleep_seconds)
GUI.invoke_later(mayaviu.plot_cameras, new_cams)
self.cams = cams
self.new_cams = new_cams
开发者ID:lfkeong,项目名称:vsfm_util,代码行数:7,代码来源:vsfm_util.py
示例13: visualize
def visualize(self):
'''
Start the visualisation of the simulation result.
Set up Upgrade method and starts the main loop.
Use only if the simulation result was set!
'''
# update the lookuptables and set them
minL = []
maxL = []
for array in self.scalarSolution[self.solutionPosition][self.scalarPosition].itervalues():
minL.append(array.min())
maxL.append(array.max())
self.SourceMin = min(minL)
self.SourceMax = max(maxL)
for actor in self.vizActors.itervalues():
actor.module_manager.scalar_lut_manager.data_range = [self.SourceMin, self.SourceMax]
#self.vizActors[0].module_manager.scalar_lut_manager.data_name = self.scalarNames[self.solutionPosition][self.scalarPosition]
#self.vizActors[0].module_manager.scalar_lut_manager.show_scalar_bar = True
timer = Timer(0.03, self.update)
gui = GUI()
gui.busy = True
gui.start_event_loop()
开发者ID:Biomechanics-NTNU,项目名称:Vascular1DFlow,代码行数:25,代码来源:class3dVisualisation.py
示例14: test_coreg_gui
def test_coreg_gui():
"""Test CoregFrame."""
_check_ci()
home_dir = _TempDir()
os.environ['_MNE_GUI_TESTING_MODE'] = 'true'
os.environ['_MNE_FAKE_HOME_DIR'] = home_dir
try:
assert_raises(ValueError, mne.gui.coregistration, subject='Elvis',
subjects_dir=subjects_dir)
from pyface.api import GUI
gui = GUI()
# avoid modal dialog if SUBJECTS_DIR is set to a directory that
# does not contain valid subjects
ui, frame = mne.gui.coregistration(subjects_dir='')
frame.model.mri.subjects_dir = subjects_dir
frame.model.mri.subject = 'sample'
assert_false(frame.model.mri.fid_ok)
frame.model.mri.lpa = [[-0.06, 0, 0]]
frame.model.mri.nasion = [[0, 0.05, 0]]
frame.model.mri.rpa = [[0.08, 0, 0]]
assert_true(frame.model.mri.fid_ok)
frame.raw_src.file = raw_path
# grow hair (high-res head has no norms)
assert_true(frame.model.mri.use_high_res_head)
frame.model.mri.use_high_res_head = False
frame.model.grow_hair = 40.
# scale
frame.coreg_panel.n_scale_params = 3
frame.coreg_panel.scale_x_inc = True
assert_equal(frame.model.scale_x, 1.01)
frame.coreg_panel.scale_y_dec = True
assert_equal(frame.model.scale_y, 0.99)
# reset parameters
frame.coreg_panel.reset_params = True
assert_equal(frame.model.grow_hair, 0)
assert_false(frame.model.mri.use_high_res_head)
# configuration persistence
assert_true(frame.model.prepare_bem_model)
frame.model.prepare_bem_model = False
frame.save_config(home_dir)
ui.dispose()
gui.process_events()
ui, frame = mne.gui.coregistration(subjects_dir=subjects_dir)
assert_false(frame.model.prepare_bem_model)
assert_false(frame.model.mri.use_high_res_head)
ui.dispose()
gui.process_events()
finally:
del os.environ['_MNE_GUI_TESTING_MODE']
del os.environ['_MNE_FAKE_HOME_DIR']
开发者ID:HSMin,项目名称:mne-python,代码行数:59,代码来源:test_coreg_gui.py
示例15: main
def main():
# Create the GUI.
gui = GUI()
# Create and open an application window.
window = IVTKWithCrustAndBrowser(size=(800,600))
window.open()
# Start the GUI event loop!
gui.start_event_loop()
开发者ID:PerryZh,项目名称:mayavi,代码行数:8,代码来源:ivtk.py
示例16: _append_log
def _append_log(self, msg, endline="\n"):
def toappend():
if self._progress_started:
self._progress_logs += msg + endline
else:
self._logs += msg + endline
GUI.invoke_later(toappend) # to be thread safe when logs are displayed in gui
开发者ID:mrkwjc,项目名称:ffnetui,代码行数:8,代码来源:logger.py
示例17: _wrap_update
def _wrap_update():
update_funcs = self._update_funcs.copy()
self._update_funcs.clear()
for update in update_funcs.values():
update_func, args = update
update_func(*args)
if self._update_funcs:
GUI.invoke_later(_wrap_update)
开发者ID:swift-nav,项目名称:piksi_tools,代码行数:8,代码来源:gui_utils.py
示例18: lock_orientation
def lock_orientation(obj, name, old, new):
## print 'locking o'
if orientation_flag[obj]:
orientation_flag[obj] = False
return
def icb():
orientation_flag[obj] = True
obj.orientation = np.array(old)
GUI.invoke_later(icb)
开发者ID:EelcoHoogendoorn,项目名称:Escheresque,代码行数:9,代码来源:interface.py
示例19: set_view
def set_view(self, s):
"""Sets the view correctly."""
#s.scene.reset_zoom()
s.scene.z_plus_view()
c = s.scene.camera
c.azimuth(30)
c.elevation(30)
s.render()
GUI.process_events()
开发者ID:bergtholdt,项目名称:mayavi,代码行数:9,代码来源:test_image_plane_widget.py
示例20: run
def run(self):
step = 0
while (self.running):
self.interface.datamodel.Update()
step += 1
if step>=self.interface.steps:
step=0
GUI.invoke_later(self.interface.callback)
GUI.invoke_later(self.interface.redraw_scene)
开发者ID:EelcoHoogendoorn,项目名称:Escheresque,代码行数:9,代码来源:interface.py
注:本文中的pyface.api.GUI类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论