示例#1
0
    def __init__(self, server_profile, ctrl_be, main_view):
        mforms.Box.__init__(self, False)  # Make vertical box
        main_view.ui_profile.apply_style(self, 'page')
        self.set_managed()
        self.set_release_on_add()

        self.ctrl_be = ctrl_be
        self.main_view = main_view

        self.status = wb_admin_monitor.WbAdminMonitor(server_profile,
                                                      self.ctrl_be)
        self.add(self.status, False, False)

        vbox = newBox(False)
        vbox.set_spacing(2)
        label = newLabel("CONNECTIONS")  #newHeaderLabel(" Connections")
        main_view.ui_profile.apply_style(label, 'subsection-label')
        vbox.add(label, False, False)

        self.connections = WbAdminConnections(server_profile, self.ctrl_be)
        main_view.ui_profile.apply_style(self.connections, "page")
        vbox.add(self.connections, True, True)

        self.add(vbox, True, True)

        self.main_view.add_content_page(self, "MANAGEMENT", "Server Status",
                                        "admin_server_status_win")
    def __init__(self, ctrl_be, server_profile, main_view):
        mforms.Box.__init__(self, True)
        self.set_managed()
        self.set_release_on_add()

        self.set_name("Server Status Main")

        self.ui_created = False

        self.set_spacing(24)

        self.ctrl_be = ctrl_be
        self.server_profile = server_profile
        self.main_view = main_view

        lbox = mforms.newBox(False)
        lbox.set_name("Server Status Left Side")
        self.add(lbox, True, True)

        self.connection_info = ConnectionInfo(self)
        self.connection_info.set_padding(24)
        lbox.add(self.connection_info, False, True)

        self.scrollbox = mforms.newScrollPanel(
            mforms.ScrollPanelDrawBackground)
        self.scrollbox.set_padding(24)
        self.scrollbox.set_name("Extra Server Info Section")

        self.content = mforms.newBox(False)
        self.content.set_padding(20)
        self.content.set_spacing(4)
        self.scrollbox.add(self.content)
        lbox.add(self.scrollbox, True, True)

        image = mforms.newImageBox()
        image.set_name("Server Status Separator")
        if self.server_profile.host_os == "linux":
            image.set_image(mforms.App.get().get_resource_path(
                "mysql-status-separator-linux.png"))
        else:
            image.set_image(mforms.App.get().get_resource_path(
                "mysql-status-separator.png"))
        image.set_image_align(mforms.MiddleCenter)
        self.add(image, False, True)

        self.status = wb_admin_monitor.WbAdminMonitor(server_profile,
                                                      self.ctrl_be)
        self.status.set_size(360, -1)
        self.status.set_padding(0, 24, 24, 24)
        self.add(self.status, False, True)

        self.controls = {}

        self.currently_started = None
        self.ctrl_be.add_me_for_event("server_started", self)
        self.ctrl_be.add_me_for_event("server_offline", self)
        self.ctrl_be.add_me_for_event("server_stopped", self)

        self.connection_info.update(self.ctrl_be)