本文整理汇总了Python中python_qt_binding.QtCore.QTimer.singleShot方法的典型用法代码示例。如果您正苦于以下问题:Python QTimer.singleShot方法的具体用法?Python QTimer.singleShot怎么用?Python QTimer.singleShot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类python_qt_binding.QtCore.QTimer
的用法示例。
在下文中一共展示了QTimer.singleShot方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from python_qt_binding.QtCore import QTimer [as 别名]
# 或者: from python_qt_binding.QtCore.QTimer import singleShot [as 别名]
def __init__(self, parent=None):
super(XTermWidget, self).__init__(parent)
self.setObjectName('XTermWidget')
self._process = QProcess(self)
self._process.finished.connect(self.close_signal)
# let the widget finish init before embedding xterm
QTimer.singleShot(100, self._embed_xterm)
示例2: autoScrollLog
# 需要导入模块: from python_qt_binding.QtCore import QTimer [as 别名]
# 或者: from python_qt_binding.QtCore.QTimer import singleShot [as 别名]
def autoScrollLog(self):
QTimer.singleShot(0, self._widget.logList.scrollToBottom)
示例3: on_load_profile_file
# 需要导入模块: from python_qt_binding.QtCore import QTimer [as 别名]
# 或者: from python_qt_binding.QtCore.QTimer import singleShot [as 别名]
#.........这里部分代码省略.........
try:
import yaml
with open(path, 'r') as f:
# print yaml.load(f.read())
content = yaml.load(f.read())
if not isinstance(content, dict):
raise Exception("Mailformed profile: %s" % os.path.basename(path))
for muri, master_dict in content.items():
local_hostname = get_hostname(self._main_window.getMasteruri())
rmuri = muri.replace('$LOCAL$', local_hostname)
master = self._main_window.getMaster(rmuri)
running_nodes = master.getRunningNodesIfLocal()
usr = None
self._current_profile[rmuri] = set()
if 'user' in master_dict:
usr = master_dict['user']
if master_dict['mastername'] and master_dict['mastername']:
nm.nameres().add_master_entry(master.masteruri, master_dict['mastername'], master_dict['address'])
hostname = master_dict['address'].replace('$LOCAL$', local_hostname)
if 'master_discovery' in master_dict:
self._start_node_from_profile(master, hostname, 'master_discovery_fkie', 'master_discovery', usr, cfg=master_dict['master_discovery'])
self._current_profile[rmuri].add('/master_discovery')
if 'master_sync' in master_dict:
self._start_node_from_profile(master, hostname, 'master_sync_fkie', 'master_sync', usr, cfg=master_dict['master_sync'])
self._current_profile[rmuri].add('/master_sync')
if 'zeroconf' in master_dict:
self._start_node_from_profile(master, hostname, 'master_discovery_fkie', 'zeroconf', usr, cfg=master_dict['zeroconf'])
self._current_profile[rmuri].add('/zeroconf')
try:
do_start = []
do_not_stop = {'/rosout', rospy.get_name(), '/node_manager', '/master_discovery', '/master_sync', '*default_cfg', '/zeroconf'}
configs = master_dict['configs']
conf_set = set()
for cfg_name, cmdict in configs.items():
cfg_name = cfg_name.replace('$LOCAL$', local_hostname)
if cfg_name.startswith("pkg://"):
cfg_name = os.path.abspath(resolve_url(cfg_name))
conf_set.add(cfg_name)
reload_launch = True
argv = []
is_default = False
if 'default' in cmdict:
if cmdict['default']:
# it is a default configuration, test for load or not
is_default = True
if 'argv_used' in cmdict['params']:
argv = cmdict['params']['argv_used']
if cfg_name in master.default_cfgs:
reload_launch = False
if argv:
params = get_rosparam(cfg_name, rmuri)
if 'argv_used' in params:
reload_launch = set(params['argv_used']) != set(argv)
if reload_launch:
self._main_window.on_load_launch_as_default_bypkg(cmdict['params']['package'], cmdict['params']['launch_file'], master, argv, local_hostname)
else:
do_not_stop.add(cfg_name)
elif 'argv' in cmdict:
if 'argv' in cmdict:
argv = cmdict['argv']
# do we need to load to load/reload launch file
if cfg_name in master.launchfiles:
reload_launch = set(master.launchfiles[cfg_name].argv) != set(argv)
if reload_launch:
self._main_window.launch_dock.load_file(cfg_name, argv, master.masteruri)
if 'nodes' in cmdict:
self._current_profile[rmuri].update(cmdict['nodes'])
force_start = True
cfg = cfg_name if not is_default else roslib.names.ns_join(cfg_name, 'run')
if not reload_launch:
force_start = False
do_not_stop.update(set(cmdict['nodes']))
do_start.append((reload_launch, cfg, cmdict['nodes'], force_start))
else:
do_start.append((reload_launch, cfg, cmdict['nodes'], force_start))
# close unused configurations
for lfile in set(master.launchfiles.keys()) - conf_set:
master._close_cfg(lfile)
master.stop_nodes_by_name(running_nodes.keys(), True, do_not_stop)
for reload_launch, cfg, nodes, force_start in do_start:
if nodes:
hasstart = True
if reload_launch:
master.start_nodes_after_load_cfg(cfg.rstrip('/run'), list(nodes), force_start)
else:
master.start_nodes_by_name(list(nodes), cfg, force_start)
except Exception as ml:
import traceback
print utf8(traceback.format_exc(1))
rospy.logwarn("Can not load launch file for %s: %s" % (muri, utf8(ml)))
except Exception as e:
import traceback
print traceback.format_exc(1)
MessageBox.warning(self, "Load profile error",
'Error while load profile',
utf8(e))
if not hasstart:
self.update_progress()
else:
QTimer.singleShot(1000, self.update_progress)
示例4: move_marker
# 需要导入模块: from python_qt_binding.QtCore import QTimer [as 别名]
# 或者: from python_qt_binding.QtCore.QTimer import singleShot [as 别名]
def move_marker():
global time, interval
time += interval
if time < 10.0:
marker.set_time(time)
QTimer.singleShot(int(interval * 1000), move_marker)