本文整理汇总了Python中mforms.Utilities.add_timeout方法的典型用法代码示例。如果您正苦于以下问题:Python Utilities.add_timeout方法的具体用法?Python Utilities.add_timeout怎么用?Python Utilities.add_timeout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mforms.Utilities
的用法示例。
在下文中一共展示了Utilities.add_timeout方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update_refresh_rate
# 需要导入模块: from mforms import Utilities [as 别名]
# 或者: from mforms.Utilities import add_timeout [as 别名]
def update_refresh_rate(self):
index = int(self.refresh_selector.get_selected_index())
grt.root.wb.options.options['Administrator:refresh_connections_rate_index'] = index
self.serial += 1
if self._refresh_timeout:
Utilities.cancel_timeout(self._refresh_timeout)
self._refresh_timeout = None
if (index < self.refresh_values_size):
self._refresh_timeout = Utilities.add_timeout(self.refresh_values[index], partial(self.refresh, my_serial = self.serial))
示例2: __init__
# 需要导入模块: from mforms import Utilities [as 别名]
# 或者: from mforms.Utilities import add_timeout [as 别名]
def __init__(self, ctrl_be, server_profile, main_view, editor):
mforms.AppView.__init__(self, False, "administrator", False)
self.editor = editor
self.owner = main_view
self.tabs = []
self.name2page = {}
self.config_ui = None
self.closing = False
self.tabview = newTabView(True)
self.ctrl_be = ctrl_be
self.old_active_tab = None
self.server_profile = server_profile
self.refresh_tasks_sleep_time = 2
# if we're in the Mac, we need to set the background color of the main view of the tab to white,
# so that MTabSwitcher will take the cue and set the tab color to white too
if self.server_profile.host_os == wbaOS.darwin:
self.set_back_color("#ffffff")
# Setup self
self.set_managed()
self.set_release_on_add()
self.on_close(wb_admin_utils.weakcb(self, "handle_on_close"))
self.ctrl_be.add_me_for_event("server_started", self)
self.ctrl_be.add_me_for_event("server_stopped", self)
self.add(self.tabview, True, True)
Utilities.add_timeout(0.5, weakcb(self, "timeout"))
self.timeout_thread = threading.Thread(target = self.refresh_tasks_thread)
self.timeout_thread.setDaemon(True)
self.timeout_thread.start()
self.tabview.add_tab_changed_callback(self.tab_changed)
self.timeout() # will call self.connect_mysql() and check if mysql is running
self.ctrl_be.continue_events() # Process events which are queue during init
dprint_ex(1, "WBA init complete")
示例3: __init__
# 需要导入模块: from mforms import Utilities [as 别名]
# 或者: from mforms.Utilities import add_timeout [as 别名]
def __init__(self, ctrl_be, server_profile, main_view, editor):
mforms.AppView.__init__(self, False, "administrator", False)
self.editor = editor
self.owner = main_view
self.tabs = []
self.name2page = {}
self.config_ui = None
self.closing = False
self.tabview = newTabView(True)
self.ctrl_be = ctrl_be
self.old_active_tab = None
self.server_profile = server_profile
# if we're in the Mac, we need to set the background color of the main view of the tab to white,
# so that MTabSwitcher will take the cue and set the tab color to white too
if self.server_profile.host_os == wbaOS.darwin:
self.set_back_color("#ffffff")
# Setup self
self.set_managed()
self.set_release_on_add()
self.on_close(wb_admin_utils.weakcb(self, "handle_on_close"))
nc.add_observer(self.handle_server_state_changed, "GRNServerStateChanged", editor)
self.ctrl_be.add_me_for_event("server_started", self)
self.ctrl_be.add_me_for_event("server_stopped", self)
self.add(self.tabview, True, True)
self._timeout_tm = Utilities.add_timeout(0.5, weakcb(self, "timeout"))
self.tabview.add_tab_changed_callback(self.tab_changed)
self.timeout()
# check initial state
if editor.isConnected == 1:
self.ctrl_be.event_from_main("server_started")
elif editor.isConnected == -1:
self.ctrl_be.event_from_main("server_offline")
self.ctrl_be.continue_events() # Process events which are queue during init
log_debug("WBA init complete\n")
示例4: __init__
# 需要导入模块: from mforms import Utilities [as 别名]
# 或者: from mforms.Utilities import add_timeout [as 别名]
def __init__(self, server_profile, ctrl_be, monitor):
mforms.Box.__init__(self, True) # True - vertical layout
self.tasks_side = newTaskSidebar()
self.content_box = newBox(False)
self.tasks_side.set_selection_color(mforms.SystemHighlight)
self.tabs = []
self.name2page = {}
self.config_ui = None
self.closing = False
self.tabview = newTabView(True)
self.ctrl_be = ctrl_be
self.old_active_tab = None
self.server_profile = server_profile
self.refresh_tasks_sleep_time = 2
self.ui_profile = UIProfile(server_profile)
# Setup self
self.set_managed()
self.ui_profile.apply_style(self, "main")
if server_profile.host_os == wbaOS.windows:
side_panel = newPanel(mforms.StyledHeaderPanel)
side_panel.set_title(" Task and Object Browser")
side_panel.add(self.tasks_side)
self.add(side_panel, False, True)
self.content_panel = newPanel(mforms.StyledHeaderPanel)
self.content_panel.set_title(" Task and Object Browser")
self.content_panel.add(self.content_box)
self.add(self.content_panel, True, True)
else:
vbox = newBox(False)
vbox.add(self.tasks_side, True, True)
self.add(vbox, False, False)
vbox = newBox(False)
self.content_label = newHeaderLabel("")
self.ui_profile.apply_style(self.content_label, 'content-label')
vbox.add(self.content_label, False, False)
vbox.add(self.content_box, True, True)
self.add(vbox, True, True)
self.ctrl_be.add_me_for_event("server_started", self)
self.ctrl_be.add_me_for_event("server_stopped", self)
# Setup tasks sidebar
self.fill_task_sidebar()
self.tasks_side.add_on_section_command_callback(self.section_clicked)
self.tasks_side.show()
self.tasks_side.set_size(220, -1)
# Setup content box
self.content_box.add(self.tabview, True, True)
# Create content pages
self.server_status_page = ServerStatusPage(server_profile, ctrl_be, self)
self.config_ui = WbAdminConfigFileUI(server_profile = server_profile, ctrl_be = ctrl_be, main_view = self)
self.startup = WbAdminConfigurationStartup(ctrl_be, server_profile, self)
self.security = WbAdminSecurity(self.ctrl_be, server_profile, self)
self.variables = WbAdminVariables(self.ctrl_be, server_profile, self)
self.logs = WbAdminLogs(self.ctrl_be, server_profile, self)
self.dump = WbAdminExport(server_profile, self.ctrl_be, self)
Utilities.add_timeout(0.5, weakcb(self, "timeout"))
self.timeout_thread = threading.Thread(target = self.refresh_tasks_thread)
self.timeout_thread.setDaemon(True)
self.timeout_thread.start()
self.tabview.add_tab_changed_callback(self.tab_changed)
self.timeout() # will call self.connect_mysql() and check if mysql is running
self.ctrl_be.continue_events() # Process events which are queue during init
dprint_ex(1, "WBA init complete")
self.tasks_side.select_entry("MANAGEMENT", "Server Status")
self.server_status_page.page_activated()