Ejemplo n.º 1
0
    def __init__(self, server_profile, ctrl_be, main_view, version="5.1"):
        mforms.Box.__init__(self, False)
        self.tab_view = newTabView()
        self.main_view = main_view

        self.myopts = None
        self.opt2ctrl_map = {}
        self.loading = True
        self.section = None
        self.ui_created = False

        self.set_managed()
        self.version = version
        self.ctrl_be = ctrl_be
        self.server_profile = server_profile
        self.cfg_be = None  # Will be created later in self.create_ui
        self.version = version

        self.pack_to_top()
        container = self.main_view.add_content_page(self, "CONFIGURATION",
                                                    "Options File",
                                                    "admin_option_file_win",
                                                    True)

        self.search_panel = self.create_search_panel()
        container.add_end(self.search_panel, False, False)
Ejemplo n.º 2
0
 def __init__(self, catalog):
   
   self.db = PropelDatabase.PropelDatabase(grt.root.wb.doc.physicalModels[0].catalog)
   # have to store app prefernces in catalog.customData :/
   for k, v in self.defaults.iteritems():
     if not self.db.wbObject.customData.has_key(k):
       self.db.cache[k] = v
     else:
       self.db.cache[k] = self.db.wbObject.customData[k]
   # main windows : self
   mforms.Form.__init__(self, None, mforms.FormResizable)
   self.set_title("Propel Utility")
   self.set_size(self.defaults['width'], self.defaults['height'])
   # main box
   box = PropelForm.spaced_box(False)
   # header
   box.add(self.header_box(), False, False)
   # main tabs
   self.tvMain = mforms.newTabView(False)
   for name in self.tabs_list:
     tTab = getattr(self.tabs[name]['class'], self.tabs[name]['method'])(False, name, self.db)
     if name == 'export':
       exportTab = tTab
     self.tvMain.add_page(tTab, self.tabs[name]['name'])
   self.tvMain.relayout()
   self.tvMain.set_active_tab(int(self.db.get_tab_index))
   self.tvMain.add_tab_changed_callback(lambda: exportTab.refresh_text_editor_schema_box())
   
   box.add(self.tvMain, True, True)
   self.set_content(box)
   self.ui_ok_cancel_button(box)
Ejemplo n.º 3
0
    def __init__(self):
        mforms.AppView.__init__(self, False, 'db_copy', True)

        self.background = None
        self.content = mforms.newBox(False)

        if platform.system() == 'Windows':
            self.set_back_color(mforms.App.get().get_system_color(mforms.SystemColorContainer).to_html())
            content_panel = mforms.newPanel(mforms.FilledPanel)
            self.content.set_back_image("migration_background.png", mforms.TopRight)
        else:
            content_panel = mforms.newPanel(mforms.StyledHeaderPanel)
            content_panel.set_back_image("migration_background.png", mforms.TopRight)

        content_panel.set_back_color("#FFFFFF")
        content_panel.set_padding(8)
        self.header = mforms.newLabel("")
        self.header.set_style(mforms.WizardHeadingStyle)
        self.content.add(self.header, False)
        self.tabview = mforms.newTabView(mforms.TabViewTabless)
        self.content.add(self.tabview, True, True)
        content_panel.add(self.content)
        self.add(content_panel, True, True)

        self._ui_created = False
        
        self._page_list = []
        self._page_trail = []
        self._current_page = 0

        # Load current user numeric locale:
        locale.setlocale(locale.LC_NUMERIC, '')

        self.plan = migration.MigrationPlan()
        self.create_ui()
    def create_ui(self):
        self.set_padding(12)
        self.set_spacing(8)

        self.heading = make_panel_header("title_variables.png",
                                         self.server_profile.name,
                                         "Server Variables")
        self.add(self.heading, False, True)

        self.warning = not_running_warning_label()
        self.add(self.warning, False, True)

        self.tab = newTabView(False)
        self.add(self.tab, True, True)

        self.status = VariablesViewer(
            self.ctrl_be, wb_admin_variable_list.status_variable_list,
            "SHOW GLOBAL STATUS", 'status')
        self.status.set_padding(6)
        self.tab.add_page(self.status, "Status Variables")

        self.server = VariablesViewer(
            self.ctrl_be, wb_admin_variable_list.system_variable_list,
            "SHOW GLOBAL VARIABLES", 'system')
        self.server.set_padding(6)
        self.tab.add_page(self.server, "System Variables")
    def __init__(self, editor, schema_name):
        mforms.AppView.__init__(self, False, "schema_inspector", False)

        self.editor = editor

        self.tabview = mforms.newTabView()
        self.add(self.tabview, True, True)

        self.pages = []

        tabs = [SchemaInfoPanel, TableManagerParent, ColumnManager, IndexManager, TriggerManager, ViewManager, ProcedureManager, FunctionManager, GrantsManager]
        if self.editor.serverVersion.majorNumber > 5 or (self.editor.serverVersion.majorNumber == 5 and self.editor.serverVersion.minorNumber >= 1):
            tabs.append(EventManager)
        # tabs.append(AccessManager)
        for Tab in tabs:
            try:
                if Tab is IndexManager:
                    tab = Tab(editor, schema_name, self)
                else:
                    tab = Tab(editor, schema_name)
                setattr(self, "tab_"+tab.node_name, tab)
                self.pages.append(tab)
                self.tabview.add_page(tab, tab.caption)
            except Exception:
                import traceback
                log_error("Error initializing tab %s: %s\n" % (tab.node_name, traceback.format_exc()))
        self.refresh()
Ejemplo n.º 6
0
    def __init__(self, editor, schema_name):
        mforms.AppView.__init__(self, False, "schema_inspector", False)

        self.editor = editor

        self.tabview = mforms.newTabView()
        self.add(self.tabview, True, True)

        self.pages = []

        tabs = [
            SchemaInfoPanel, TableManagerParent, ColumnManager, IndexManager,
            TriggerManager, ViewManager, ProcedureManager, FunctionManager,
            GrantsManager
        ]
        if self.editor.serverVersion.majorNumber > 5 or (
                self.editor.serverVersion.majorNumber == 5
                and self.editor.serverVersion.minorNumber >= 1):
            tabs.append(EventManager)
        # tabs.append(AccessManager)
        for Tab in tabs:
            try:
                if Tab is IndexManager:
                    tab = Tab(editor, schema_name, self)
                else:
                    tab = Tab(editor, schema_name)
                setattr(self, "tab_" + tab.node_name, tab)
                self.pages.append(tab)
                self.tabview.add_page(tab, tab.caption)
            except Exception:
                import traceback
                log_error("Error initializing tab %s: %s\n" %
                          (tab.node_name, traceback.format_exc()))
        self.refresh()
Ejemplo n.º 7
0
    def __init__(self):
        mforms.AppView.__init__(self, True, "migration", True)

        self.plan = migration.MigrationPlan()

        self.toolbars_mgr = migration_toolbars.ToolBarManager()
        self.active_tab = None
        self.old_active_tab = None

        self.set_spacing(6)

        self.ui_profile = migration_ui_style.UIProfile()

        self.left_side_cont = self.create_tasks_side()
        self.add(self.left_side_cont, False, False)
        self.tasks_side.add_section("Overview", "OVERVIEW", 0)
        self.tasks_side.add_section("SourceTarget", "SOURCE & TARGET", 0)
        self.tasks_side.add_section("ObjectMigration", "OBJECT MIGRATION", 0)
        self.tasks_side.add_section("DataMigration", "DATA MIGRATION", 0)
        self.tasks_side.add_section("Report", "REPORT", 0)

        self.tasks_side.add_on_section_command_callback(self.section_clicked)
        self.left_side_cont.set_size(220, -1)

        self.background = mforms.newPanel(mforms.StyledHeaderPanel)
        self.background.set_title("TITLE")

        self._page_trail = []
        self.tabs = []
        self._name2page = {}

        if platform.system() == 'Windows':
            self.content_box = mforms.newBox(False)
            self.content_box.set_back_image("migration_background.png",
                                            mforms.TopRight)
            self.background.add(self.content_box)
            self.background.set_back_color("#ffffff")
        else:
            self.tabview = mforms.newTabView(True)
            self.background.add(self.tabview)
            self.background.set_back_image("migration_background.png",
                                           mforms.TopRight)

        self.add(self.background, True, True)

        self._advancing = True
        self.content = {}
        self.add_content()

        self._selecting_entry = False

        # Load current user numeric locale:
        locale.setlocale(locale.LC_NUMERIC, '')

        self.tasks_side.select_entry(self._overview_page.identifier())
        self.section_clicked(self._overview_page.identifier())
