def __init__(self, ctrl_be, instance_info, main_view): WbAdminTabBase.__init__(self, ctrl_be, instance_info, main_view) nc.add_observer(self.updateColors, "GNColorsChanged") self.min_server_version = (5, 6, 6) self._refresh_tm = None self.drawbox = None self._form_deactivated_conn = None self.add_validation(WbAdminValidationConnection(ctrl_be))
def __init__(self, ctrl_be, server_profile, main_view, editor): mforms.AppView.__init__(self, False, "Administrator", "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 self.server_profile.host_os == wbaOS.darwin: self.set_back_color( Color.getSystemColor(ControlBackgroundColor).to_html()) # 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) nc.add_observer(self.updateColors, "GNColorsChanged") 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")
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")
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")
def __init__(self, owner, json_text, context, server_version): mforms.Box.__init__(self, False) self.set_managed() self.set_release_on_add() self._context = context get_resource_path = mforms.App.get().get_resource_path self.toolbar = mforms.newToolBar(mforms.SecondaryToolBar) self.toolbar.set_back_color("#ffffff") self.switcher_item = newToolBarItem(mforms.SelectorItem) self.toolbar.add_item(self.switcher_item) s = newToolBarItem(mforms.SeparatorItem) self.toolbar.add_item(s) l = newToolBarItem(mforms.LabelItem) l.set_text("Display Info:") self.toolbar.add_item(l) item = newToolBarItem(mforms.SelectorItem) item.set_selector_items(["Read + Eval cost", "Data Read per Join"]) item.add_activated_callback(self.display_cost) self.toolbar.add_item(item) cost_type_item = item # cost info was added in 5.7.2 has_cost_info = server_version >= Version(5, 7) if not has_cost_info: item.set_enabled(False) #item = newToolBarItem(mforms.SelectorItem) # item.set_selector_items(["Show Aggregated Costs", "Show Individual Costs"]) # item.add_activated_callback(self.toggle_aggregated) # self.toolbar.add_item(item) #btn = newToolBarItem(mforms.SegmentedToggleItem) #btn.set_icon(get_resource_path("qe_resultset-tb-switcher_grid_off_mac.png")) #btn.set_alt_icon(get_resource_path("qe_resultset-tb-switcher_grid_on_mac.png")) #self.toolbar.add_item(btn) #btn = newToolBarItem(mforms.SegmentedToggleItem) #btn.set_icon(get_resource_path("qe_resultset-tb-switcher_explain_off.png")) #btn.set_alt_icon(get_resource_path("qe_resultset-tb-switcher_explain_on.png")) #self.toolbar.add_item(btn) s = newToolBarItem(mforms.SeparatorItem) self.toolbar.add_item(s) btn = newToolBarItem(mforms.ActionItem) btn.set_icon(get_resource_path("tiny_saveas.png")) btn.add_activated_callback(self.save) btn.set_tooltip("Save image to an external file.") self.toolbar.add_item(btn) s = newToolBarItem(mforms.SeparatorItem) self.toolbar.add_item(s) l = newToolBarItem(mforms.LabelItem) l.set_text("Overview:") self.toolbar.add_item(l) btn = newToolBarItem(mforms.ActionItem) btn.set_icon( get_resource_path("qe_sql-editor-explain-tb-overview.png")) btn.add_activated_callback(self.overview) btn.set_tooltip("Zoom out the diagram.") self.toolbar.add_item(btn) s = newToolBarItem(mforms.SeparatorItem) self.toolbar.add_item(s) l = newToolBarItem(mforms.LabelItem) l.set_text("View Source:") self.toolbar.add_item(l) btn = newToolBarItem(mforms.ToggleItem) btn.set_icon(get_resource_path("statusbar_output.png")) btn.set_alt_icon(get_resource_path("statusbar_output.png")) btn.add_activated_callback(self.switch_to_raw) btn.set_tooltip("View the raw JSON explain data.") self.toolbar.add_item(btn) self.add(self.toolbar, False, True) # Query Plan diagram self.scroll = mforms.newScrollPanel(mforms.ScrollPanelNoFlags) self.scroll.set_visible_scrollers(True, True) #self.img = mforms.newImageBox() self.drawbox = RenderBox(self._context, self.scroll) self.scroll.add(self.drawbox) self.drawbox.node_spacing = self.node_spacing self.drawbox.vertical = self.vertical self.add(self.scroll, True, True) self.display_cost(cost_type_item) # textbox to view the json data self._raw_explain = mforms.CodeEditor() self._raw_explain.set_value(json_text) self._raw_explain.set_language(mforms.LanguageJson) self._raw_explain.set_features( mforms.FeatureReadOnly | mforms.FeatureFolding, True) self.add(self._raw_explain, True, True) self._raw_explain.show(False) nc.add_observer(self.updateColors, "GNColorsChanged") backgroundColor = Color.getSystemColor(TextBackgroundColor) self.scroll.set_back_color(backgroundColor.to_html())