本文整理汇总了Python中pyface.gui.GUI类的典型用法代码示例。如果您正苦于以下问题:Python GUI类的具体用法?Python GUI怎么用?Python GUI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GUI类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_table_editor_select_cells
def test_table_editor_select_cells():
gui = GUI()
object_list = ObjectListWithSelection(
values=[ListItem(value=str(i**2)) for i in range(10)]
)
object_list.selected_cells = [
(object_list.values[5], 'value'),
(object_list.values[6], 'other value'),
(object_list.values[8], 'value'),
]
with store_exceptions_on_all_threads():
ui = object_list.edit_traits(view=select_cells_view)
editor = ui.get_editors('values')[0]
gui.process_events()
if is_current_backend_qt4():
selected = editor.selected
elif is_current_backend_wx():
selected = editor.selected_cells
press_ok_button(ui)
gui.process_events()
assert selected == [
(object_list.values[5], 'value'),
(object_list.values[6], 'other value'),
(object_list.values[8], 'value'),
]
示例2: test_progress_column
def test_progress_column():
from traitsui.extras.progress_column import ProgressColumn
progress_view = View(
Item(
'values',
show_label=False,
editor=TableEditor(
columns=[
ObjectColumn(name='value'),
ProgressColumn(name='other_value'),
],
)
),
buttons=['OK'],
)
gui = GUI()
object_list = ObjectList(
values=[ListItem(value=str(i**2)) for i in range(10)]
)
with store_exceptions_on_all_threads():
ui = object_list.edit_traits(view=progress_view)
gui.process_events()
press_ok_button(ui)
gui.process_events()
示例3: _wait_for_data
def _wait_for_data(self):
next_poll = self._handle_data()
socks = dict(self._poller.poll(timeout=self.poll_timeout))
if self._handshake_socket in socks and \
socks[self._handshake_socket] == zmq.POLLIN:
self._handle_connection()
GUI.invoke_after(next_poll, self._wait_for_data)
示例4: _execute_seek
def _execute_seek(self, controller, pattern):
duration = pattern.duration
total_duration = pattern.total_duration
lm = self.laser_manager
sm = lm.stage_manager
ld = sm.lumen_detector
ld.mask_kind = pattern.mask_kind
ld.custom_mask = pattern.custom_mask_radius
osdp = sm.canvas.show_desired_position
sm.canvas.show_desired_position = False
st = time.time()
self.debug('Pre seek delay {}'.format(pattern.pre_seek_delay))
time.sleep(pattern.pre_seek_delay)
self.debug('starting seek')
self.debug('total duration {}'.format(total_duration))
self.debug('dwell duration {}'.format(duration))
if pattern.kind == 'DragonFlyPeakPattern':
try:
self._dragonfly_peak(st, pattern, lm, controller)
except BaseException as e:
self.critical('Dragonfly exception. {}'.format(e))
else:
self._hill_climber(st, controller, pattern)
sm.canvas.show_desired_position = osdp
from pyface.gui import GUI
GUI.invoke_later(self._info.dispose)
示例5: do_callback
def do_callback(dispatch, callback, *args):
"""Invoke the callback with a suitable dispatch.
"""
if dispatch == 'ui':
from pyface.gui import GUI
GUI.invoke_later(callback, *args)
else:
callback(*args)
示例6: progress
def progress(self, value):
""" Set the progress of the operation (0 <= value <= 1). """
if self.dispatch == 'ui':
from pyface.gui import GUI
GUI.set_trait_later(self.promise, '_progress', value)
else:
with self.promise._lock:
self.promise._progress = value
示例7: test_styles
def test_styles(self):
# simple smoke test of buttons
gui = GUI()
button_text_edit = ButtonTextEdit()
with store_exceptions_on_all_threads():
ui = button_text_edit.edit_traits()
self.addCleanup(ui.dispose)
gui.process_events()
示例8: execute
def execute(self):
url = 'http://' + self._host + self._url % self._tile_args
try:
r = requests.get(url)
if r.status_code == 200:
GUI.invoke_later(self.handler, self._tile_args, r.content)
except requests.exceptions.RequestException as ex:
print("Exception in request '{}': {}".format(self, ex))
示例9: test_table_editor
def test_table_editor():
gui = GUI()
object_list = ObjectList(values=[ListItem(value=str(i ** 2)) for i in range(10)])
with store_exceptions_on_all_threads():
ui = object_list.edit_traits(view=simple_view)
gui.process_events()
press_ok_button(ui)
gui.process_events()
示例10: error
def error(self, value):
""" Complete the deferred with failure and specified result. """
if self.dispatch == 'ui':
from pyface.gui import GUI
promise = self.promise
GUI.set_trait_later(promise, '_error', value)
GUI.set_trait_later(promise, '_status', 'error')
else:
with self.promise._lock:
self.promise._error = value
self.promise._status = 'error'
示例11: _play_button_changed
def _play_button_changed(self, play_pressed):
'''
Triggered when play button is selected
:param play_pressed:
:return:
'''
if play_pressed:
if not self._play_thread:
self._play_thread = True
GUI.invoke_after(1, self._play_func)
else:
self._play_thread = False
示例12: _play_func
def _play_func(self):
'''
Called while play button is selected
:return:
'''
if self._play_thread:
if self._last_clicked_direction is not None:
self._last_clicked_direction()
else:
self.move_forward()
GUI.invoke_after(1000, self._play_func)
示例13: start
def start(self):
self._zmq_context = zmq.Context()
self._poller = zmq.Poller()
self._handshake_socket = self._zmq_context.socket(zmq.REP)
self._handshake_socket.bind(self.handshake_string)
self._data_socket = self._zmq_context.socket(zmq.SUB)
self._data_socket.setsockopt(zmq.SUBSCRIBE, '')
self._data_socket.connect(self.data_string)
self._poller.register(self._handshake_socket, zmq.POLLIN)
self._poller.register(self._data_socket, zmq.POLLIN)
GUI.invoke_after(self.poll_period, self._wait_for_data)
示例14: test_filtered_table_editor
def test_filtered_table_editor():
gui = GUI()
object_list = ObjectListWithSelection(
values=[ListItem(value=str(i**2)) for i in range(10)]
)
with store_exceptions_on_all_threads():
ui = object_list.edit_traits(view=filtered_view)
gui.process_events()
filter = ui.get_editors('values')[0].filter
press_ok_button(ui)
gui.process_events()
assert filter is not None
示例15: setUp
def setUp(self):
self.gui = GUI()
self.parent = Window()
self.parent._create()
self.parent.open()
self.addCleanup(self._destroy_parent)
self.gui.process_events()