Ejemplo n.º 8
0
    def __init__(self):
        mforms.AppView.__init__(self, True, "migration", True)

        self.plan = migration.MigrationPlan()

        self.toolbars_mgr = migration_toolbars.ToolBarManager()
        self.active_tab = None
        self.old_active_tab = None

        self.set_spacing(6)

        self.ui_profile = migration_ui_style.UIProfile()

        self.left_side_cont = self.create_tasks_side()
        self.add(self.left_side_cont, False, False)
        self.tasks_side.add_section("Overview", "OVERVIEW", 0)
        self.tasks_side.add_section("SourceTarget", "SOURCE & TARGET", 0)
        self.tasks_side.add_section("ObjectMigration", "OBJECT MIGRATION", 0)
        self.tasks_side.add_section("DataMigration", "DATA MIGRATION", 0)
        self.tasks_side.add_section("Report", "REPORT", 0)

        self.tasks_side.add_on_section_command_callback(self.section_clicked)
        self.left_side_cont.set_size(220, -1)

        self.background = mforms.newPanel(mforms.StyledHeaderPanel)
        self.background.set_title("TITLE")

        self._page_trail = []
        self.tabs = []
        self._name2page = {}

        if platform.system() == "Windows":
            self.content_box = mforms.newBox(False)
            self.content_box.set_back_image("migration_background.png", mforms.TopRight)
            self.background.add(self.content_box)
            self.background.set_back_color("#ffffff")
        else:
            self.tabview = mforms.newTabView(True)
            self.background.add(self.tabview)
            self.background.set_back_image("migration_background.png", mforms.TopRight)

        self.add(self.background, True, True)

        self._advancing = True
        self.content = {}
        self.add_content()

        self._selecting_entry = False

        # Load current user numeric locale:
        locale.setlocale(locale.LC_NUMERIC, "")

        self.tasks_side.select_entry(self._overview_page.identifier())
        self.section_clicked(self._overview_page.identifier())
Ejemplo n.º 9
0
    def create_ui(self):
        self.tab = newTabView(False)

        self.status = VariablesViewer(self.ctrl_be, wb_admin_variable_list.status_variable_list, "SHOW GLOBAL STATUS", 'status')
        self.status.set_padding(6)

        self.server = VariablesViewer(self.ctrl_be, wb_admin_variable_list.system_variable_list, "SHOW GLOBAL VARIABLES", 'system')
        self.server.set_padding(6)

        self.tab.add_page(self.status, "Status Variables")
        self.tab.add_page(self.server, "System Variables")
        
        return self.tab
Ejemplo n.º 10
0
    def create_ui(self):
        self.warning = not_running_warning_label()
        self.add(self.warning, False, True)
        self.warning.show(False)

        self.tabView = newTabView(False)
        self.add(self.tabView, True, True)

        self.general_log_tab = None
        self.slow_log_tab = None
        self.general_file_log_tab = None
        self.slow_file_log_tab = None
        self.error_file_log_tab = None
Ejemplo n.º 11
0
    def create_ui(self):
        self.warning = not_running_warning_label()
        self.add(self.warning, False, True)
        self.warning.show(False)

        self.tabView = newTabView(False)
        self.add(self.tabView, True, True)

        self.general_log = GeneralLogView(self)
        self.tabView.add_page(self.general_log, "General")

        self.slow_log = SlowLogView(self)
        self.tabView.add_page(self.slow_log, "Slow Query Log")
Ejemplo n.º 12
0
    def create_ui(self):
        self.warning = not_running_warning_label()
        self.add(self.warning, False, True)
        self.warning.show(False)

        self.tabView = newTabView(False)
        self.add(self.tabView, True, True)

        self.general_log_tab = None
        self.slow_log_tab = None
        self.general_file_log_tab = None
        self.slow_file_log_tab = None
        self.error_file_log_tab = None
    def __init__(self, editor):
        mforms.AppView.__init__(self, False, "TableInspector", False)
        self.set_managed()
        self.set_release_on_add()

        self.tab = mforms.newTabView()
        self.add(self.tab, True, True)

        self.info = TableInfoPanel()
        self.tab.add_page(self.info, "Information")

        self.index_page = TableIndexInfoPanel(editor)
        self.tab.add_page(self.index_page, "Indexes")
Ejemplo n.º 14
0
    def create_ui(self):
        self.warning = not_running_warning_label()
        self.add(self.warning, False, True)
        self.warning.show(False)

        self.tabView = newTabView(False)
        self.add(self.tabView, True, True)

        self.general_log = GeneralLogView(self)
        self.tabView.add_page(self.general_log, "General")

        self.slow_log = SlowLogView(self)
        self.tabView.add_page(self.slow_log, "Slow Query Log")
Ejemplo n.º 15
0
    def create_ui(self):
        self.detect_paths()

        self.tabView = newTabView(False)

        self.general_log_tab = None
        self.slow_log_tab = None
        self.general_file_log_tab = None
        self.slow_file_log_tab = None
        self.error_file_log_tab = None
        
        self.update_ui()
        
        return self.tabView
Ejemplo n.º 16
0
    def create_ui(self):
        self.warning = not_running_warning_label()
        self.add(self.warning, False, True)

        self.tab = newTabView(False)
        self.add(self.tab, True, True)

        self.status = VariablesViewer(self.ctrl_be, wb_admin_variable_list.vars_list["status"], "SHOW GLOBAL STATUS")
        self.status.set_padding(6)
        self.tab.add_page(self.status, "Status Variables")

        self.server = VariablesViewer(self.ctrl_be, wb_admin_variable_list.vars_list["system"], "SHOW GLOBAL VARIABLES")
        self.server.set_padding(6)
        self.tab.add_page(self.server, "System Variables")
Ejemplo n.º 17
0
    def create_ui(self):
        self.warning = not_running_warning_label()
        self.add(self.warning, False, True)

        self.tab = newTabView(False)
        self.add(self.tab, True, True)

        self.status = VariablesViewer(self.ctrl_be, wb_admin_variable_list.vars_list['status'], "SHOW GLOBAL STATUS")
        self.status.set_padding(6)
        self.tab.add_page(self.status, "Status Variables")

        self.server = VariablesViewer(self.ctrl_be, wb_admin_variable_list.vars_list['system'], "SHOW GLOBAL VARIABLES")
        self.server.set_padding(6)
        self.tab.add_page(self.server, "System Variables")
Ejemplo n.º 18
0
    def create_ui(self):
        self.suspend_layout()

        self.warning = not_running_warning_label()
        self.add(self.warning, False, True)

        self.tabview = newTabView(False)
        self.add(self.tabview, True, True)

        self.account_tab = SecurityAccount(self)
        self.tabview.add_page(self.account_tab, "Server Access Management")

        self.schema_privs_tab = SecuritySchemaPrivileges(self)
        self.tabview.add_page(self.schema_privs_tab, "Schema Privileges")

        self.resume_layout()
Ejemplo n.º 19
0
    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")
Ejemplo n.º 20
0
    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")
Ejemplo n.º 21
0
    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 create_ui(self):
        self.set_padding(12)
        self.set_spacing(8)

        self.heading = make_panel_header("title_variables.png", self.server_profile.name, "Server Variables")
        self.add(self.heading, False, True)

        self.warning = not_running_warning_label()
        self.add(self.warning, False, True)

        self.tab = newTabView(False)
        self.add(self.tab, True, True)

        self.status = VariablesViewer(self.ctrl_be, wb_admin_variable_list.status_variable_list, "SHOW GLOBAL STATUS", 'status')
        self.status.set_padding(6)
        self.tab.add_page(self.status, "Status Variables")

        self.server = VariablesViewer(self.ctrl_be, wb_admin_variable_list.system_variable_list, "SHOW GLOBAL VARIABLES", 'system')
        self.server.set_padding(6)
        self.tab.add_page(self.server, "System Variables")
Ejemplo n.º 23
0
    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")
