def page_activated(self): if not self.server_profile.admin_enabled: self.add(no_remote_admin_warning_label(self.server_profile), True, True) return if not self.ui_created: self.create_ui() self.ui_created = True if self.server_control: self.server_control.set_output_handler(self.print_output_cb) if self.is_server_running_prev_check is None: self.is_server_running_prev_check = self.ctrl_be.is_server_running() self.update_ui(self.is_server_running_prev_check) self.print_new_error_log_entries()
def create_ui(self): self.suspend_layout() if not self.server_profile.admin_enabled: self.add(no_remote_admin_warning_label(self.server_profile), False, True) self.resume_layout() return self.main_view.ui_profile.apply_style(self, 'page') self.set_padding(8) # TODO check padding # Top layout structure. content = newBox(False) self.add(content, True, True) # A spacer at the bottom of the page. spacer = newBox(True) spacer.set_size(-1, 40) self.add(spacer, False, True) # Left pane (start/stop). heading = newLabel("Database Server Status") heading.set_style(mforms.BoldStyle) content.add(heading, False, True) left_pane = newBox(False) left_pane.set_spacing(8) self.long_status_msg = newLabel("The database server is stopped") self.long_status_msg.set_style(mforms.SmallStyle) status_message_part = newLabel("The database server instance is ") self.short_status_msg = newLabel("...") self.short_status_msg.set_color("#DD0000") self.start_stop_btn = newButton() self.start_stop_btn.set_text("Start server") self.start_stop_btn.add_clicked_callback(self.start_stop_clicked) start_stop_hbox = newBox(True) start_stop_hbox.add(status_message_part, False, True) start_stop_hbox.add(self.short_status_msg, False, True) start_stop_hbox.add(newLabel(" "), False, False) start_stop_hbox.add(self.start_stop_btn, False, False) left_pane.add(self.long_status_msg, False, True) left_pane.add(start_stop_hbox, False, False) description = newLabel( "If you stop the server, you and your applications will not be able to use the Database and all current connections will be closed\n" ) description.set_style(mforms.SmallStyle) left_pane.add(description, False, False) auto_start_checkbox = newCheckBox() auto_start_checkbox.set_text( "Automatically Start Database Server on Startup") auto_start_checkbox.set_active(True) description = newLabel( "You may select to have the Database server start automatically whenever the computer starts up." ) description.set_style(mforms.SmallStyle) description.set_wrap_text(True) content.add(left_pane, False, True) # Right pane (log). heading = newLabel("Startup Message Log") heading.set_style(mforms.BoldStyle) content.add(heading, False, True) right_pane = newBox(False) right_pane.set_spacing(8) self.startup_msgs_log = newTextBox(mforms.BothScrollBars) self.startup_msgs_log.set_read_only(True) right_pane.add(self.startup_msgs_log, True, True) button_box = newBox(True) self.refresh_button = newButton() self.refresh_button.set_text("Refresh Status") self.refresh_button.add_clicked_callback(lambda: self.refresh(2)) button_box.add(self.refresh_button, False, False) self.copy_to_clipboard_button = newButton() self.copy_to_clipboard_button.set_size(150, -1) self.copy_to_clipboard_button.set_text("Copy to Clipboard") self.copy_to_clipboard_button.add_clicked_callback( self.copy_to_clipboard) button_box.add_end(self.copy_to_clipboard_button, False, False) self.clear_messages_button = newButton() self.clear_messages_button.set_size(150, -1) self.clear_messages_button.set_text("Clear Messages") self.clear_messages_button.add_clicked_callback(self.clear_messages) button_box.add_end(self.clear_messages_button, False, False) right_pane.add(button_box, False, True) content.add(right_pane, True, True) self.resume_layout() self.ctrl_be.add_me_for_event("server_started", self) self.ctrl_be.add_me_for_event("server_stopped", self)
def create_ui(self): self.suspend_layout() if not self.server_profile.admin_enabled: self.add(no_remote_admin_warning_label(self.server_profile), False, True) self.resume_layout() return self.main_view.ui_profile.apply_style(self, 'page') self.set_padding(8) # TODO check padding # Top layout structure. content = newBox(False) self.add(content, True, True) # A spacer at the bottom of the page. spacer = newBox(True) spacer.set_size(-1, 40) self.add(spacer, False, True) # Left pane (start/stop). heading = newLabel("Database Server Status") heading.set_style(mforms.BoldStyle) content.add(heading, False, True) left_pane = newBox(False) left_pane.set_spacing(8) self.long_status_msg = newLabel("The database server is stopped") self.long_status_msg.set_style(mforms.SmallStyle) left_pane.add(self.long_status_msg, False, True) status_message_part = newLabel("The database server instance is ") self.short_status_msg = newLabel("...") self.short_status_msg.set_color("#DD0000") self.start_stop_btn = newButton() self.start_stop_btn.set_text("Start server") self.start_stop_btn.add_clicked_callback(self.start_stop_clicked) start_stop_hbox = newBox(True) start_stop_hbox.add(status_message_part, False, True) start_stop_hbox.add(self.short_status_msg, False, True) start_stop_hbox.add(newLabel(" "), False, False) start_stop_hbox.add(self.start_stop_btn, False, False) left_pane.add(start_stop_hbox, False, False) left_pane.add(self.long_status_msg, False, False) left_pane.add(start_stop_hbox, False, False) description = newLabel("If you stop the server, you and your applications will not be able to use the Database and all current connections will be closed") description.set_style(mforms.SmallStyle) left_pane.add(description, False, False) separator = newImageBox() separator.set_image("options-horizontal-separator.png") left_pane.add(separator, False, True) auto_start_checkbox = newCheckBox() auto_start_checkbox.set_text("Automatically Start Database Server on Startup") auto_start_checkbox.set_active(True) description = newLabel("You may select to have the Database server start automatically whenever the computer starts up.") description.set_style(mforms.SmallStyle) description.set_wrap_text(True) content.add(left_pane, False, True) # Right pane (log). heading = newLabel("Startup Message Log") heading.set_style(mforms.BoldStyle) content.add(heading, False, True) right_pane = newBox(False) right_pane.set_spacing(8) self.startup_msgs_log = newTextBox(mforms.BothScrollBars) self.startup_msgs_log.set_read_only(True) right_pane.add(self.startup_msgs_log, True, True) button_box = newBox(True) self.refresh_button = newButton() self.refresh_button.set_text("Refresh Status") self.refresh_button.add_clicked_callback(lambda:self.refresh(2)) button_box.add(self.refresh_button, False, False) self.copy_to_clipboard_button = newButton() self.copy_to_clipboard_button.set_size(150, -1) self.copy_to_clipboard_button.set_text("Copy to Clipboard") self.copy_to_clipboard_button.add_clicked_callback(self.copy_to_clipboard) button_box.add_end(self.copy_to_clipboard_button, False, False) self.clear_messages_button = newButton() self.clear_messages_button.set_size(150, -1) self.clear_messages_button.set_text("Clear Messages") self.clear_messages_button.add_clicked_callback(self.clear_messages) button_box.add_end(self.clear_messages_button, False, False) right_pane.add(button_box, False, True) content.add(right_pane, True, True) self.resume_layout() self.ctrl_be.add_me_for_event("server_started", self) self.ctrl_be.add_me_for_event("server_stopped", self)
def create_ui(self): self.suspend_layout() if not self.server_profile.admin_enabled: self.add(no_remote_admin_warning_label(self.server_profile), False, True) self.resume_layout() return self.set_padding(12) self.set_spacing(8) # Left pane (start/stop). self.heading = make_panel_header("title_startup.png", self.server_profile.name, "Startup / Shutdown MySQL Server") self.add(self.heading, False, True) self.add(newLabel(" "), False, False) self.long_status_msg = newLabel("The database server is stopped") self.long_status_msg.set_style(mforms.SmallStyle) status_message_part = newLabel("The database server instance is ") self.short_status_msg = newLabel("...") self.short_status_msg.set_color("#DD0000") self.start_stop_btn = newButton() self.start_stop_btn.set_text("Start server") self.start_stop_btn.add_clicked_callback(self.start_stop_clicked) start_stop_hbox = newBox(True) start_stop_hbox.add(status_message_part, False, True) start_stop_hbox.add(self.short_status_msg, False, True) start_stop_hbox.add(newLabel(" "), False, False) start_stop_hbox.add(self.start_stop_btn, False, False) self.add(self.long_status_msg, False, True) self.add(start_stop_hbox, False, False) description = newLabel("If you stop the server, you and your applications will not be able to use the Database and all current connections will be closed\n") description.set_style(mforms.SmallStyle) self.add(description, False, False) auto_start_checkbox = newCheckBox() auto_start_checkbox.set_text("Automatically Start Database Server on Startup") auto_start_checkbox.set_active(True) description = newLabel("You may select to have the Database server start automatically whenever the computer starts up.") description.set_style(mforms.SmallStyle) description.set_wrap_text(True) # Right pane (log). heading = newLabel("\nStartup Message Log") heading.set_style(mforms.BoldStyle) self.add(heading, False, True) self.startup_msgs_log = newTextBox(mforms.BothScrollBars) self.startup_msgs_log.set_name('StartupMessagesLog') self.startup_msgs_log.set_read_only(True) self.add(self.startup_msgs_log, True, True) button_box = newBox(True) self.refresh_button = newButton() self.refresh_button.set_size(150, -1) self.refresh_button.set_text("Refresh Status") self.refresh_button.add_clicked_callback(lambda:self.refresh(True)) button_box.add(self.refresh_button, False, False) self.copy_to_clipboard_button = newButton() self.copy_to_clipboard_button.set_size(150, -1) self.copy_to_clipboard_button.set_text("Copy to Clipboard") self.copy_to_clipboard_button.add_clicked_callback(self.copy_to_clipboard) button_box.add_end(self.copy_to_clipboard_button, False, False) self.clear_messages_button = newButton() self.clear_messages_button.set_size(150, -1) self.clear_messages_button.set_text("Clear Messages") self.clear_messages_button.add_clicked_callback(self.clear_messages) button_box.add_end(self.clear_messages_button, False, False) self.add(button_box, False, True) self.resume_layout() self.ctrl_be.add_me_for_event("server_started", self) self.ctrl_be.add_me_for_event("server_stopped", self)