def __init__(self, ctrl_be, title, descr, stop_callback=None, close_callback=None, progress_parser_callback=None): mforms.Form.__init__(self, mforms.Form.main_form(), mforms.FormDialogFrame) self.ctrl_be = ctrl_be self._done = False self._update_tm = None self.finished_callback = None self.stop_callback = stop_callback self.close_callback = close_callback self.progress_parser_callback = progress_parser_callback self.show(False) self.box = mforms.newBox(False) self.set_content(self.box) self.box.set_padding(12) self.box.set_spacing(20) self.set_title(title) self.label = mforms.newLabel(descr) self.box.add(self.label, False, True) hb = mforms.newBox(True) self.progress = mforms.newProgressBar() self.progress_label = mforms.newLabel("") self.progress_label.set_size(100, -1) hb.add(self.progress_label, False, True) hb.add(self.progress, True, True) self.box.add(hb, False, True) self.logbox = mforms.newTextBox(mforms.VerticalScrollBar) self.logbox.set_read_only(True) panel = mforms.newPanel(mforms.TitledBoxPanel) panel.set_title("Command Output") self.logbox.set_padding(8) panel.add(self.logbox) self.box.add(panel, True, True) bbox = mforms.newBox(True) self.box.add_end(bbox, False, True) self.stop = mforms.newButton() if stop_callback: self.stop.set_text("Stop") else: self.stop.set_text("Close") self.stop.add_clicked_callback(self.do_stop) bbox.add_end(self.stop, False, True) self.set_size(700, 500) self.center()
def create_ui(self): self.content.set_padding(20) self._report = mforms.newTextBox(mforms.VerticalScrollBar) self.content.add(self._report, True, True) self.next_button.set_text("Finish")
def create_ui(self): self.content.set_padding(20) self._report = mforms.newTextBox(mforms.VerticalScrollBar) self.content.add(self._report, True, True) self.next_button.set_text('Finish')
def create_ui(self): message = "The wizard was successful. " if self.update_connection: message += "Click on the finish button to update the connection. " message += "To setup the server, you should \ncopy the following files to a <directory> inside %s:\n\n" % self.main.conn.parameterValues['hostName'] message += " - %s\n" % str(os.path.join(self.main.results_path, "ca-cert.pem")).replace('\\', '/') message += " - %s\n" % str(os.path.join(self.main.results_path, "server-cert.pem")).replace('\\', '/') message += " - %s\n" % str(os.path.join(self.main.results_path, "server-key.pem")).replace('\\', '/') message += "\n\nand edit the config file to use the following parameters:" label = mforms.newLabel(message) self.content.add(label, False, True) f = open(os.path.join(self.main.results_path, "my.cnf.sample"), "r") config_file = mforms.newTextBox(mforms.VerticalScrollBar) config_file.set_value(f.read()) config_file.set_size(-1, 150) self.content.add(config_file, False, True) f.close() label = mforms.newLabel("A copy of this file can be found in:\n%s" % str(os.path.join(self.main.results_path, "my.cnf.sample").replace('\\', '/'))) self.content.add(label, False, True) return
def create_ui(self): self.loading = True self.cfg_be = wb_admin_config_file_be.WbAdminConfigFileBE(self.server_profile, self.ctrl_be) sys_config_path = self.server_profile.config_file_path if sys_config_path is None: sys_config_path = "" self.file_name_ctrl.set_value(sys_config_path) self.section_ctrl.add_changed_callback(self.clear_and_load) try: self.myopts = self.cfg_be.get_possible_options() option_stats = self.cfg_be.get_option_set_stats() dprint_ex(1, "Options stats: '%s'" % str(option_stats)) if option_stats and type(option_stats) is dict: added = option_stats.get("added", None) if added is not None and added < 10: user_selected_version = run_version_select_form(option_stats["version"]) self.server_profile.set_server_version(".".join(map(lambda x: str(x), user_selected_version))) self.cfg_be.reload_possible_options() self.myopts = self.cfg_be.get_possible_options() option_stats = self.cfg_be.get_option_set_stats() dprint_ex(1, "Options stats after version correction: '%s'" % str(option_stats)) except KeyError: Utilities.show_error("Error", "Wrong version '" + self.version + "'given to admin plugin", "Close", None, None) self.load_options_from_cfg() #build ordered list of pages. Initially only skeleton pages are created, means only names. # Values into pages will be load as soon as page is switched to. self.pages = {} for page_name, page_content in self.myopts.iteritems(): self.pages[int(page_content['position'])] = Page(page_name, page_content) # False means page not created # page key is its position in UI. As we can have pages positions set like (1,2,4,5) # the position set needs to be sorted so pages appear in specified order page_positions = self.pages.keys() page_positions.sort() # Create dummy pages according to assigned position for page_pos in page_positions: page = self.pages[page_pos] page.panel = newScrollPanel(mforms.ScrollPanelNoFlags) self.tab_view.add_page(page.panel, page.page_name) if debug_level > 0: # Create file page page = Page("File", None) page.panel = newTextBox(mforms.BothScrollBars) page.set_update_cb(self.update_file_content_tab) self.pages[max(self.pages.keys()) + 1] = page self.tab_view.add_page(page.panel, page.page_name) # Create first page, so we display something from start self.create_page(1) self.loading = True # create_page resets loading flag self.tab_view.add_tab_changed_callback(self.tab_changed) self.loading = False
def __init__(self, main, header_label, description=None, use_private_message_handling=False): wizard_page_widget.WizardPage.__init__(self, main, header_label) self._use_private_message_handling = use_private_message_handling self._description = mforms.newLabel( description or "The following tasks will now be performed. Please monitor the execution." ) self._description.set_name('Page Description') self.content.add(self._description, False, True) self._tasks_box = mforms.newBox(False) self._tasks_box.set_padding(24) self._tasks_box.set_spacing(8) self.content.add(self._tasks_box, False, True) self._status_label = mforms.newLabel("Click [Next >] to execute.") self._status_label.set_name("Next Information") self.content.add(self._status_label, False, True) self._progress = mforms.newProgressBar() self.content.add(self._progress, False, True) self._progress.show(False) self._detail_label = mforms.newLabel("") self._detail_label.set_name('Details') self.content.add(self._detail_label, False, True) self._timer = None self._tasks = [] self._currently_running_task_index = None self._progress_indeterminate = False self._tasks_finished = False self._log_box = mforms.newPanel(mforms.TitledBoxPanel) self._log_box.set_title("Message Log") self._log_box.set_name("Message Log") self._log_text = mforms.newTextBox(mforms.VerticalScrollBar) self._log_text.set_name('Wizard Progress Log Text') self._log_text.set_read_only(True) self._log_text.set_padding(16) self._log_box.add(self._log_text) self._log_box.show(False) self.content.add_end(self._log_box, True, True) self._log_queue = deque() self._showing_logs = False self._cancel_requested = False self._tasks_held = False self.advanced_button.set_text("Show Logs") self._log_progress_text = True self._autostart = False
def __init__(self, owner, context): WizardPage.__init__(self, owner, "Recover Backup - Select Backup", wide=True) self.context = context self._backup_profiles = {} self.advanced_button_text = "Restore from File..." self.advanced_button_tooltip = """Pick a backup file created with mysqlbackup to be restored. You may pick a single file/backup image file (.mbi) or a backup directory. When picking a backup directory, select the meta/backup_context.xml file inside the desired backup directory.""" l = newLabel( """To recover a MySQL server from a backup, select the profile that was used to create it. To recover from a different backup, click [Restore from File...] and select a MySQL Enterprise Backup image file or backup directory. Note: the server will be shutdown during restore.""") self.content.add(l, False, True) hbox = mforms.newBox(True) hbox.set_spacing(8) hbox.set_padding(20) hbox.add(newLabel("Backup Profile:", True), False, True) self._profile = mforms.newSelector() self._profile.set_name("profile") self._profile.add_changed_callback(self.profile_selected) hbox.add(self._profile, True, True) self._use_most_recent = mforms.newCheckBox() self._use_most_recent.set_text("Use most recent backup") self._use_most_recent.add_clicked_callback(self.most_recent_toggled) self._use_most_recent.set_active(True) hbox.add(self._use_most_recent, False, True) self.content.add(hbox, False, False) self._table_h = newLabel("Select Backup from List") self.content.add(self._table_h, False, True) self._table = newTreeNodeView(mforms.TreeFlatList) self._table.add_column(mforms.StringColumnType, "Date of Backup", 200, False) self._table.add_column(mforms.StringColumnType, "Full/Incr.", 60, False) self._table.add_column(mforms.IconStringColumnType, "State", 200, False) self._table.add_column(mforms.StringColumnType, "LSN Range", 200, False) self._table.add_column(mforms.StringColumnType, "Binlog Position", 200, False) self._table.end_columns() self.content.add(self._table, True, True) self.content.add(newLabel("Details:"), False, True) self._text = newTextBox(mforms.VerticalScrollBar) self.content.add(self._text, True, True) self._error_icon = mforms.App.get().get_resource_path("mini_error.png")
def text_editor_schema_box(self): tBox = PropelForm.spaced_box(True) self.widgets['export_text_editor'] = mforms.newTextBox(mforms.BothScrollBars) self.widgets['export_text_editor'].set_size(self.defaults['text_editor_width'], self.defaults['text_editor_height']) self.widgets['export_text_editor'].set_bordered(True) self.widgets['export_text_editor'].set_read_only(False) tBox.add(self.widgets['export_text_editor'], False, True) self.add(tBox, False, True)
def create_comments_tab(self): self._comments = newBox(False) self._comments.set_spacing(12) self._comments.set_padding(12) self._configuration.add_page(self._comments, "Comments") self._comment = newTextBox(mforms.BothScrollBars) self._comments.add(self._comment, True, True)
def __init__(self, output): super(TextOutputTab, self).__init__(False, "TextOutput", False) self.textbox = mforms.newTextBox(mforms.BothScrollBars) self.textbox.set_monospaced(True) self.textbox.set_value(output) self.textbox.set_read_only(True) self.add(self.textbox, True, True)
def __init__(self, main): WizardPage.__init__(self, main, "Migration Report") self.main.add_wizard_page(self, "REPORT", "Migration Report") self._report = mforms.newTextBox(mforms.VerticalScrollBar) self.content.add(self._report, True, True) self.next_button.set_text("Finish")
def __init__(self, main): WizardPage.__init__(self, main, "Migration Report") self.main.add_wizard_page(self, "Report", "Migration Report") self._report = mforms.newTextBox(mforms.VerticalScrollBar) self.content.add(self._report, True, True) self.next_button.set_text("Finish")
def __init__(self, ctrl_be, thread_id): mforms.Form.__init__(self, mforms.Form.main_form()) self.set_title("Thread Stack for %d" % thread_id) self.ctrl_be = ctrl_be vbox = mforms.newBox(False) vbox.set_padding(20) vbox.set_spacing(18) self.thread_id = thread_id splitter = mforms.newSplitter(True, False) self.tree = mforms.newTreeNodeView(mforms.TreeDefault) self.tree.add_column(mforms.IntegerColumnType, "Event Id", 50, False) self.tree.add_column(mforms.StringColumnType, "Event info", 200, False) self.tree.add_column(mforms.StringColumnType, "Type", 100, False) self.tree.add_column(mforms.StringColumnType, "Timer wait [\xC2\xB5s]", 80, False) if self.enable_debug_info: self.tree.add_column(mforms.StringColumnType, "Source", 200, False) self.tree.end_columns() self.tree.set_size(400, -1) self.tree.add_changed_callback(self.event_selected) splitter.add(self.tree, 500); l = mforms.newLabel("Wait info") l.set_style(mforms.BoldStyle) tbox = newBox(False) lbox = newBox(False) lbox.set_spacing(5) lbox.set_padding(5) lbox.add(l, False, False) tbox.add(lbox, False, False) self.text = mforms.newTextBox(mforms.VerticalScrollBar) self.text.set_read_only(True) self.text.set_size(150, -1) tbox.add(self.text, True, True) splitter.add(tbox, 150) vbox.add(splitter, True, True) self.set_content(vbox) bbox = newBox(True) bbox.set_spacing(8) self.ok = newButton() self.ok.set_text("Close") self.ok.add_clicked_callback(self.close_form) bbox.add_end(self.ok, False, False) vbox.add_end(bbox, False, True) self.set_size(800, 600) self.center()
def __init__(self, ctrl_be, title, descr, stop_callback = None, close_callback=None, progress_parser_callback=None): mforms.Form.__init__(self, mforms.Form.main_form(), mforms.FormDialogFrame) self.ctrl_be = ctrl_be self._done = False self._update_tm = None self.finished_callback = None self.stop_callback = stop_callback self.close_callback = close_callback self.progress_parser_callback = progress_parser_callback self.show(False) self.box = mforms.newBox(False) self.set_content(self.box) self.box.set_padding(12) self.box.set_spacing(20) self.set_title(title) self.label = mforms.newLabel(descr) self.box.add(self.label, False, True) hb = mforms.newBox(True) self.progress = mforms.newProgressBar() self.progress_label = mforms.newLabel("") self.progress_label.set_size(100, -1) hb.add(self.progress_label, False, True) hb.add(self.progress, True, True) self.box.add(hb, False, True) self.logbox = mforms.newTextBox(mforms.VerticalScrollBar) self.logbox.set_read_only(True) panel = mforms.newPanel(mforms.TitledBoxPanel) panel.set_title("Command Output") self.logbox.set_padding(8) panel.add(self.logbox) self.box.add(panel, True, True) bbox = mforms.newBox(True) self.box.add_end(bbox, False, True) self.stop = mforms.newButton() if stop_callback: self.stop.set_text("Stop") else: self.stop.set_text("Close") self.stop.add_clicked_callback(self.do_stop) bbox.add_end(self.stop, False, True) self.set_size(700, 500) self.center()
def __init__(self, context, profile): mforms.Box.__init__(self, False) self.set_managed() self.set_release_on_add() self._context = context self._profile = profile self.set_spacing(12) self.text = mforms.newTextBox(mforms.VerticalScrollBar) self.add(self.text, True, True)
def create_ui(self): self.loading = True self.cfg_be = wb_admin_config_file_be.WbAdminConfigFileBE( self.server_profile, self.ctrl_be) sys_config_path = self.server_profile.config_file_path if sys_config_path is None: sys_config_path = "" self.file_name_ctrl.set_value(sys_config_path) self.section_ctrl.add_changed_callback(self.clear_and_load) try: self.myopts = self.cfg_be.get_possible_options() except KeyError: Utilities.show_error( "Error", "Wrong version '" + self.version + "'given to admin plugin", "Close", None, None) self.load_options_from_cfg() #build ordered list of pages. Initially only skeleton pages are created, means only names. # Values into pages will be load as soon as page is switched to. self.pages = {} for page_name, page_content in self.myopts.iteritems(): self.pages[int(page_content['position'])] = Page( page_name, page_content) # False means page not created # page key is its position in UI. As we can have pages positions set like (1,2,4,5) # the position set needs to be sorted so pages appear in specified order page_positions = self.pages.keys() page_positions.sort() # Create dummy pages according to assigned position for page_pos in page_positions: page = self.pages[page_pos] page.panel = newScrollPanel(mforms.ScrollPanelNoFlags) self.tab_view.add_page(page.panel, page.page_name) if debug_level > 0: # Create file page page = Page("File", None) page.panel = newTextBox(mforms.BothScrollBars) page.set_update_cb(self.update_file_content_tab) self.pages[max(self.pages.keys()) + 1] = page self.tab_view.add_page(page.panel, page.page_name) # Create first page, so we display something from start self.create_page(1) self.loading = True # create_page resets loading flag self.tab_view.add_tab_changed_callback(self.tab_changed) self.loading = False
def __init__(self, main, header_label, description = None, use_private_message_handling=False): wizard_page_widget.WizardPage.__init__(self, main, header_label) self._use_private_message_handling = use_private_message_handling self._description = mforms.newLabel(description or "The following tasks will now be performed. Please monitor the execution.") self.content.add(self._description, False, True) self._tasks_box = mforms.newBox(False) self._tasks_box.set_padding(24) self._tasks_box.set_spacing(8) self.content.add(self._tasks_box, False, True) self._status_label = mforms.newLabel("Click [Next >] to execute.") self.content.add(self._status_label, False, True) self._progress = mforms.newProgressBar() self.content.add(self._progress, False, True) self._progress.show(False) self._detail_label = mforms.newLabel("") self.content.add(self._detail_label, False, True) self._timer = None self._tasks = [] self._currently_running_task_index = None self._progress_indeterminate = False self._tasks_finished = False self._log_box = mforms.newPanel(mforms.TitledBoxPanel) self._log_box.set_title("Message Log") self._log_box.set_padding(12) self._log_text = mforms.newTextBox(mforms.VerticalScrollBar) self._log_text.set_name('WizardProgressLogText') self._log_text.set_read_only(True) self._log_box.add(self._log_text) self._log_box.show(False) self.content.add_end(self._log_box, True, True) self._log_queue = deque() self._showing_logs = False self._cancel_requested = False self._tasks_held = False self.advanced_button.set_text("Show Logs") self._log_progress_text = True self._autostart = False
def quickTablesInCatalog(catalog): form = mforms.Form(None, mforms.FormDialogFrame) label = mforms.newLabel( """You can create multiple tables by giving their outline in the following format: table1 *column1 int,column2 varchar(32),column3 table2 column1,column2 table3 ... * denotes a primary key column. Column type is optional.""") box = mforms.newBox(False) box.set_spacing(12) box.set_padding(12) box.add(label, False, False) text = mforms.newTextBox(mforms.VerticalScrollBar) box.add(text, True, True) form.set_content(box) form.set_title("Create Multiple Tables") ok = mforms.newButton() ok.set_text("OK") cancel = mforms.newButton() cancel.set_text("Cancel") bbox = mforms.newBox(True) mforms.Utilities.add_end_ok_cancel_buttons(bbox, ok, cancel) bbox.set_spacing(8) box.add_end(bbox, False, True) form.set_size(600, 350) form.center() schema = catalog.schemata[0] ok.add_clicked_callback(lambda: form.end_modal(True)) if form.run_modal(None, cancel): tabledefs = _parse_table_definitions(text.get_string_value()) for name, columns in tabledefs: if name: _create_table(catalog, schema, name, columns) return 1 return 0
def quickTablesInCatalog(catalog): form= mforms.Form(None, mforms.FormDialogFrame) label = mforms.newLabel("""You can create multiple tables by giving their outline in the following format: table1 *column1 int,column2 varchar(32),column3 table2 column1,column2 table3 ... * denotes a primary key column. Column type is optional.""") box = mforms.newBox(False) box.set_spacing(12) box.set_padding(12) box.add(label, False, False) text = mforms.newTextBox(mforms.VerticalScrollBar) box.add(text, True, True) form.set_content(box) form.set_title("Create Multiple Tables") ok = mforms.newButton() ok.set_text("OK") cancel = mforms.newButton() cancel.set_text("Cancel") bbox = mforms.newBox(True) mforms.Utilities.add_end_ok_cancel_buttons(bbox, ok, cancel) bbox.set_spacing(8) box.add_end(bbox, False, True) form.set_size(600, 350) form.center() schema = catalog.schemata[0] ok.add_clicked_callback(lambda: form.end_modal(True)) if form.run_modal(None, cancel): tabledefs= _parse_table_definitions(text.get_string_value()) for name, columns in tabledefs: if name: _create_table(catalog, schema, name, columns) return 1 return 0
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)
def __init__(self, editor): mforms.Form.__init__(self, mforms.Form.main_form(), mforms.FormDialogFrame) self.editor = editor self.logbox = mforms.newTextBox(mforms.VerticalScrollBar)
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 __init__(self, main): WizardPage.__init__(self, main, "Create Target Results", wide=True) self.main.add_wizard_page(self, "ObjectMigration", "Create Target Results") text = """Scripts to create the target schema were executed. No data has been migrated yet. Review the creation report below for errors or warnings. If there are any errors, you can manually fix the scripts and click [Recreate Objects] to retry the schema creation or return to the Manual Editing page to correct them there and retry the target creation.""" description = mforms.newLabel(text) description.set_name("Page Description") self.content.add(description, False, True) hbox = mforms.newBox(True) hbox.set_spacing(12) hbox.set_homogeneous(True) self._tree = mforms.newTreeView(mforms.TreeFlatList) self._tree.set_name("Script Results") self._tree.add_column(mforms.IconStringColumnType, "Object", 200, False) self._tree.add_column(mforms.IconStringColumnType, "Result", 600, False) self._tree.end_columns() self._tree.add_changed_callback(self._selection_changed) hbox.add(self._tree, True, True) #self.content.add(self._tree, True, True) self._advbox = mforms.newPanel(mforms.TitledBoxPanel) self._advbox.set_title("SQL CREATE Script for Selected Object") self._advbox.set_name("SQL IDE") box = mforms.newBox(False) self._code = mforms.newCodeEditor() self._code.set_language(mforms.LanguageMySQL) self._code.add_changed_callback(self._code_changed) box.add(self._code, True, True) vbox = mforms.newBox(True) vbox.set_padding(12) vbox.set_spacing(8) self._comment_check = mforms.newCheckBox() self._comment_check.set_text("Comment out") self._comment_check.set_name("Comment Out") self._comment_check.add_clicked_callback(self._comment_clicked) vbox.add(self._comment_check, False, True) self._revert_btn = mforms.newButton() self._revert_btn.set_text("Discard") vbox.add_end(self._revert_btn, False, True) self._revert_btn.add_clicked_callback(self._discard_clicked) self._apply_btn = mforms.newButton() self._apply_btn.set_text("Apply") vbox.add_end(self._apply_btn, False, True) self._apply_btn.add_clicked_callback(self._apply_clicked) box.add(vbox, False, True) self._advbox.add(box) #self._advbox.set_size(-1, 200) #self._advbox_shown = True #self.go_advanced() # toggle to hide self.advanced_button.set_text("Recreate Objects") #self.content.add(self._advbox, False, True) hbox.add(self._advbox, True, True) self.content.add(hbox, True, True) self._msgbox = mforms.newPanel(mforms.TitledBoxPanel) self._msgbox.set_title("Output Messages") self._msgbox.set_name("Output Messages") box = mforms.newBox(False) box.set_padding(8) self._msgs = mforms.newTextBox(mforms.VerticalScrollBar) box.add(self._msgs, True, True) self._msgbox.add(box) self.content.add(self._msgbox, False, True) self._msgbox.set_size(-1, 200) self._error_tables = []
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 __init__(self, owner, editor, schema, table, columns): mforms.Form.__init__(self, mforms.Form.main_form(), mforms.FormNormal) self._owner = owner self._editor = editor self._schema = schema self._table = table self._columns = columns self.set_title("Create Index for Table %s.%s" % (schema, table)) content = mforms.newBox(False) self.set_content(content) content.set_padding(20) content.set_spacing(12) table = mforms.newTable() table.set_row_count(7) table.set_column_count(2) table.set_row_spacing(8) table.set_column_spacing(8) content.add(table, False, True) table.add(mforms.newLabel("Index Name:", True), 0, 1, 0, 1, mforms.HFillFlag) hbox = mforms.newBox(True) hbox.set_spacing(12) self.name = mforms.newTextEntry() hbox.add(self.name, True, True) self.kind = mforms.newSelector() self.kind.add_items(["Non-Unique", "Unique", "FullText", "Spatial"]) hbox.add(self.kind, False, True) table.add(hbox, 1, 2, 0, 1, mforms.HFillFlag|mforms.HExpandFlag) table.add(mforms.newLabel("Type:", True), 0, 1, 1, 2, mforms.HFillFlag) self.type = mforms.newSelector() self.type.add_items(["BTREE", "HASH"]) table.add(self.type, 1, 2, 1, 2, mforms.HFillFlag) l = mforms.newLabel("Columns:") l.set_text_align(mforms.TopRight) table.add(l, 0, 1, 2, 3, mforms.HFillFlag|mforms.VFillFlag) self.columns = mforms.newTreeNodeView(mforms.TreeFlatList) self.columns.add_column(mforms.StringColumnType, "Column", 200, False) self.columns.add_column(mforms.StringColumnType, "Length", 60, True) # self.columns.add_column(mforms.CheckColumnType, "Order", 50, False) # ignored by server self.columns.end_columns() self.columns.set_size(-1, 80) tbl = mforms.newTable() tbl.set_row_count(3) tbl.set_column_count(2) tbl.set_row_spacing(2) tbl.set_column_spacing(4) tbl.add(self.columns, 0, 1, 0, 3, mforms.HFillFlag|mforms.VFillFlag|mforms.HExpandFlag) self.move_up = mforms.newButton() self.move_up.set_text("\xe2\x96\xb2") self.move_up.add_clicked_callback(self.move_row_up) self.move_up.enable_internal_padding(False) self.move_down = mforms.newButton() self.move_down.set_text("\xe2\x96\xbc") self.move_down.add_clicked_callback(self.move_row_down) self.move_down.enable_internal_padding(False) tbl.add(self.move_up, 1, 2, 0, 1, mforms.HFillFlag) tbl.add(self.move_down, 1, 2, 1, 2, mforms.HFillFlag) tbl.add(mforms.newLabel(""), 1, 2, 2, 3, mforms.HFillFlag|mforms.VExpandFlag) table.add(tbl, 1, 2, 2, 3, mforms.HFillFlag) l = mforms.newLabel("Comments:") l.set_text_align(mforms.TopRight) table.add(l, 0, 1, 3, 4, mforms.HFillFlag|mforms.VFillFlag) self.comments = mforms.newTextBox(0) self.comments.set_size(-1, 60) if self._editor.serverVersion.majorNumber > 5 or (self._editor.serverVersion.majorNumber == 5 and self._editor.serverVersion.minorNumber >= 5): pass else: self.comments.set_enabled(False) table.add(self.comments, 1, 2, 3, 4, mforms.HFillFlag|mforms.VFillFlag) online_ddl_ok = self._editor.serverVersion.majorNumber > 5 or (self._editor.serverVersion.majorNumber == 5 and self._editor.serverVersion.minorNumber >= 6) if online_ddl_ok: l = mforms.newLabel("\nCreate/Online Options") else: l = mforms.newLabel("\nCreate/Online Options (requires MySQL 5.6+)") l.set_enabled(False) l.set_style(mforms.BoldStyle) table.add(l, 1, 2, 4, 5, mforms.HFillFlag) table.add(mforms.newLabel("Algorithm:", True), 0, 1, 5, 6, mforms.HFillFlag) self.algorithm = mforms.newSelector() self.algorithm.add_items(["Default", "Copy", "InPlace"]) self.algorithm.set_enabled(online_ddl_ok) table.add(self.algorithm, 1, 2, 5, 6, mforms.HFillFlag) table.add(mforms.newLabel("Locking:", True), 0, 1, 6, 7, mforms.HFillFlag) self.lock = mforms.newSelector() self.lock.add_items(["Default (allow as much concurrency as possible)", "Exclusive (totally block access to table)", "Shared (allow queries but not DML)", "None (allow queries and DML)"]) self.lock.set_enabled(online_ddl_ok) table.add(self.lock, 1, 2, 6, 7, mforms.HFillFlag) bbox = mforms.newBox(True) bbox.set_spacing(12) self.ok = mforms.newButton() self.ok.set_text("Create") self.cancel = mforms.newButton() self.cancel.set_text("Cancel") mforms.Utilities.add_end_ok_cancel_buttons(bbox, self.ok, self.cancel) content.add_end(bbox, False, True) self.set_size(550, -1) self.center()
def run_filter_debugger(loginInfo, serverInfo, build_filters, apply_filters): form = Form(None, mforms.FormSingleFrame) close = newButton() close.set_text("Close") test = newButton() test.set_text("Test") clr = newButton() clr.set_text("Clear output") button_box = newBox(True) button_box.set_spacing(8) button_box.add(close, False, True) button_box.add(clr, False, True) top_box = newBox(False) top_box.set_padding(12) top_box.set_spacing(8) panel_box = newBox(True) panel_box.set_spacing(12) panel_box.set_padding(8) input_area = newTextBox(mforms.BothScrollBars) input_box = newBox(False) input_box.add(newLabel("Input:"), False, True) input_box.add(input_area, True, True) output_area = newTextBox(mforms.BothScrollBars) output_box = newBox(False) output_box.add(newLabel("Output:"), False, True) output_box.add(output_area, True, True) panel_box.add(input_box, True, True) panel_box.add(output_box, True, True) filter_box = newBox(True) filter_lbl = newLabel("Filter:") filters = newTextEntry() filter_box.add(filter_lbl, False, True) filter_box.add(filters, True, True) filter_box.add(test, False, True) top_box.add(filter_box, False, True) top_box.add(panel_box, True, True) top_box.add(button_box, False, True) form.set_content(top_box) form.set_size(400, 400) def clr_action(output_area): output_area.clear() def close_action(): form.close() def test_action(filters_entry, input_area, output_area, build_filters, apply_filters): (script, filters) = build_filters("dummy_executable | " + filters_entry.get_string_value()) def add_text(x): output_area.append_text(x) (filtered_text, filters_code) = apply_filters(input_area.get_string_value(), filters, add_text) retcode = 0 if filters_code is not None: if retcode is not None: retcode = int(retcode) and filters_code else: retcode = filters_code output_area.append_text("retcode = " + str(retcode) + "\n") close.add_clicked_callback(close_action) clr.add_clicked_callback(lambda : clr_action(output_area)) test.add_clicked_callback(lambda : test_action(filters, input_area, output_area, build_filters, apply_filters)) form.relayout() form.center() form.run_modal(close, None)
def __init__(self, main): WizardPage.__init__(self, main, "Create Target Results", wide=True) self.main.add_wizard_page(self, "ObjectMigration", "Create Target Results") text = """Scripts to create the target schema were executed. No data has been migrated yet. Review the creation report below for errors or warnings. If there are any errors, you can manually fix the scripts and click [Recreate Objects] to retry the schema creation or return to the Manual Editing page to correct them there and retry the target creation.""" self.content.add(mforms.newLabel(text), False, True) hbox = mforms.newBox(True) hbox.set_spacing(12) hbox.set_homogeneous(True) self._tree = mforms.newTreeNodeView(mforms.TreeFlatList) self._tree.add_column(mforms.IconStringColumnType, "Object", 200, False) self._tree.add_column(mforms.IconStringColumnType, "Result", 600, False) self._tree.end_columns() self._tree.add_changed_callback(self._selection_changed) hbox.add(self._tree, True, True) #self.content.add(self._tree, True, True) self._advbox = mforms.newPanel(mforms.TitledBoxPanel) self._advbox.set_title("SQL CREATE Script for Selected Object") box = mforms.newBox(False) self._code = mforms.newCodeEditor() self._code.set_language(mforms.LanguageMySQL) self._code.add_changed_callback(self._code_changed) box.add(self._code, True, True) vbox = mforms.newBox(True) vbox.set_padding(12) vbox.set_spacing(8) self._comment_check = mforms.newCheckBox() self._comment_check.set_text("Comment out") self._comment_check.add_clicked_callback(self._comment_clicked) vbox.add(self._comment_check, False, True) self._revert_btn = mforms.newButton() self._revert_btn.set_text("Discard") vbox.add_end(self._revert_btn, False, True) self._revert_btn.add_clicked_callback(self._discard_clicked) self._apply_btn = mforms.newButton() self._apply_btn.set_text("Apply") vbox.add_end(self._apply_btn, False, True) self._apply_btn.add_clicked_callback(self._apply_clicked) box.add(vbox, False, True) self._advbox.add(box) #self._advbox.set_size(-1, 200) #self._advbox_shown = True #self.go_advanced() # toggle to hide self.advanced_button.set_text("Recreate Objects") #self.content.add(self._advbox, False, True) hbox.add(self._advbox, True, True) self.content.add(hbox, True, True) self._msgbox = mforms.newPanel(mforms.TitledBoxPanel) self._msgbox.set_title("Output Messages") box = mforms.newBox(False) box.set_padding(8) self._msgs = mforms.newTextBox(mforms.VerticalScrollBar) box.add(self._msgs, True, True) self._msgbox.add(box) self.content.add(self._msgbox, False, True) self._msgbox.set_size(-1, 200) self._error_tables = []
def create_ui(self): ui_box = mforms.newBox(False) ui_box.add(newLabel(" "), False, True) 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) self.offline_mode_btn = newButton() self.offline_mode_btn.set_text("Bring Offline") self.offline_mode_btn.add_clicked_callback(self.offline_mode_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(self.start_stop_btn, False, True) start_stop_hbox.add(self.offline_mode_btn, False, True) if self._ctrl_be.target_version and self._ctrl_be.target_version.is_supported_mysql_version_at_least(5, 7, 5): self.offline_mode_btn.show(True) else: self.offline_mode_btn.show(False) ui_box.add(self.long_status_msg, False, True) ui_box.add(start_stop_hbox, False, True) description = newLabel("If you stop the server, neither you nor your applications can use the database and all current connections will be closed.\n") description.set_style(mforms.SmallStyle) ui_box.add(description, 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) # Right pane (log). heading = newLabel("\nStartup Message Log") heading.set_style(mforms.BoldStyle) ui_box.add(heading, False, True) self.startup_msgs_log = newTextBox(mforms.BothScrollBars) self.startup_msgs_log.set_name('Startup Messages Log') self.startup_msgs_log.set_read_only(True) ui_box.add(self.startup_msgs_log, True, True) 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.update_ui() return ui_box