Ejemplo n.º 24
0
    def __init__(self):
        mforms.AppView.__init__(self, False, 'db_copy', True)

        self.background = None
        self.content = mforms.newBox(False)

        if platform.system() == 'Windows':
            self.set_back_color("#FFFFFF")
            content_panel = mforms.newPanel(mforms.FilledPanel)
            #self.content.set_back_image("migration_background.png", mforms.TopRight)
            content_panel.set_back_color("#FFFFFF")
        else:
            content_panel = mforms.newPanel(mforms.StyledHeaderPanel)
            content_panel.set_back_image("migration_background.png",
                                         mforms.TopRight)

        content_panel.set_padding(8)
        self.header = mforms.newLabel("")
        self.header.set_style(mforms.WizardHeadingStyle)
        self.content.add(self.header, False)

        # On Windows doesn't use TabView as it is not transparent
        if platform.system() != 'Windows':
            self.tabview = mforms.newTabView(mforms.TabViewTabless)
            self.content.add(self.tabview, True, True)

        content_panel.add(self.content)
        self.add(content_panel, True, True)

        self._ui_created = False

        self._page_list = []
        self._page_trail = []
        self._current_page = 0

        # Load current user numeric locale:
        locale.setlocale(locale.LC_NUMERIC, '')

        self.plan = migration.MigrationPlan()
        self.create_ui()
Ejemplo n.º 25
0
    def __init__(self, server_profile, ctrl_be, main_view, version="5.1"):
      mforms.Box.__init__(self, False)
      self.tab_view = newTabView()
      self.main_view = main_view

      self.myopts = None
      self.opt2ctrl_map = {}
      self.loading = True
      self.section = None
      self.ui_created = False

      self.set_managed()
      self.version = version
      self.ctrl_be = ctrl_be
      self.server_profile = server_profile
      self.cfg_be = None # Will be created later in self.create_ui
      self.version = version

      self.pack_to_top()
      container = self.main_view.add_content_page(self, "CONFIGURATION", "Options File", "admin_option_file_win", True)

      self.search_panel = self.create_search_panel()
      container.add_end(self.search_panel, False, False);
Ejemplo n.º 26
0
    def __init__(self, owner_form):
        mforms.Form.__init__(self, owner_form)

        self.pages = []

        self.content = mforms.newBox(False)
        self.content.set_spacing(12)

        hbox = mforms.newBox(True)
        self.header = mforms.newLabel("")
        self.header.set_style(mforms.WizardHeadingStyle)
        hbox.add(self.header, True, True)
        hbox.set_padding(24)

        self.content.add(hbox, False, True)
        self.tabview = mforms.newTabView(mforms.TabViewTabless)
        self.content.add(self.tabview, True, True)

        self.set_content(self.content)
        self.set_size(800, 600)
        self.center()

        self.set_on_close(self.on_close)
Ejemplo n.º 27
0
    def __init__(self, owner_form):
        mforms.Form.__init__(self, owner_form)

        self.pages = []

        self.content = mforms.newBox(False)
        self.content.set_spacing(12)

        hbox = mforms.newBox(True)
        self.header = mforms.newLabel("")
        self.header.set_style(mforms.WizardHeadingStyle)
        hbox.add(self.header, True, True)
        hbox.set_padding(24)

        self.content.add(hbox, False, True)
        self.tabview = mforms.newTabView(mforms.TabViewTabless)
        self.content.add(self.tabview, True, True)

        self.set_content(self.content)
        self.set_size(800, 600)
        self.center()
        
        self.set_on_close(self.on_close)
Ejemplo n.º 28
0
  def changedModel(self):
    if self.currentModel != None:
      self.currentModel.destroy();
    if self.tabView!=None:
      self.fieldContainer.remove(self.tabView)
      
    self.tabView=mforms.newTabView()
    
    curField = self.lbox.get_string_value() 
    i=0;    
    for curTable in self.schema.tables:      
      i=i+1      
      if curTable.name == curField:        
        self.fieldContainer.show(False)
        #Panel de modelo
        panel = mforms.newScrollPanel(mforms.ScrollPanelNoFlags)
        generalView=mforms.newBox(True)
        panel.add(generalView)
        self.currentModel=ModelForm(generalView,curTable.name,curTable);
        self.tabView.add_page(panel,'General')
        #Panel de campos
        panel = mforms.newScrollPanel(mforms.ScrollPanelNoFlags)
        fieldView=mforms.newBox(False)
        panel.add(fieldView)        
        self.fieldView=FieldForm(fieldView,curTable.name,curTable);
        self.tabView.add_page(panel,'Campos')
        #Panel de queries
        panel = mforms.newScrollPanel(mforms.ScrollPanelNoFlags)
        queryView=mforms.newBox(False)
        panel.add(queryView)
        self.queryView=QueryForm(queryView,curTable.name,curTable);
        self.tabView.add_page(panel,'Queries')

        
        self.fieldContainer.show()
    self.tabView.set_active_tab(0)
    self.fieldContainer.add(self.tabView,True,True)    
    def __init__(self, editor, schema_name):
        mforms.AppView.__init__(self, False, "schema_inspector", False)

        self.editor = editor

        self.tabview = mforms.newTabView()
        self.add(self.tabview, True, True)

        self.pages = []

        tabs = [TableManagerParent, ColumnManager, IndexManager, TriggerManager, ViewManager, ProcedureManager, FunctionManager]
        if self.editor.serverVersion.majorNumber > 5 or (self.editor.serverVersion.majorNumber == 5 and self.editor.serverVersion.minorNumber >= 1):
            tabs.append(EventManager)
        # tabs.append(AccessManager)
        for Tab in tabs:
            if Tab is IndexManager:
                tab = Tab(editor, schema_name, self)
            else:
                tab = Tab(editor, schema_name)
            setattr(self, "tab_"+tab.node_name, tab)
            self.pages.append(tab)
            self.tabview.add_page(tab, tab.caption)

        self.refresh()
Ejemplo n.º 30
0
file_chooser.set_title('Choose the base directory')
file_chooser.set_path(script_dir)
file_chooser_result = file_chooser.run_modal()
print "File chooser result: %s" % file_chooser_result
if not file_chooser_result:
    sys.exit()

temp_path = file_chooser.get_path()
sys.path.append(temp_path)

import variable_groups
import status_groups
import raw_opts
import raw_vars

tabs = newTabView(mforms.TabViewSystemStandard)

system_variables = VariablesGrouper(
    variable_groups.variable_groups, raw_opts.ropts,
    os.path.join(temp_path, "variable_groups.py"))
status_variables = VariablesGrouper(
    status_groups.variable_groups, raw_vars.status_vars_list,
    os.path.join(temp_path, "status_groups.py"))

tabs.add_page(system_variables, "Syatem Variables")
tabs.add_page(status_variables, "Status Variables")

form.set_content(tabs)

form.run_modal(None, None)
Ejemplo n.º 31
0
    def __init__(self, owner, context):
        mforms.Box.__init__(self, False)
        self._owner = owner
        self._context = context
        self._profile = None
        self._days   = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
        self._months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
        self._freqs =  ["Hour", "Day", "Week", "Month"]
        self._monthdays = []
        
        self.profile_saved_callback = None
        self.profile_delete_callback = None
        self.label_validation = None

        for index in range(31):
            suffix = "th"
            day = index+1
            if day in [1,21,31]:
                suffix = "st"
            elif day in [2,22]:
                suffix = "nd"
            elif day in [3,23]:
                suffix = "rd"
          
            self._monthdays.append(str(day) + suffix)
            

        table = mforms.newTable()
        table.set_padding(12)
        table.set_row_count(1)
        table.set_column_count(2)
        table.set_row_spacing(6)
        table.set_column_spacing(4)

        add_table_field_label(table, 0, "Profile Name:")
        self._name = newTextEntry()
        self._name.add_changed_callback(self.name_edited)
        self._name.set_size(200, -1)
        self._backup_type = newLabel("", True)
        hbox = newBox(True)
        hbox.set_spacing(12)
        hbox.set_padding(12)
        hbox.add(self._name, False, True)
        hbox.add(self._backup_type, False, True)
        table.add(hbox, 1, 2, 0, 1, mforms.HFillFlag)

        self.add(table, True, True)

        # Creates the configuration tabs
        self._configuration = newTabView(False)
        self.add(self._configuration, True, True)
        
        # enable back when supported self.create_contents_tab()
        self.create_destination_tab()
        self.create_schedule_tab()
        self.create_comments_tab()

        # Creates the buttons line at the bottom of the screen
        hbox = newBox(True)
        hbox.set_spacing(12)
        hbox.set_padding(12)
        self.add(hbox, False, True)

        self._cancel_button = mforms.newButton()
        self._cancel_button.set_text("Cancel")
        self._cancel_button.add_clicked_callback(self.cancel_changes)
        hbox.add_end(self._cancel_button, False, True)

        self._ok_button = mforms.newButton()
        self._ok_button.set_text("Save and Reschedule")
        self._ok_button.add_clicked_callback(self.save_changes)
        hbox.add_end(self._ok_button, False, True)

        self._del_job_button = mforms.newButton()
        self._del_job_button.set_text("Delete")
        self._del_job_button.add_clicked_callback(self.delete_clicked)
        hbox.add_end(self._del_job_button, False, True)
