def update(self, ctrl_be): self.suspend_layout() self.connection_name.set_text(ctrl_be.server_profile.name) info = ctrl_be.server_variables status = ctrl_be.status_variables if self.info_table: self.vbox.remove(self.info_table) self.info_table = mforms.newTable() self.info_table.set_column_count(2) self.info_table.set_row_count(8) self.info_table.set_column_spacing(18) self.info_table.set_row_spacing(5) stradd(self.info_table, 0, "\nHost", "\n" + info.get("hostname", "n/a")) stradd(self.info_table, 1, "Socket", info.get("socket", "n/a")) stradd(self.info_table, 2, "Port", info.get("port", "n/a")) stradd( self.info_table, 3, "Version", "%s (%s)" % (info.get("version", "n/a"), info.get("version_comment", ""))) stradd( self.info_table, 4, "Compiled For", "%s (%s)" % (info.get("version_compile_os", "n/a"), info.get("version_compile_machine", "n/a"))) stradd(self.info_table, 5, "Configuration File", ctrl_be.server_profile.config_file_path or "unknown") uptime = status.get("Uptime", None) if uptime: uptime = long(uptime) stradd( self.info_table, 6, "Running Since", "%s (%s)" % (time.ctime(ctrl_be.status_variables_time - uptime), format_duration(uptime, True))) else: stradd(self.info_table, 6, "Running Since", "n/a") self.vbox.add(self.info_table, True, True) box = mforms.newBox(True) refresh = mforms.newButton() refresh.set_text("Refresh") refresh.set_tooltip("Refresh server status information") refresh.add_clicked_callback(self.owner.refresh_status) box.add(refresh, False, False) self.info_table.add(box, 1, 2, 7, 8, mforms.VFillFlag) version = ctrl_be.target_version if version and info: icon = mforms.App.get().get_resource_path( "mysql-logo-%i%i.png" % (version.majorNumber, version.minorNumber)) if icon: self.icon.set_image(icon) self.resume_layout()
def update(self, ctrl_be): self.suspend_layout() self.connection_name.set_text(ctrl_be.server_profile.name) info = ctrl_be.server_variables status = ctrl_be.status_variables if self.info_table: self.vbox.remove(self.info_table) self.info_table = mforms.newTable() self.info_table.set_column_count(2) self.info_table.set_row_count(8) self.info_table.set_column_spacing(18) self.info_table.set_row_spacing(5) self.vbox.add(self.info_table, True, True) stradd(self.info_table, 0, "\nHost:", "\n"+info.get("hostname", "n/a")) stradd(self.info_table, 1, "Socket:", info.get("socket", "n/a")) stradd(self.info_table, 2, "Port:", info.get("port", "n/a")) stradd(self.info_table, 3, "Version:", "%s\n%s" % (info.get("version", "n/a"), info.get("version_comment", ""))) stradd(self.info_table, 4, "Compiled For:", "%s (%s)" % (info.get("version_compile_os", "n/a"), info.get("version_compile_machine", "n/a"))) stradd(self.info_table, 5, "Configuration File:", ctrl_be.server_profile.config_file_path or "unknown") uptime = status.get("Uptime", None) if uptime: uptime = long(uptime) stradd(self.info_table, 6, "Running Since:", "%s (%s)" % (time.ctime(ctrl_be.status_variables_time-uptime), format_duration(uptime, True))) else: stradd(self.info_table, 6, "Running Since:", "n/a") box = mforms.newBox(True) refresh = mforms.newButton() refresh.set_text("Refresh") refresh.set_tooltip("Refresh server status information") refresh.add_clicked_callback(self.owner.refresh_status) box.add(refresh, False, False) self.info_table.add(box, 1, 2, 7, 8, 0) version = ctrl_be.target_version if version and info: icon = mforms.App.get().get_resource_path("mysql-logo-%i%i.png" % (version.majorNumber, version.minorNumber)) if icon: self.icon.set_image(icon) self.resume_layout()