Ejemplo n.º 32
0
    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()
Ejemplo n.º 33
0
    def __init__(self, owner):
        mforms.Box.__init__(self, False)
        self.set_managed()
        self.owner = owner

        self._selected_user = None
        self._selected_user_original = None
        self.valid = False

        self.suspend_layout()
        self.set_padding(8)
        self.set_spacing(8)

        top_box = newBox(True)
        top_box.set_spacing(8)
        self.add(top_box, True, True)

        bottom_box = newBox(True)
        bottom_box.set_spacing(8)

        self.add_button = newButton()
        self.add_button.set_text("Add Account")
        bottom_box.add(self.add_button, False, True)
        self.add_button.add_clicked_callback(self.add_account)

        self.dup_button = newButton()
        self.dup_button.set_text("Duplicate")
        #bottom_box.add(self.dup_button, False, True)
        self.dup_button.add_clicked_callback(self.dup_account)

        self.del_button = newButton()
        self.del_button.set_text("Remove")
        bottom_box.add(self.del_button, False, True)
        self.del_button.add_clicked_callback(self.del_account)

        self.refresh_button = newButton()
        self.refresh_button.set_text("Refresh")
        self.refresh_button.add_clicked_callback(self.owner.refresh)
        bottom_box.add_end(self.refresh_button, False, True)

        self.save_button = newButton()
        self.save_button.set_text("Apply")
        bottom_box.add_end(self.save_button, False, True)
        self.save_button.add_clicked_callback(self.commit)

        self.revert_button = newButton()
        self.revert_button.set_text("Revert")
        bottom_box.add_end(self.revert_button, False, True)
        self.revert_button.add_clicked_callback(self.revert)

        self.revoke_all_button = newButton()
        self.revoke_all_button.set_text("Revoke All Privileges")
        bottom_box.add_end(self.revoke_all_button, False, True)
        self.revoke_all_button.add_clicked_callback(self.revoke_all)
        self.revoke_all_button.set_tooltip(
            "Immediately remove all privileges from the account, from every object at all levels.\nThe account itself will be left untouched and logins will still be possible."
        )

        self.add(bottom_box, False, True)

        account_list_box = newBox(False)
        account_list_box.set_spacing(8)
        account_list_box.set_size(220, -1)
        top_box.add(account_list_box, False, True)

        label = newLabel("User Accounts")
        account_list_box.add(label, False, True)

        #searchbox = TextEntry(SearchEntry)
        #account_list_box.add(searchbox, False, True)

        self.user_list = newTreeView(mforms.TreeDefault)
        self.user_list.add_column(mforms.StringColumnType, "User", 80, False)
        self.user_list.add_column(mforms.StringColumnType, "From Host", 120,
                                  False)
        self.user_list.end_columns()
        self.user_list.add_changed_callback(self.user_selected)
        self.user_list.set_allow_sorting(True)
        account_list_box.add(self.user_list, True, True)

        self.content_box = abox = newBox(False)
        abox.set_spacing(8)
        top_box.add(abox, True, True)

        self.account_label = newLabel(
            "Select an account to edit or click Add Account to create a new one"
        )
        self.account_label.set_style(mforms.BoldStyle)

        abox.add(self.account_label, False, True)

        tabView = newTabView(False)
        abox.add(tabView, True, True)

        ##
        vbox = newBox(False)
        vbox.set_spacing(12)
        vbox.set_padding(12)
        tabView.add_page(vbox, "Login")

        table = newTable()
        vbox.add(table, False, True)

        table.set_row_count(7)
        table.set_column_count(3)
        table.set_row_spacing(8)
        table.set_column_spacing(8)

        self.username = newTextEntry()
        self.username.set_size(150, -1)
        self.username.add_changed_callback(self.set_dirty)
        self.username.set_max_length(16)  # max username length for mysql
        self.password = newTextEntry(mforms.PasswordEntry)
        self.password.set_size(150, -1)
        self.password.add_changed_callback(self.set_dirty)
        self.confirm = newTextEntry(mforms.PasswordEntry)
        self.confirm.set_size(150, -1)
        self.confirm.add_changed_callback(self.set_dirty)

        self.hostlimithost = newTextEntry()
        self.hostlimithost.add_changed_callback(self.validate_hostlimithost)

        table.add(rLabel("Login Name:"), 0, 1, 0, 1, mforms.HFillFlag)
        table.add(self.username, 1, 2, 0, 1, mforms.HFillFlag)
        table.add(
            dLabel(
                "You may create multiple accounts with the same name\nto connect from different hosts."
            ), 2, 3, 0, 1, mforms.HFillFlag | mforms.HExpandFlag)

        self.has_extra_plugins = len([
            p for p in self.active_plugins
            if p not in ("mysql_native_password", "mysql_old_password")
        ]) > 0

        if self.has_extra_plugins:
            self.auth_type_label = rLabel("Authentication Type:")
            table.add(self.auth_type_label, 0, 1, 1, 2, mforms.HFillFlag)
            self.auth_type_sel = newSelector()
            table.add(self.auth_type_sel, 1, 2, 1, 2,
                      mforms.HFillFlag | mforms.HExpandFlag)
            table.add(
                dLabel(
                    "\nFor the standard password and/or host based authentication,\nselect 'Standard'.\n"
                ), 2, 3, 1, 2, mforms.HFillFlag)
            self.auth_type_sel.add_changed_callback(self.auth_type_changed)
            self.auth_type_list = []
            for plugin in [None] + self.active_plugins:
                if plugin in ("mysql_native_password", "mysql_old_password"):
                    continue
                if AUTHENTICATION_PLUGIN_TYPES.has_key(plugin):
                    self.auth_type_sel.add_item(
                        AUTHENTICATION_PLUGIN_TYPES[plugin]["name"])
                else:
                    self.auth_type_sel.add_item(plugin)
                self.auth_type_list.append(plugin)
        else:
            self.auth_type_list = None
            self.auth_string_param = None

        self.auth_type_password_labels = []

        def add(label, l=self.auth_type_password_labels):
            l.append(label)
            return label

        table.add(add(rLabel("Limit Connectivity to Hosts Matching:")), 0, 1,
                  2, 3, mforms.HFillFlag)
        table.add(self.hostlimithost, 1, 2, 2, 3, mforms.HFillFlag)
        self.hostlimit_box = newBox(True)
        self.hostlimithost_valid_icon = newImageBox()
        self.hostlimit_box.add(self.hostlimithost_valid_icon, False, False)
        self.hostlimit_box.add(add(dLabel("% and _ wildcards may be used")),
                               True, True)
        table.add(self.hostlimit_box, 2, 3, 2, 3,
                  mforms.HFillFlag | mforms.HExpandFlag)

        table.add(add(rLabel("Password:"******"Type a password to reset it.")), 2, 3, 3, 4,
                  mforms.HFillFlag | mforms.HExpandFlag)
        table.add(add(rLabel("Confirm Password:"******"Enter password again to confirm.")), 2, 3, 4, 5,
                  mforms.HFillFlag | mforms.HExpandFlag)

        table.add(newLabel(""), 1, 2, 5, 6, mforms.HFillFlag)

        if self.has_extra_plugins:
            self.auth_string_param = newTextEntry()
            self.auth_string_param.add_changed_callback(self.set_dirty)
            self.auth_string_label = rLabel("Authentication String:")
            table.add(self.auth_string_label, 0, 1, 6, 7, mforms.HFillFlag)
            table.add(self.auth_string_param, 1, 2, 6, 7,
                      mforms.HFillFlag | mforms.HExpandFlag)
            table.add(dLabel("Authentication plugin specific parameters."), 2,
                      3, 6, 7, mforms.HFillFlag)
            self.auth_string_help = newLabel("")
            vbox.add(self.auth_string_help, False, True)

        ####

        box = newBox(False)
        tabView.add_page(box, "Administrative Roles")

        lbox = newBox(True)
        box.add(lbox, True, True)
        lbox.set_spacing(12)
        lbox.set_padding(12)

        self.role_list = newTreeView(mforms.TreeDefault)
        self.role_list.add_column(mforms.CheckColumnType, "", 30, True)
        self.role_list.add_column(mforms.StringColumnType, "Role", 150, False)
        self.role_list.add_column(mforms.StringColumnType, "Description", 300,
                                  False)
        self.role_list.end_columns()
        lbox.add(self.role_list, True, True)
        self.role_list.set_cell_edited_callback(self.role_list_toggled)

        self.role_priv_list = newTreeView(mforms.TreeDefault)
        self.role_priv_list.add_column(mforms.StringColumnType,
                                       "Global Privileges Assigned to User",
                                       200, False)
        self.role_priv_list.end_columns()
        self.role_priv_list.set_size(220, -1)
        self.role_priv_list.set_allow_sorting(True)
        lbox.add(self.role_priv_list, False, True)

        self.role_list.clear_rows()
        for name, desc, privs in SecurityAdminRoles:
            row = self.role_list.add_row()
            self.role_list.set_bool(row, 0, False)
            self.role_list.set_string(row, 1, name)
            self.role_list.set_string(row, 2, desc)

        ###
        table = newTable()
        tabView.add_page(table, "Account Limits")

        table.set_padding(12)
        table.set_column_spacing(8)
        table.set_row_spacing(8)
        table.set_row_count(4)
        table.set_column_count(3)

        table.add(rLabel("Max. Queries:"), 0, 1, 0, 1, 0)
        self.max_questions = newTextEntry()
        self.max_questions.set_size(60, -1)
        self.max_questions.add_changed_callback(self.set_dirty)
        table.add(self.max_questions, 1, 2, 0, 1, mforms.HFillFlag)
        table.add(
            dLabel(
                "Number of queries the account can execute within one hour."),
            2, 3, 0, 1, mforms.HFillFlag | mforms.HExpandFlag)

        table.add(rLabel("Max. Updates:"), 0, 1, 1, 2, 0)
        self.max_updates = newTextEntry()
        self.max_updates.set_size(60, -1)
        self.max_updates.add_changed_callback(self.set_dirty)
        table.add(self.max_updates, 1, 2, 1, 2, mforms.HFillFlag)
        table.add(
            dLabel(
                "Number of updates the account can execute within one hour."),
            2, 3, 1, 2, mforms.HFillFlag | mforms.HExpandFlag)

        table.add(rLabel("Max. Connections:"), 0, 1, 2, 3, 0)
        self.max_connections = newTextEntry()
        self.max_connections.set_size(60, -1)
        self.max_connections.add_changed_callback(self.set_dirty)
        table.add(self.max_connections, 1, 2, 2, 3, mforms.HFillFlag)
        table.add(
            dLabel(
                "The number of times the account can connect to the server per hour."
            ), 2, 3, 2, 3, mforms.HFillFlag | mforms.HExpandFlag)

        table.add(rLabel("Concurrent Connections:"), 0, 1, 3, 4, 0)
        self.max_uconnections = newTextEntry()
        self.max_uconnections.set_size(60, -1)
        self.max_uconnections.add_changed_callback(self.set_dirty)
        table.add(self.max_uconnections, 1, 2, 3, 4, mforms.HFillFlag)
        table.add(
            dLabel(
                "The number of simultaneous connections to the server the account can have."
            ), 2, 3, 3, 4, mforms.HFillFlag | mforms.HExpandFlag)

        self.resume_layout()

        self.user_selected()
Ejemplo n.º 34
0
    def __init__(self, server_version, query, json_text, explain):
        mforms.AppView.__init__(self, False, "Query Explain", "Query Explain",
                                False)
        self.set_managed()
        self.set_release_on_add()

        self.on_close(self.on_tab_close)

        self._form_deactivated_conn = mforms.Form.main_form(
        ).add_deactivated_callback(self.form_deactivated)

        if not json_text and not explain:
            label = mforms.newLabel("Explain data not available for statement")
            label.set_style(mforms.BigBoldStyle)
            label.set_text_align(mforms.MiddleCenter)
            self.add(label, True, True)
            return

        self._query = query
        self.tabview = mforms.newTabView(mforms.TabViewTabless)
        self.tabview.add_tab_changed_callback(self.tab_changed)
        self.set_back_color("#ffffff")

        default_tab = grt.root.wb.state.get(
            "wb.query.analysis:ActiveExplainTab", 0)
        json_data = None
        if json_text:
            try:
                json_data = decode_json(json_text)
            except Exception as e:
                import traceback
                log_error("Error creating query plan: %s\n" %
                          traceback.format_exc())
                mforms.Utilities.show_error(
                    "Query Plan Generation Error",
                    "An unexpected error occurred parsing JSON query explain data.\nPlease file a bug report at http://bugs.mysql.com along with the query and the Raw Explain Data.\n\nException: %s"
                    % e, "OK", "", "")
        if json_data:
            try:
                self._explain_context = ExplainContext(json_data,
                                                       server_version)

                self._query_plan = QueryPlanTab(self, json_text,
                                                self._explain_context,
                                                server_version)
                self._explain_context.init_canvas(
                    self._query_plan.drawbox, self._query_plan.scroll,
                    self._query_plan.set_needs_repaint)
                #self._explain_context._canvas.set_background_color(1, 0xfc/255.0, 0xe5/255.0)
                # Initial layouting of the plan diagram
                self._query_plan.drawbox.relayout()
                self.tabview.add_page(self._query_plan, "Visual Explain")

                self._query_plan.switcher_item.set_name(
                    "Visual Explain Switcher")
                self._query_plan.switcher_item.setInternalName(
                    "visual_explain_switcher")
                self._query_plan.switcher_item.set_selector_items(
                    ["Visual Explain", "Tabular Explain"])
                self._query_plan.switcher_item.add_activated_callback(
                    self.switch_view)
            except Exception as e:
                import traceback
                log_error("Error creating query plan: %s\n" %
                          traceback.format_exc())
                mforms.Utilities.show_error(
                    "Query Plan Generation Error",
                    "An unexpected error occurred during creation of the graphical query plan.\nPlease file a bug report at http://bugs.mysql.com along with the query and the Raw Explain Data.\n\nException: %s"
                    % e, "OK", "", "")
        else:
            log_error("No JSON data for explain\n")

        # Good old explain
        if explain:
            self._tabular_explain = TabularExplainTab(self, explain,
                                                      server_version)
            self.tabview.add_page(self._tabular_explain, "Tabular Explain")

            self._tabular_explain.switcher_item.set_name(
                "Tabular Explain Switcher")
            self._tabular_explain.switcher_item.setInternalName(
                "tabular_explain_switcher")
            self._tabular_explain.switcher_item.set_selector_items(
                ["Visual Explain", "Tabular Explain"])
            self._tabular_explain.switcher_item.set_text("Tabular Explain")
            self._tabular_explain.switcher_item.add_activated_callback(
                self.switch_view)

        self.add(self.tabview, True, True)

        if self._explain_context:
            self.tabview.set_active_tab(default_tab)
form.set_size(800,600)

file_chooser = mforms.newFileChooser(form, mforms.OpenDirectory)

file_chooser.set_title('Choose the base directory')
file_chooser.set_path(script_dir)
file_chooser_result = file_chooser.run_modal()
print "File chooser result: %s" % file_chooser_result
if not file_chooser_result:
    sys.exit()

temp_path = file_chooser.get_path()
sys.path.append(temp_path)

import variable_groups
import status_groups
import raw_opts
import raw_vars

tabs = newTabView(mforms.TabViewSystemStandard)

system_variables = VariablesGrouper(variable_groups.variable_groups, raw_opts.ropts, os.path.join(temp_path, "variable_groups.py"))
status_variables = VariablesGrouper(status_groups.variable_groups, raw_vars.status_vars_list, os.path.join(temp_path, "status_groups.py"))

tabs.add_page(system_variables, "Syatem Variables")
tabs.add_page(status_variables, "Status Variables")

form.set_content(tabs)

form.run_modal(None, None)
    def create_ui(self):
        dprint_ex(4, "Enter")
        self.suspend_layout()

        self.create_basic_ui("title_connections.png", "Client Connections")

        if self.new_processlist():
            widths = grt.root.wb.state.get("wb.admin:ConnectionListColumnWidthsPS", None)
        else:
            widths = grt.root.wb.state.get("wb.admin:ConnectionListColumnWidths", None)
        if widths:
            column_widths = [int(i) for i in widths.split(",")]
        else:
            column_widths = None

        self.connection_box = mforms.newBox(True)
        self.connection_box.set_spacing(8)
        self.connection_list = newTreeNodeView(mforms.TreeDefault|mforms.TreeFlatList|mforms.TreeAltRowColors)
        self.connection_list.set_selection_mode(mforms.TreeSelectMultiple)
        self.connection_list.add_column_resized_callback(self.column_resized)
        for i, (field, type, caption, width) in enumerate(self.columns):
            if column_widths and i < len(column_widths):
                width = column_widths[i]
            self.connection_list.add_column(type, caption, width, False)

        self.connection_list.end_columns()
        self.connection_list.set_allow_sorting(True)
        
        self.connection_list.add_changed_callback(weakcb(self, "connection_selected"))

        self.connection_box.add(self.connection_list, True, True)

        info_table = mforms.newTable()
        info_table.set_row_count(2)
        info_table.set_column_count(5)
        info_table.set_row_spacing(4)
        info_table.set_column_spacing(20)

        info_table.add(self.create_labeled_info("Threads Connected:", "lbl_Threads_connected"),                     0, 1, 0, 1, mforms.HFillFlag)
        info_table.add(self.create_labeled_info("Threads Running:", "lbl_Threads_running"),                          1, 2, 0, 1, mforms.HFillFlag)
        info_table.add(self.create_labeled_info("Threads Created:", "lbl_Threads_created"),                         2, 3, 0, 1, mforms.HFillFlag)
        info_table.add(self.create_labeled_info("Threads Cached:", "lbl_Threads_cached"),                           3, 4, 0, 1, mforms.HFillFlag)
        info_table.add(self.create_labeled_info("Rejected (over limit):", "lbl_Connection_errors_max_connections"), 4, 5, 0, 1, mforms.HFillFlag)

        info_table.add(self.create_labeled_info("Total Connections:", "lbl_Connections"),                           0, 1, 1, 2, mforms.HFillFlag)
        info_table.add(self.create_labeled_info("Connection Limit:", "lbl_max_connections"),                        1, 2, 1, 2, mforms.HFillFlag)
        info_table.add(self.create_labeled_info("Aborted Clients:", "lbl_Aborted_clients"),                         2, 3, 1, 2, mforms.HFillFlag)
        info_table.add(self.create_labeled_info("Aborted Connections:", "lbl_Aborted_connects"),                    3, 4, 1, 2, mforms.HFillFlag)
        info_table.add(self.create_labeled_info("Errors:", "lbl_errors", "tooltip_errors"),                         4, 5, 1, 2, mforms.HFillFlag)

        self.info_table = info_table
        self.add(info_table, False, True)

        #self.set_padding(8)
        self.add(self.connection_box, True, True)


        box = newBox(True)
        self.button_box = box
        self.add_end(box, False, True)

        box.set_spacing(12)
        
        refresh_button = newButton()
        refresh_button.set_text("Refresh")
        box.add_end(refresh_button, False, True)
        refresh_button.add_clicked_callback(weakcb(self, "refresh"))

        self.kill_button = newButton()
        self.kill_button.set_text("Kill Connection(s)")
        box.add_end(self.kill_button, False, True)
        self.kill_button.add_clicked_callback(weakcb(self, "kill_connection"))
        
        self.killq_button = newButton()
        self.killq_button.set_text("Kill Query(s)")
        box.add_end(self.killq_button, False, True)
        self.killq_button.add_clicked_callback(weakcb(self, "kill_query"))
        
        refresh_label = newLabel("Refresh Rate:")
        box.add(refresh_label, False, True)

        self._menu = mforms.newContextMenu()
        self._menu.add_will_show_callback(self.menu_will_show)
        self.connection_list.set_context_menu(self._menu)

        
        self.refresh_values = [0.5, 1, 2, 3, 4, 5, 10, 15, 30]
        self.refresh_values_size = len(self.refresh_values)
        
        self.refresh_selector = newSelector()
        self.refresh_selector.set_size(100,-1)
        
        for s in self.refresh_values:
            self.refresh_selector.add_item(str(s) + " seconds")
        
        self.refresh_selector.add_item("Don't Refresh")
        
        refresh_rate_index = grt.root.wb.options.options.get('Administrator:refresh_connections_rate_index', 9)
        self.refresh_selector.set_selected(refresh_rate_index)
        self.update_refresh_rate()
        self.refresh_selector.add_changed_callback(weakcb(self, "update_refresh_rate"))
        box.add(self.refresh_selector, False, True)

        self.check_box = newBox(True)
        self.check_box.set_spacing(12)

        self.hide_sleep_connections = newCheckBox()
        self.hide_sleep_connections.set_text('Hide sleeping connections')
        self.hide_sleep_connections.add_clicked_callback(self.refresh)
        self.hide_sleep_connections.set_tooltip('Remove connections in the Sleeping state from the connection list.')
        self.check_box.add(self.hide_sleep_connections, False, True)

        self.mdl_locks_page = None
        self._showing_extras = False
        if self.new_processlist():
            self.hide_background_threads = newCheckBox()
            self.hide_background_threads.set_active(True)
            self.hide_background_threads.set_text('Hide background threads')
            self.hide_background_threads.set_tooltip('Remove background threads (internal server threads) from the connection list.')
            self.hide_background_threads.add_clicked_callback(self.refresh)
            self.check_box.add(self.hide_background_threads, False, True)
            
            self.truncate_info = newCheckBox()
            self.truncate_info.set_active(True)
            self.truncate_info.set_text('Don\'t load full thread info')
            self.truncate_info.set_tooltip('Toggle whether to load the entire query information for all connections or just the first 255 characters.\nEnabling this can have a large impact in busy servers or server executing large INSERTs.')
            self.truncate_info.add_clicked_callback(self.refresh)
            self.check_box.add(self.truncate_info, False, True)

            # tab with some extra info, only available if PS exists
            self.extra_info_tab = mforms.newTabView(mforms.TabViewSystemStandard)
            self.extra_info_tab.set_size(350, -1)
            self.extra_info_tab.add_tab_changed_callback(self.extra_tab_changed)

            self.connection_details_scrollarea = mforms.newScrollPanel()
            self.connection_details = ConnectionDetailsPanel(self)
            self.connection_details_scrollarea.add(self.connection_details)
            self.details_page = self.extra_info_tab.add_page(self.connection_details_scrollarea, "Details")

            self.mdl_list_box = None
            if self.ctrl_be.target_version.is_supported_mysql_version_at_least(5, 7, 3):
                self.mdl_list_box_scrollarea = mforms.newScrollPanel()
                self.mdl_list_box = mforms.newBox(False)
                self.mdl_list_box_scrollarea.add(self.mdl_list_box)

                self.mdl_label = mforms.newLabel('Metadata locks (MDL) protect concurrent access to\nobject metadata (not table row/data locks)')
                self.mdl_list_box.add(self.mdl_label, False, True)

                label = mforms.newLabel("\nGranted Locks (and threads waiting on them)")
                label.set_style(mforms.BoldStyle)
                self.mdl_list_box.add(label, False, True)
                label = mforms.newLabel("Locks this connection currently owns and\nconnections that are waiting for them.")
                label.set_style(mforms.SmallHelpTextStyle)
                self.mdl_list_box.add(label, False, True)

                self.mdl_list_held = mforms.newTreeNodeView(mforms.TreeAltRowColors)
                self.mdl_list_held.add_column(mforms.IconStringColumnType, "Object", 130, False)
                self.mdl_list_held.add_column(mforms.StringColumnType, "Type", 100, False)
                self.mdl_list_held.add_column(mforms.StringColumnType, "Duration", 100, False)
                self.mdl_list_held.end_columns()
                self.mdl_list_held.set_size(0, 100)
                self.mdl_list_box.add(self.mdl_list_held, True, True)

                label = mforms.newLabel("\nPending Locks")
                label.set_style(mforms.BoldStyle)
                self.mdl_list_box.add(label, False, True)
                hbox = mforms.newBox(True)
                hbox.set_spacing(4)
                self.mdl_blocked_icon = mforms.newImageBox()
                self.mdl_blocked_icon.set_image(mforms.App.get().get_resource_path("message_warning.png"))
                hbox.add(self.mdl_blocked_icon, False, True)
                self.mdl_waiting_label = mforms.newLabel("Locks this connection is currently waiting for.")
                hbox.add(self.mdl_waiting_label, True, True)
                self.mdl_list_box.add(hbox, False, True)
                self.mdl_locks_page = self.extra_info_tab.add_page(self.mdl_list_box_scrollarea, "Locks")

            if self.ctrl_be.target_version.is_supported_mysql_version_at_least(5, 6, 0):
                self.attributes_list = mforms.newTreeNodeView(mforms.TreeFlatList|mforms.TreeAltRowColors)
                self.attributes_list.add_column(mforms.StringColumnType, "Attribute", 150, False)
                self.attributes_list.add_column(mforms.StringColumnType, "Value", 200, False)
                self.attributes_list.end_columns()
                self.attributes_page = self.extra_info_tab.add_page(self.attributes_list, "Attributes")

            self.connection_box.add(self.extra_info_tab, False, True)
            self.extra_info_tab.show(False)

            self.show_extras = newButton()
            self.show_extras.set_text('Show Details')
            self.show_extras.add_clicked_callback(self.toggle_extras)
            self.check_box.add_end(self.show_extras, False, True)

        self.add(self.check_box, False, True)
        
        self.resume_layout()
        
        self.connection_selected()
        
        dprint_ex(4, "Leave")
Ejemplo n.º 37
0
    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()
Ejemplo n.º 38
0
    def create_ui(self):
        dprint_ex(4, "Enter")
        self.suspend_layout()

        self.create_basic_ui("title_connections.png", "Client Connections")

        if self.new_processlist():
            widths = grt.root.wb.state.get("wb.admin:ConnectionListColumnWidthsPS", None)
        else:
            widths = grt.root.wb.state.get("wb.admin:ConnectionListColumnWidths", None)
        if widths:
            column_widths = [int(i) for i in widths.split(",")]
        else:
            column_widths = None

        self.connection_box = mforms.newBox(True)
        self.connection_box.set_spacing(8)
        self.connection_list = newTreeNodeView(mforms.TreeDefault|mforms.TreeFlatList|mforms.TreeAltRowColors)
        self.connection_list.set_selection_mode(mforms.TreeSelectMultiple)
        self.connection_list.add_column_resized_callback(self.column_resized)
        for i, (field, type, caption, width) in enumerate(self.columns):
            if column_widths and i < len(column_widths):
                width = column_widths[i]
            self.connection_list.add_column(type, caption, width, False)

        self.connection_list.end_columns()
        self.connection_list.set_allow_sorting(True)
        
        self.connection_list.add_changed_callback(weakcb(self, "connection_selected"))

        self.connection_box.add(self.connection_list, True, True)

        info_table = mforms.newTable()
        info_table.set_row_count(2)
        info_table.set_column_count(5)
        info_table.set_row_spacing(4)
        info_table.set_column_spacing(20)

        info_table.add(self.create_labeled_info("Threads Connected:", "lbl_Threads_connected"),                     0, 1, 0, 1, mforms.HFillFlag)
        info_table.add(self.create_labeled_info("Threads Running:", "lbl_Threads_running"),                          1, 2, 0, 1, mforms.HFillFlag)
        info_table.add(self.create_labeled_info("Threads Created:", "lbl_Threads_created"),                         2, 3, 0, 1, mforms.HFillFlag)
        info_table.add(self.create_labeled_info("Threads Cached:", "lbl_Threads_cached"),                           3, 4, 0, 1, mforms.HFillFlag)
        info_table.add(self.create_labeled_info("Rejected (over limit):", "lbl_Connection_errors_max_connections"), 4, 5, 0, 1, mforms.HFillFlag)

        info_table.add(self.create_labeled_info("Total Connections:", "lbl_Connections"),                           0, 1, 1, 2, mforms.HFillFlag)
        info_table.add(self.create_labeled_info("Connection Limit:", "lbl_max_connections"),                        1, 2, 1, 2, mforms.HFillFlag)
        info_table.add(self.create_labeled_info("Aborted Clients:", "lbl_Aborted_clients"),                         2, 3, 1, 2, mforms.HFillFlag)
        info_table.add(self.create_labeled_info("Aborted Connections:", "lbl_Aborted_connects"),                    3, 4, 1, 2, mforms.HFillFlag)
        info_table.add(self.create_labeled_info("Errors:", "lbl_errors", "tooltip_errors"),                         4, 5, 1, 2, mforms.HFillFlag)

        self.info_table = info_table
        self.add(info_table, False, True)

        #self.set_padding(8)
        self.add(self.connection_box, True, True)


        box = newBox(True)
        self.button_box = box
        self.add_end(box, False, True)

        box.set_spacing(12)
        
        refresh_button = newButton()
        refresh_button.set_text("Refresh")
        box.add_end(refresh_button, False, True)
        refresh_button.add_clicked_callback(weakcb(self, "refresh"))

        self.kill_button = newButton()
        self.kill_button.set_text("Kill Connection(s)")
        box.add_end(self.kill_button, False, True)
        self.kill_button.add_clicked_callback(weakcb(self, "kill_connection"))
        
        self.killq_button = newButton()
        self.killq_button.set_text("Kill Query(s)")
        box.add_end(self.killq_button, False, True)
        self.killq_button.add_clicked_callback(weakcb(self, "kill_query"))
        
        refresh_label = newLabel("Refresh Rate:")
        box.add(refresh_label, False, True)

        self._menu = mforms.newContextMenu()
        self._menu.add_will_show_callback(self.menu_will_show)
        self.connection_list.set_context_menu(self._menu)

        
        self.refresh_values = [0.5, 1, 2, 3, 4, 5, 10, 15, 30]
        self.refresh_values_size = len(self.refresh_values)
        
        self.refresh_selector = newSelector()
        self.refresh_selector.set_size(100,-1)
        
        for s in self.refresh_values:
            self.refresh_selector.add_item(str(s) + " seconds")
        
        self.refresh_selector.add_item("Don't Refresh")
        
        refresh_rate_index = grt.root.wb.options.options.get('Administrator:refresh_connections_rate_index', 9)
        self.refresh_selector.set_selected(refresh_rate_index)
        self.update_refresh_rate()
        self.refresh_selector.add_changed_callback(weakcb(self, "update_refresh_rate"))
        box.add(self.refresh_selector, False, True)

        self.check_box = newBox(True)
        self.check_box.set_spacing(12)

        self.hide_sleep_connections = newCheckBox()
        self.hide_sleep_connections.set_text('Hide sleeping connections')
        self.hide_sleep_connections.add_clicked_callback(self.refresh)
        self.hide_sleep_connections.set_tooltip('Remove connections in the Sleeping state from the connection list.')
        self.check_box.add(self.hide_sleep_connections, False, True)

        self.mdl_locks_page = None
        self._showing_extras = False
        if self.new_processlist():
            self.hide_background_threads = newCheckBox()
            self.hide_background_threads.set_active(True)
            self.hide_background_threads.set_text('Hide background threads')
            self.hide_background_threads.set_tooltip('Remove background threads (internal server threads) from the connection list.')
            self.hide_background_threads.add_clicked_callback(self.refresh)
            self.check_box.add(self.hide_background_threads, False, True)
            
            self.truncate_info = newCheckBox()
            self.truncate_info.set_active(True)
            self.truncate_info.set_text('Don\'t load full thread info')
            self.truncate_info.set_tooltip('Toggle whether to load the entire query information for all connections or just the first 255 characters.\nEnabling this can have a large impact in busy servers or server executing large INSERTs.')
            self.truncate_info.add_clicked_callback(self.refresh)
            self.check_box.add(self.truncate_info, False, True)

            # tab with some extra info, only available if PS exists
            self.extra_info_tab = mforms.newTabView(mforms.TabViewSystemStandard)
            self.extra_info_tab.set_size(350, -1)
            self.extra_info_tab.add_tab_changed_callback(self.extra_tab_changed)

            self.connection_details_scrollarea = mforms.newScrollPanel()
            self.connection_details = ConnectionDetailsPanel(self)
            self.connection_details_scrollarea.add(self.connection_details)
            self.details_page = self.extra_info_tab.add_page(self.connection_details_scrollarea, "Details")

            self.mdl_list_box = None
            if self.ctrl_be.target_version.is_supported_mysql_version_at_least(5, 7, 3):
                self.mdl_list_box_scrollarea = mforms.newScrollPanel()
                self.mdl_list_box = mforms.newBox(False)
                self.mdl_list_box_scrollarea.add(self.mdl_list_box)

                self.mdl_label = mforms.newLabel('Metadata locks (MDL) protect concurrent access to\nobject metadata (not table row/data locks)')
                self.mdl_list_box.add(self.mdl_label, False, True)

                label = mforms.newLabel("\nGranted Locks (and threads waiting on them)")
                label.set_style(mforms.BoldStyle)
                self.mdl_list_box.add(label, False, True)
                label = mforms.newLabel("Locks this connection currently owns and\nconnections that are waiting for them.")
                label.set_style(mforms.SmallHelpTextStyle)
                self.mdl_list_box.add(label, False, True)

                self.mdl_list_held = mforms.newTreeNodeView(mforms.TreeAltRowColors)
                self.mdl_list_held.add_column(mforms.IconStringColumnType, "Object", 130, False)
                self.mdl_list_held.add_column(mforms.StringColumnType, "Type", 100, False)
                self.mdl_list_held.add_column(mforms.StringColumnType, "Duration", 100, False)
                self.mdl_list_held.end_columns()
                self.mdl_list_held.set_size(0, 100)
                self.mdl_list_box.add(self.mdl_list_held, True, True)

                label = mforms.newLabel("\nPending Locks")
                label.set_style(mforms.BoldStyle)
                self.mdl_list_box.add(label, False, True)
                hbox = mforms.newBox(True)
                hbox.set_spacing(4)
                self.mdl_blocked_icon = mforms.newImageBox()
                self.mdl_blocked_icon.set_image(mforms.App.get().get_resource_path("message_warning.png"))
                hbox.add(self.mdl_blocked_icon, False, True)
                self.mdl_waiting_label = mforms.newLabel("Locks this connection is currently waiting for.")
                hbox.add(self.mdl_waiting_label, True, True)
                self.mdl_list_box.add(hbox, False, True)
                self.mdl_locks_page = self.extra_info_tab.add_page(self.mdl_list_box_scrollarea, "Locks")

            if self.ctrl_be.target_version.is_supported_mysql_version_at_least(5, 6, 0):
                self.attributes_list = mforms.newTreeNodeView(mforms.TreeFlatList|mforms.TreeAltRowColors)
                self.attributes_list.add_column(mforms.StringColumnType, "Attribute", 150, False)
                self.attributes_list.add_column(mforms.StringColumnType, "Value", 200, False)
                self.attributes_list.end_columns()
                self.attributes_page = self.extra_info_tab.add_page(self.attributes_list, "Attributes")

            self.connection_box.add(self.extra_info_tab, False, True)
            self.extra_info_tab.show(False)

            self.show_extras = newButton()
            self.show_extras.set_text('Show Details')
            self.show_extras.add_clicked_callback(self.toggle_extras)
            self.check_box.add_end(self.show_extras, False, True)

        self.add(self.check_box, False, True)
        
        self.resume_layout()
        
        self.connection_selected()
        
        dprint_ex(4, "Leave")
Ejemplo n.º 39
0
    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.SystemColorHighlight)

        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.set_release_on_add()
        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)

        # Retrieve from server the log file paths if exist
        status = self.ctrl_be.is_server_running(verbose=0)
        if status in ['stopped', 'unknown'] and not all([
                self.server_profile.
                general_log_file_path,  # only proceed to parse the config file if
                self.server_profile.
                slow_log_file_path,  # any of these is missing
                self.server_profile.error_log_file_path,
                self.server_profile.log_output
        ]):

            cfg_be = wb_admin_config_file_be.WbAdminConfigFileBE(
                self.server_profile, self.ctrl_be)
            cfg_be.open_configuration_file(
                self.server_profile.config_file_path)
            options = dict(
                cfg_be.get_options(self.server_profile.config_file_section))

            if not self.server_profile.log_output and options.has_key(
                    'log-output'):
                self.server_profile.log_ouput = options['log-output']

            if not self.server_profile.general_log_file_path:
                path = options['general_log_file'] if options.has_key(
                    'general_log_file') else (
                        options['log'] if options.has_key('log') else ''
                    )  # the 'log' option is deprecated but still allowed
                if path:
                    self.server_profile.general_log_file_path = path.strip('"')

            if not self.server_profile.slow_log_file_path:
                path = options['slow_query_log_file'] if options.has_key(
                    'slow_query_log_file'
                ) else (
                    options['log-slow-queries']
                    if options.has_key('log-slow-queries') else ''
                )  # the 'log-slow-queries' option is deprecated but still allowed
                if path:
                    self.server_profile.slow_log_file_path = path.strip('"')

            if not self.server_profile.error_log_file_path and options.has_key(
                    'log-error'):
                self.server_profile.error_log_file_path = options[
                    'log-error'].strip('"')

        # 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)
        self.restore = WbAdminImport(server_profile, self.ctrl_be, self)

        self.init_extensions(server_profile, self.ctrl_be)

        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()
    def create_ui(self):
        known_views = []
        res = self.ctrl_be.exec_query(
            "show full tables from sys where Table_type='VIEW'")
        while res.nextRow():
            known_views.append(res.stringByIndex(1))

        self.content = mforms.newBox(True)
        self.content.set_spacing(12)

        self.tree = mforms.newTreeView(mforms.TreeDefault)
        self.tree.add_column(mforms.IconStringColumnType, "Report", 250, False)
        self.tree.end_columns()
        self.tree.set_size(250, -1)
        self.tree.add_changed_callback(self._report_selected)
        self.content.add(self.tree, False, True)

        self.tabview = mforms.newTabView(mforms.TabViewTabless)
        self.content.add(self.tabview, True, True)

        self.relayout()  # force relayout for mac

        self.pages = []

        try:
            report_data = json.load(
                open(
                    os.path.join(mforms.App.get().get_resource_path("sys"),
                                 "sys_reports.js")))
        except Exception as e:
            log_error("Error loading sys_reports.js: %s\n" % e)
            mforms.Utilities.show_error(
                "Error Loading Report Definitions",
                "An error occurred loading file %s\n%s" %
                (os.path.join(mforms.App.get().get_resource_path("sys"),
                              "sys_reports.js"), e), "OK", "", "")
            return
        category_labels = report_data["categories"]
        reports = report_data["reports"]

        prev = None
        parent = None
        for report in reports:
            view = report["view"]
            if view not in known_views:
                log_debug("View `%s` not in sys, skipping report\n" % view)
                continue
            else:
                known_views.remove(view)

            try:
                tab = JSSourceHelperViewTab(self, report)
            except Exception as e:
                log_error("Error processing PS report definition %s:\n%s\n" %
                          (e, report))
                continue
            setattr(self, "tab_" + tab.caption, tab)
            self.pages.append(tab)
            self.tabview.add_page(tab, str(tab.caption))

            if tab.category != prev:
                if parent:
                    parent.expand()
                prev = tab.category
                parent = self.tree.add_node()
                parent.set_string(
                    0, category_labels.get(tab.category, tab.category))

            node = parent.add_child()
            node.set_string(0, tab.caption)
            node.set_tag(tab.caption)
        if parent:
            parent.expand()

        print(
            "The following views are not handled",
            set([
                v for v in known_views
                if not v[0] == '-' and not v.endswith("_raw")
            ]) - set(["wbversion", "version"]))
        return self.content