def create_options(self, box, options): optlist = [] for option in options: cont = None if option.paramType == "boolean": opt = mforms.newCheckBox() opt.set_active(self.defaultValue == "1") box.add(opt, False, True) getter = opt.get_string_value elif option.paramType == "string": hbox = mforms.newBox(True) hbox.set_spacing(8) hbox.add(mforms.newLabel(option.caption), False, True) opt = mforms.newTextEntry() opt.set_value(option.defaultValue) hbox.add(opt, True, True) l = mforms.newLabel(option.description) l.set_style(mforms.SmallHelpTextStyle) hbox.add(l, False, True) box.add(hbox, False, True) cont = hbox getter = opt.get_string_value else: grt.send_error("MigrationWizard", "migrationOption() for source has an invalid parameter of type %s (%s)" % (option.paramType, option.name)) continue optlist.append((cont or opt, option.name, getter)) return optlist
def _add_script_checkbox_option(self, box, name, caption, path_caption, browser_caption): check = mforms.newCheckBox() check.set_text(caption) box.add(check, False, True) vbox = mforms.newBox(False) vbox.set_spacing(4) file_box = mforms.newBox(True) file_box.set_spacing(4) file_box.add(mforms.newLabel(path_caption), False, True) file_entry = mforms.newTextEntry() file_entry.add_changed_callback(lambda self=self, option=name: setattr(self, name+"_check_duplicate", True)) file_box.add(file_entry, True, True) check.add_clicked_callback(lambda box=vbox, check=check: box.set_enabled(check.get_active())) button = mforms.newButton() button.set_text("Browse...") button.add_clicked_callback(lambda option=name, title=browser_caption: self._browse_files(option, title)) file_box.add(button, False, True) vbox.add(file_box, False, True) label = mforms.newLabel("You should edit this file to add the source and target server passwords before running it.") label.set_style(mforms.SmallHelpTextStyle) vbox.add(label, False, True) vbox.set_enabled(False) box.add(vbox, False, True) setattr(self, name+"_check_duplicate", False) setattr(self, name+"_checkbox", check) setattr(self, name+"_entry", file_entry)
def _add_script_radiobutton_option(self, box, name, caption, path_caption, browser_caption, label_caption, rid): holder = mforms.newBox(False) holder.set_spacing(4) radio = mforms.newRadioButton(rid) radio.set_text(caption) holder.add(radio, False, True) vbox = mforms.newBox(False) vbox.set_spacing(4) file_box = mforms.newBox(True) file_box.set_spacing(4) file_box.add(mforms.newLabel(path_caption), False, True) file_entry = mforms.newTextEntry() file_entry.add_changed_callback(lambda self=self, option=name: setattr( self, name + "_check_duplicate", True)) file_box.add(file_entry, True, True) radio.add_clicked_callback(self._script_radio_option_callback) button = mforms.newButton() button.set_text("Browse...") button.add_clicked_callback(lambda option=name, title=browser_caption: self._browse_files(option, title)) file_box.add(button, False, True) vbox.add(file_box, False, True) label = mforms.newLabel(label_caption) label.set_style(mforms.SmallHelpTextStyle) vbox.add(label, False, True) vbox.set_enabled(False) holder.add(vbox, False, True) box.add(holder, False, True) setattr(self, name + "_check_duplicate", False) setattr(self, name + "_radiobutton", radio) setattr(self, name + "_entry", file_entry) setattr(self, name + "_vbox", vbox)
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 setup_info_table(self, info_table, info): info_table.set_row_count(len(info) + 1) for i, item in enumerate(info): (label, value) = item if self.controls.has_key(label): info_table.remove(self.controls[label]) else: info_table.add(mforms.newLabel(label), 0, 1, i, i + 1, mforms.HFillFlag) if type(value) is bool or value is None: b = self.mkswitch(value) info_table.add(b, 1, 2, i, i + 1, mforms.HFillFlag | mforms.HExpandFlag) self.controls[label] = b elif type(value) is tuple: b = self.mkswitch(value[0], value[1] if value[0] else None) info_table.add(b, 1, 2, i, i + 1, mforms.HFillFlag | mforms.HExpandFlag) self.controls[label] = b else: l2 = mforms.newLabel(value or "") l2.set_style(mforms.BoldStyle) l2.set_color("#1c1c1c") info_table.add(l2, 1, 2, i, i + 1, mforms.HFillFlag | mforms.HExpandFlag) self.controls[label] = l2 info_table.add(mforms.newLabel(""), 0, 1, len(info), len(info) + 1, mforms.HFillFlag) # blank space return info_table
def make_panel_header(icon, title, subtitle, button=None): table = mforms.newTable() table.set_name(title + " Panel") table.set_row_count(2) table.set_column_count(3) table.set_row_spacing(0) table.set_column_spacing(15) image = mforms.newImageBox() image.set_name(title + " Icon") image.set_image(mforms.App.get().get_resource_path(icon)) image.set_image_align(mforms.TopCenter) table.add(image, 0, 1, 0, 2, mforms.VFillFlag | mforms.HFillFlag) label = mforms.newLabel(title) label.set_name(title) label.set_text_align(mforms.BottomLeft) label.set_style(mforms.SmallStyle) table.add(label, 1, 2, 0, 1, mforms.HFillFlag | mforms.HExpandFlag | mforms.VFillFlag) label = mforms.newLabel(subtitle) label.set_name(subtitle) label.set_text_align(mforms.TopLeft) label.set_style(mforms.VeryBigStyle) table.add(label, 1, 2, 1, 2, mforms.HFillFlag | mforms.HExpandFlag | mforms.VFillFlag) if button: table.add(button, 2, 3, 0, 2, mforms.VFillFlag | mforms.HFillFlag) return table
def create_ui(self): self.content.set_padding(20) self.content.add( mforms.newLabel( 'Select the schemas to copy to the destination server and click [Start Copy >] to start the process.' ), False, True) match_str = r"\%s\.\%s" % (self.main.plan.migrationSource._db_module. quoteIdentifier('(.+)\\'), self.main.plan.migrationSource._db_module. quoteIdentifier('(.+)\\')) self.catalog_schemata = [ schema_name for catalog_name, schema_name in ( re.match(match_str, full_name).groups() for full_name in [ x for x in self.main.plan.migrationSource.schemaNames if x not in SYSTEM_SCHEMAS ]) ] self.schema_selector = DatabaseSchemaSelector( self.catalog_schemata, tree_checked_callback=self.update_next_button) self.content.add(self.schema_selector, True, True) self.innodb_switch = mforms.newCheckBox() self.innodb_switch.set_text('Migrate MyISAM tables to InnoDB') self.innodb_switch.set_active(True) self.content.add_end(self.innodb_switch, False) self.content.add_end(mforms.newLabel(''), False) self.next_button.set_text('Start Copy >') self.next_button.set_enabled(False)
def _add_script_checkbox_option(self, box, name, caption, path_caption, browser_caption): check = mforms.newCheckBox() check.set_text(caption) box.add(check, False, True) vbox = mforms.newBox(False) vbox.set_spacing(4) file_box = mforms.newBox(True) file_box.set_spacing(4) file_box.add(mforms.newLabel(path_caption), False, True) file_entry = mforms.newTextEntry() file_entry.add_changed_callback(lambda self=self, option=name: setattr( self, name + "_check_duplicate", True)) file_box.add(file_entry, True, True) check.add_clicked_callback( lambda box=vbox, check=check: box.set_enabled(check.get_active())) button = mforms.newButton() button.set_text("Browse...") button.add_clicked_callback(lambda option=name, title=browser_caption: self._browse_files(option, title)) file_box.add(button, False, True) vbox.add(file_box, False, True) label = mforms.newLabel( "You should edit this file to add the source and target server passwords before running it." ) label.set_style(mforms.SmallHelpTextStyle) vbox.add(label, False, True) vbox.set_enabled(False) box.add(vbox, False, True) setattr(self, name + "_check_duplicate", False) setattr(self, name + "_checkbox", check) setattr(self, name + "_entry", file_entry)
def create_standard_header(self, icon, title, description, rightViewObject=None): header = mforms.newTable() header.set_row_count(2) header.set_column_count(3) header.set_row_spacing(0) header.set_column_spacing(15) header.set_padding(12) image = mforms.newImageBox() image.set_image(mforms.App.get().get_resource_path(icon)) image.set_image_align(mforms.TopCenter) label1 = mforms.newLabel(title) label1.set_text_align(mforms.BottomLeft) label1.set_style(mforms.SmallStyle) label2 = mforms.newLabel(description) label2.set_text_align(mforms.TopLeft) label2.set_style(mforms.VeryBigStyle) header.add(image, 0, 1, 0, 2, mforms.VFillFlag | mforms.HFillFlag) header.add(label1, 1, 2, 0, 1, mforms.HFillFlag | mforms.HExpandFlag | mforms.VFillFlag) header.add(label2, 1, 2, 1, 2, mforms.HFillFlag | mforms.HExpandFlag | mforms.VFillFlag) if rightViewObject: header.add(rightViewObject, 2, 3, 0, 2, mforms.VFillFlag | mforms.HFillFlag) return header
def create_ui(self): self.content.set_padding(20) self.content.add( mforms.newLabel( 'Select the schemas to copy to the destination server and click [Start Copy >] to start the process.' ), False, True) self.catalog_schemata = [ full_name.partition('.')[-1] for full_name in self.main.plan.migrationSource.schemaNames if full_name not in SYSTEM_SCHEMAS ] self.schema_selector = DatabaseSchemaSelector( self.catalog_schemata, tree_checked_callback=self.update_next_button) self.content.add(self.schema_selector, True, True) self.innodb_switch = mforms.newCheckBox() self.innodb_switch.set_text('Migrate MyISAM tables to InnoDB') self.innodb_switch.set_active(True) self.content.add_end(self.innodb_switch, False) self.content.add_end(mforms.newLabel(''), False) self.next_button.set_text('Start Copy >') self.next_button.set_enabled(False)
def setup_info_table(self, info_table, info): info_table.set_row_count(len(info)+1) for i, item in enumerate(info): (label, value) = item if self.controls.has_key(label): info_table.remove(self.controls[label]) else: info_table.add(mforms.newLabel(label), 0, 1, i, i+1, mforms.HFillFlag) if type(value) is bool or value is None: b = self.mkswitch(value) info_table.add(b, 1, 2, i, i+1, mforms.HFillFlag|mforms.HExpandFlag) self.controls[label] = b elif type(value) is tuple: b = self.mkswitch(value[0], value[1] if value[0] else None) info_table.add(b, 1, 2, i, i+1, mforms.HFillFlag|mforms.HExpandFlag) self.controls[label] = b else: l2 = mforms.newLabel(value or "") l2.set_style(mforms.BoldStyle) l2.set_color("#1c1c1c") info_table.add(l2, 1, 2, i, i+1, mforms.HFillFlag|mforms.HExpandFlag) self.controls[label] = l2 info_table.add(mforms.newLabel(""), 0, 1, len(info), len(info)+1, mforms.HFillFlag) # blank space return info_table
def __init__(self, catalog): mforms.Form.__init__(self, None, mforms.FormNormal) self.catalog = catalog self.set_title("Mockup Copy Successful") box = mforms.newBox(False) self.set_content(box) box.set_padding(12) box.set_spacing(12) label = mforms.newLabel("Click on Copy to Copy!") box.add(label, False, True) hbox = mforms.newBox(True) hbox.set_spacing(12) self.matchCount = mforms.newLabel("") hbox.add(self.matchCount, False, True) self.cancelButton = mforms.newButton() self.cancelButton.set_text("Cancel") hbox.add_end(self.cancelButton, False, True) self.okButton = mforms.newButton() self.okButton.set_text("Copy, buddy!") hbox.add_end(self.okButton, False, True) self.okButton.add_clicked_callback(self.export_table_clipboard) box.add(hbox, False, True) self.component_id = 0 self.set_size(233, 144)
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): if self.main.import_page.importer_time: itime = float("%d.%d" % (self.main.import_page.importer_time.seconds, self.main.import_page.importer_time.microseconds)) self.content.add(mforms.newLabel(str("File %s was imported in %.3f s" % (self.get_path(), itime))), False, True) self.content.add(mforms.newLabel(str("Table %s was created" % self.main.content_preview_page.table_name.get_string_value())), False, True)
def run_version_select_form(version): form = Form(Form.main_form()) top_vbox = newBox(False) top_vbox.set_padding(16) top_vbox.set_spacing(16) info_hbox = newBox(True) info_hbox.set_spacing(16) img_box = newImageBox() img_box.set_image("warning_icon.png") right_vbox = newBox(False) right_vbox.set_spacing(12) warn_label = newLabel("Server version %s is not supported by Workbench\nconfiguration file management tool." % ".".join(map(lambda x: str(x), version))) right_vbox.add(warn_label, False, False) warn_label = newLabel("Although, you can select different server version\nfor the tool to use. Suggested version " "is given\nbelow. You can either pick version or type one." ) right_vbox.add(warn_label, False, False) warn_label = newLabel("Valid version formats are X.Y.ZZ or X.Y.\nAll other variants will resort to default - 5.1.") right_vbox.add(warn_label, False, False) if (type(version) is not tuple): version = (5,1) dprint_ex(1, "Given version is not a valid tuple object") try: version_maj = int(version[0]) + int(version[1]) / 10.0 except (ValueError, IndexError), e: version_maj = 5.1
def create_ui(self): self.set_spacing(16) label = mforms.newLabel( "Table Data Import allows you to easily import csv, json datafiles.\nYou can also create destination table on the fly." ) label.set_style(mforms.BoldInfoCaptionStyle) self.content.add(label, False, False) entry_box = mforms.newBox(True) entry_box.set_spacing(5) entry_box.add(mforms.newLabel("File Path:"), False, True) self.importfile_path = mforms.newTextEntry() entry_box.add(self.importfile_path, True, True) self.importfile_path.set_value(last_location) self.importfile_browse_btn = mforms.newButton() self.importfile_browse_btn.set_text("Browse...") self.importfile_browse_btn.add_clicked_callback(self.importfile_browse) entry_box.add(self.importfile_browse_btn, False, False) self.content.add(entry_box, False, True)
def _add_script_radiobutton_option(self, box, name, caption, path_caption, browser_caption, label_caption, rid): holder = mforms.newBox(False) holder.set_spacing(4) radio = mforms.newRadioButton(rid) radio.set_text(caption) holder.add(radio, False, True) vbox = mforms.newBox(False) vbox.set_spacing(4) file_box = mforms.newBox(True) file_box.set_spacing(4) file_box.add(mforms.newLabel(path_caption), False, True) file_entry = mforms.newTextEntry() file_entry.add_changed_callback(lambda self=self, option=name: setattr(self, name + "_check_duplicate", True)) file_box.add(file_entry, True, True) radio.add_clicked_callback(self._script_radio_option_callback) button = mforms.newButton() button.set_text("Browse...") button.add_clicked_callback(lambda option=name, title=browser_caption: self._browse_files(option, title)) file_box.add(button, False, True) vbox.add(file_box, False, True) label = mforms.newLabel(label_caption) label.set_style(mforms.SmallHelpTextStyle) vbox.add(label, False, True) vbox.set_enabled(False) holder.add(vbox, False, True) box.add(holder, False, True) setattr(self, name + "_check_duplicate", False) setattr(self, name + "_radiobutton", radio) setattr(self, name + "_entry", file_entry) setattr(self, name + "_vbox", vbox)
def create_ui(self): label = mforms.newLabel( 'Welcome to the MySQL Workbench Schema Transfer Wizard') label.set_style(mforms.BigBoldStyle) self.content.add(label, False, True) self.content.set_spacing(12) self.content.set_padding(20) label = mforms.newLabel( 'The MySQL Schema Transfer Wizard helps you to move your data from an older MySQL server to the latest MySQL GA\n' + '(General Availability) version. It is meant for developer machines to get you working with the latest\n' + 'MySQL Server quickly. The data is transferred on the fly and is not based on a consistent snapshot. This\n' + 'works well for local instances that are used for development purposes. Please note that you should not\n' + 'use this tool on production MySQL instances. Production databases require a more complex data migration\n' + 'scenario in most cases.') self.content.add(label, False, True) box = mforms.newBox(True) box.add(mforms.newLabel(''), True, True) button_start = mforms.newButton() button_start.set_size(150, -1) button_start.set_text('Start the Wizard') button_start.add_clicked_callback(self.main.go_next_page) box.add(button_start, False, False) box.add(mforms.newLabel(''), True, True) self.content.add_end(box, False, True)
def make_command_box(callable, title, desc, tooltip, options = None, extra_options = None): l = mforms.newLabel(title) l.set_style(mforms.BoldStyle) self.content.add(l, False, True) l = mforms.newLabel(desc) self.content.add(l, False, True) if extra_options: self.content.add(extra_options, False, True) hb = mforms.newBox(True) hb.set_spacing(12) l = mforms.newImageBox() l.set_image(mforms.App.get().get_resource_path("mini_notice.png")) l.set_tooltip(tooltip) hb.add(l, False, True) for o in options: hb.add(o, False, True) btn = mforms.newButton() btn.add_clicked_callback(callable) btn.set_text(title.strip()) hb.add_end(btn, False, True) self._buttons.append(btn) self.content.add(hb, False, True)
def __init__(self, owner): mforms.Box.__init__(self, True) self.set_release_on_add() self.set_managed() self.owner = owner self.set_spacing(35) self.icon = mforms.newImageBox() self.icon.set_image(mforms.App.get().get_resource_path("mysql-logo-00.png")) self.add(self.icon, False, True) vbox = mforms.newBox(False) self.vbox = vbox self.add(vbox, True, True) vbox.set_spacing(2) vbox.add(mforms.newLabel("Connection Name"), False, True) self.connection_name = mforms.newLabel("?") self.connection_name.set_style(mforms.VeryBigStyle) vbox.add(self.connection_name, False, True) self.info_table = None
def __init__(self, owner): mforms.Box.__init__(self, True) self.set_release_on_add() self.set_managed() self.set_name("Connection Info Section") self.owner = owner self.set_spacing(35) self.icon = mforms.newImageBox() self.icon.set_image( mforms.App.get().get_resource_path("mysql-logo-00.png")) self.icon.set_name("Server Status Stamp") self.add(self.icon, False, True) vbox = mforms.newBox(False) self.vbox = vbox self.add(vbox, True, True) vbox.set_spacing(2) label = mforms.newLabel("Connection Name") label.set_name("Connection Name") vbox.add(label, False, True) self.connection_name = mforms.newLabel("?") self.connection_name.set_style(mforms.VeryBigStyle) self.connection_name.set_name("Connection Name Value") vbox.add(self.connection_name, False, True) self.info_table = None
def make_command_box(callable, title, desc, tooltip, options=None, extra_options=None): l = mforms.newLabel(title) l.set_style(mforms.BoldStyle) self.content.add(l, False, True) l = mforms.newLabel(desc) self.content.add(l, False, True) if extra_options: self.content.add(extra_options, False, True) hb = mforms.newBox(True) hb.set_spacing(12) l = mforms.newImageBox() l.set_image(mforms.App.get().get_resource_path("mini_notice.png")) l.set_tooltip(tooltip) hb.add(l, False, True) for o in options: hb.add(o, False, True) btn = mforms.newButton() btn.add_clicked_callback(callable) btn.set_text(title.strip()) hb.add_end(btn, False, True) self._buttons.append(btn) self.content.add(hb, False, True)
def setup_info_table(self, info_table, info, params): info_table.set_row_count(len(info)+1) for i, item in enumerate(info): (label, value_source) = item if callable(value_source): value = value_source(*params) else: value = value_source if self.controls.has_key(label): info_table.remove(self.controls[label][0]) else: info_table.add(mforms.newLabel(label), 0, 1, i, i+1, mforms.HFillFlag) if type(value) is bool or value is None: b = StateIcon() b.set_state(value) info_table.add(b, 1, 2, i, i+1, mforms.HFillFlag|mforms.HExpandFlag) self.controls[label] = (b, value_source) elif type(value) is tuple: b = StateIcon() b.set_state(value[0]) if value[0] and value[1]: b.set_text(value[1]) info_table.add(b, 1, 2, i, i+1, mforms.HFillFlag|mforms.HExpandFlag) self.controls[label] = (b, value_source) else: l2 = mforms.newLabel(value or "") l2.set_style(mforms.BoldStyle) l2.set_color("#1c1c1c") info_table.add(l2, 1, 2, i, i+1, mforms.HFillFlag|mforms.HExpandFlag) self.controls[label] = (l2, value_source) info_table.add(mforms.newLabel(""), 0, 1, len(info), len(info)+1, mforms.HFillFlag) # blank space return info_table
def create_ui(self): self.suspend_layout() self.set_spacing(16) label = mforms.newLabel("Table Data Export allows you to easily export data into CSV, JSON datafiles.\n") label.set_style(mforms.BoldInfoCaptionStyle) self.content.add(label, False, False) entry_box = mforms.newBox(True) entry_box.set_spacing(5) entry_box.add(mforms.newLabel("File Path:"), False, True) self.exportfile_path = mforms.newTextEntry() self.exportfile_path.add_changed_callback(lambda entry=self.exportfile_path: self.entry_changed(entry)) entry_box.add(self.exportfile_path, True, True) if last_location != None: self.exportfile_path.set_value(last_location) self.confirm_file_overwrite = True self.get_module(True) browse_btn = mforms.newButton() browse_btn.set_text("Browse...") browse_btn.set_name("Browse") browse_btn.add_clicked_callback(self.browse) entry_box.add(browse_btn, False, False) self.content.add(entry_box, False, True) radio_box = mforms.newBox(True) radio_box.set_spacing(8) for format in self.main.formats: fradio = mforms.newRadioButton(1) fradio.set_text(format.title) fradio.set_active(bool(self.active_module and self.active_module.name == format.name)) fradio.add_clicked_callback(lambda f = format: self.output_type_changed(f)) radio_box.add(fradio, False, True) self.radio_opts.append({'radio':fradio, 'name': format.name}) self.content.add(radio_box, False, True) self.optpanel = mforms.newPanel(mforms.TitledBoxPanel) self.optpanel.set_title("Options:") self.content.add(self.optpanel, False, True) self.optpanel.show(False) self.export_local_box = mforms.newBox(False) self.export_local_cb = mforms.newCheckBox() self.export_local_cb.set_text("Export to local machine") self.export_local_cb.set_active(True) self.export_local_box.add(self.export_local_cb, False, True) l = mforms.newLabel("""If checked, rows will be exported on the location that started Workbench.\nIf not checked, rows will be exported on the server.\nIf server and computer that started Workbench are different machines, import of that file can be done manual way only.""") l.set_style(mforms.SmallHelpTextStyle) self.export_local_box.add(l, False, True) self.content.add(self.export_local_box, False, True) self.resume_layout() self.load_module_options()
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, conn): mforms.Form.__init__(self, None) self._conn = conn self.set_title("Password Expired") vbox = mforms.newBox(False) vbox.set_padding(20) vbox.set_spacing(18) user = conn.parameterValues["userName"] l = newLabel("Password for MySQL account '%s'@%s expired.\nPlease pick a new password:"******"Mysql@", ""))) l.set_style(mforms.BoldStyle) vbox.add(l, False, True) box = mforms.newTable() box.set_padding(1) box.set_row_count(3) box.set_column_count(2) box.set_column_spacing(7) box.set_row_spacing(8) hbox = mforms.newBox(True) hbox.set_spacing(12) icon = mforms.newImageBox() icon.set_image(mforms.App.get().get_resource_path("wb_lock.png")) hbox.add(icon, False, True) hbox.add(box, True, True) vbox.add(hbox, False, True) self.old_password = mforms.newTextEntry(mforms.PasswordEntry) self.old_password.set_name("Old Password") box.add(newLabel("Old Password:"******"New Password") box.add(newLabel("New Password:"******"Confirm Password") box.add(newLabel("Confirm:", True), 0, 1, 2, 3, mforms.HFillFlag|mforms.VFillFlag) box.add(self.confirm, 1, 2, 2, 3, mforms.HFillFlag|mforms.HExpandFlag) bbox = newBox(True) bbox.set_spacing(8) self.ok = newButton() self.ok.set_text("OK") self.cancel = newButton() self.cancel.set_text("Cancel") mforms.Utilities.add_end_ok_cancel_buttons(bbox, self.ok, self.cancel) vbox.add_end(bbox, False, True) self.set_content(vbox) self.set_size(500, 300) self.center()
def setup_info_table(self, info_table, info, params): info_table.set_row_count(len(info) + 1) for i, item in enumerate(info): (label, value_source) = item if callable(value_source): value = value_source(*params) else: value = value_source if self.controls.has_key(label): info_table.remove(self.controls[label][0]) else: info_table.add(mforms.newLabel(label), 0, 1, i, i + 1, mforms.VFillFlag | mforms.HFillFlag) is_gtid_mode_setable = label == 'GTID Mode:' and self.ctrl_be.target_version >= Version( 5, 7, 6) if type(value) is bool or value is None: b = StateIcon() b.set_state(value) info_table.add( b, 1, 2, i, i + 1, mforms.HFillFlag | mforms.HExpandFlag | mforms.VFillFlag) self.controls[label] = (b, value_source) elif type(value) is tuple: b = StateIcon() b.set_state(value[0]) if value[0] and value[1]: b.set_text(value[1]) info_table.add( b, 1, 2, i, i + 1, mforms.HFillFlag | mforms.HExpandFlag | mforms.VFillFlag) self.controls[label] = (b, value_source) else: if is_gtid_mode_setable: self.gtid_mode_selector = mforms.newSelector() self.gtid_mode_selector.add_items( ["OFF", "UPGRADE_STEP_1", "UPGRADE_STEP_1", "ON"]) self.gtid_mode_selector.set_selected( self.gtid_mode_selector.index_of_item_with_title( value_source)) self.gtid_mode_selector.add_changed_callback( self._gtid_mode_changed) info_table.add( self.gtid_mode_selector, 1, 2, i, i + 1, mforms.HFillFlag | mforms.HExpandFlag | mforms.VFillFlag) self.controls[label] = (self.gtid_mode_selector, value_source) else: l2 = mforms.newLabel(value or "") l2.set_style(mforms.BoldStyle) l2.set_color("#1c1c1c") info_table.add( l2, 1, 2, i, i + 1, mforms.HFillFlag | mforms.HExpandFlag | mforms.VFillFlag) self.controls[label] = (l2, value_source) info_table.add(mforms.newLabel(""), 0, 1, len(info), len(info) + 1, mforms.HFillFlag) # blank space return info_table
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 create_ui(self): self.suspend_layout() self.set_spacing(16) label = mforms.newLabel("Table Data Export allows you to easily export data into csv, json datafiles.\n") label.set_style(mforms.BoldInfoCaptionStyle) self.content.add(label, False, False) entry_box = mforms.newBox(True) entry_box.set_spacing(5) entry_box.add(mforms.newLabel("File Path:"), False, True) self.exportfile_path = mforms.newTextEntry() self.exportfile_path.add_changed_callback(lambda entry=self.exportfile_path: self.entry_changed(entry)) entry_box.add(self.exportfile_path, True, True) if last_location != None: self.exportfile_path.set_value(last_location) self.confirm_file_overwrite = True self.get_module(True) browse_btn = mforms.newButton() browse_btn.set_text("Browse...") browse_btn.add_clicked_callback(self.browse) entry_box.add(browse_btn, False, False) self.content.add(entry_box, False, True) radio_box = mforms.newBox(True) radio_box.set_spacing(8) for format in self.main.formats: fradio = mforms.newRadioButton(1) fradio.set_text(format.title) fradio.set_active(bool(self.active_module and self.active_module.name == format.name)) fradio.add_clicked_callback(lambda f = format: self.output_type_changed(f)) radio_box.add(fradio, False, False) self.radio_opts.append({'radio':fradio, 'name': format.name}) self.content.add(radio_box, False, False) self.optpanel = mforms.newPanel(mforms.TitledBoxPanel) self.optpanel.set_title("Options:") self.content.add(self.optpanel, False, True) self.optpanel.show(False) self.export_local_box = mforms.newBox(False) self.export_local_cb = mforms.newCheckBox() self.export_local_cb.set_text("Export to local machine") self.export_local_cb.set_active(True) self.export_local_box.add(self.export_local_cb, False, True) l = mforms.newLabel("""If checked rows will be exported on the location that started Workbench.\nIf not checked, rows will be exported on the server.\nIf server and computer that started Workbench are different machines, import of that file can be done manual way only.""") l.set_style(mforms.SmallHelpTextStyle) self.export_local_box.add(l, False, True) self.content.add(self.export_local_box, False, True) self.resume_layout() self.load_module_options()
def add_label_row(self, row, label, help): control = mforms.newTextEntry() self.table.add(mforms.newLabel(label, True), 0, 1, row, row+1, mforms.HFillFlag) self.table.add(control, 1, 2, row, row+1, mforms.HFillFlag|mforms.HExpandFlag) l = mforms.newLabel(help) l.set_style(mforms.SmallHelpTextStyle) self.table.add(l, 2, 3, row, row+1, mforms.HFillFlag) control.set_size(100, -1) return row+1, control
def make_line(self, caption, name): i = len(self.labels) l = mforms.newLabel(caption) l.set_text_align(mforms.MiddleLeft) l.set_style(mforms.BoldStyle) self.add(l, 0, 1, i, i+1, mforms.HFillFlag|mforms.HExpandFlag) l = mforms.newLabel("") self.add(l, 1, 2, i, i+1, mforms.HFillFlag|mforms.HExpandFlag) self.labels[name] = l
def stradd(table, y, label, value): t = mforms.newLabel(label) table.add(t, 0, 1, y, y+1, mforms.HFillFlag) t = mforms.newLabel(value) t.set_style(mforms.BoldStyle) t.set_color("#555555") table.add(t, 1, 2, y, y+1, mforms.HFillFlag) return t
def __init__(self, conn): mforms.Form.__init__(self, None) self._conn = conn self.set_title("Password Expired") vbox = mforms.newBox(False) vbox.set_padding(20) vbox.set_spacing(18) user = conn.parameterValues["userName"] l = newLabel("Password for MySQL account '%s'@%s expired.\nPlease pick a new password:"******"Mysql@", ""))) l.set_style(mforms.BoldStyle) vbox.add(l, False, True) box = mforms.newTable() box.set_padding(1) box.set_row_count(3) box.set_column_count(2) box.set_column_spacing(7) box.set_row_spacing(8) hbox = mforms.newBox(True) hbox.set_spacing(12) icon = mforms.newImageBox() icon.set_image(mforms.App.get().get_resource_path("wb_lock.png")) hbox.add(icon, False, True) hbox.add(box, True, True) vbox.add(hbox, False, True) self.old_password = mforms.newTextEntry(mforms.PasswordEntry) box.add(newLabel("Old Password:"******"New Password:"******"Confirm:", True), 0, 1, 2, 3, mforms.HFillFlag) box.add(self.confirm, 1, 2, 2, 3, mforms.HFillFlag|mforms.HExpandFlag) bbox = newBox(True) bbox.set_spacing(8) self.ok = newButton() self.ok.set_text("OK") self.cancel = newButton() self.cancel.set_text("Cancel") mforms.Utilities.add_end_ok_cancel_buttons(bbox, self.ok, self.cancel) vbox.add_end(bbox, False, True) self.set_content(vbox) self.set_size(500, 260) self.center()
def create_ui(self): if self.main.import_progress_page.import_time: itime = float("%d.%d" % (self.main.import_progress_page.import_time.seconds, self.main.import_progress_page.import_time.microseconds)) self.content.add(mforms.newLabel(str("File %s was imported in %.3f s" % (self.get_path(), itime))), False, True) self.content.add(mforms.newLabel(str("Table %s.%s %s" % (self.main.destination_table['schema'], self.main.destination_table['table'], "has been used" if self.main.destination_page.existing_table_radio.get_active() else "was created"))), False, True) self.content.add(mforms.newLabel(str("%d records imported" % self.main.import_progress_page.module.item_count)), False, True)
def stradd(table, y, label, value): t = mforms.newLabel(label + ":") t.set_name(label) table.add(t, 0, 1, y, y + 1, mforms.VFillFlag | mforms.HFillFlag) t = mforms.newLabel(value) t.set_style(mforms.BoldStyle) t.set_name(label + " Value") table.add(t, 1, 2, y, y + 1, mforms.VFillFlag | mforms.HFillFlag) return t
def __init__(self, main): WizardPage.__init__(self, main, "Target Creation Options") self.main.add_wizard_page(self, "OBJECT MIGRATION", "Target Creation Options") label = mforms.newLabel("Select options for the creation of the migrated schema in the target\nMySQL server and click [Next >] to execute.") self.content.add(label, False, True) panel = mforms.newPanel(mforms.TitledBoxPanel) panel.set_title("Schema Creation") self.content.add(panel, False, True) box = mforms.newBox(False) panel.add(box) box.set_padding(12) self._create_db = mforms.newCheckBox() self._create_db.set_text("Create schema in target RDBMS") box.add(self._create_db, False, True) # spacer box.add(mforms.newLabel(""), False, True) self._create_script = mforms.newCheckBox() self._create_script.set_text("Create a SQL script file") self._create_script.add_clicked_callback(self._toggle_sql_script) box.add(self._create_script, False, True) self._file_hbox = mforms.newBox(True) self._file_hbox.set_spacing(4) self._file_hbox.add(mforms.newLabel("Script File:"), False, True) self._create_script_file = mforms.newTextEntry() self._create_script_file.set_value(os.path.join(os.path.expanduser('~'), 'migration_script.sql')) self._file_hbox.add(self._create_script_file, True, True) button = mforms.newButton() button.set_text("Browse...") button.add_clicked_callback(self._browse_files) self._file_hbox.add(button, False, True) box.add(self._file_hbox, False, True) panel = mforms.newPanel(mforms.TitledBoxPanel) panel.set_title("Options") self.content.add(panel, False, True) box = mforms.newBox(False) panel.add(box) box.set_padding(12) box.set_spacing(8) self._keep_schema = mforms.newCheckBox() self._keep_schema.set_text("Keep schemata if they already exist. Objects that already exist will not be recreated or updated.") box.add(self._keep_schema, False, True) self._create_db.set_active(True) self._toggle_sql_script() self._check_file_duplicate = True
def __init__(self, main): WizardPage.__init__(self, main, "Target Creation Options") self.main.add_wizard_page(self, "ObjectMigration", "Target Creation Options") label = mforms.newLabel("Select options for the creation of the migrated schema in the target\nMySQL server and click [Next >] to execute.") self.content.add(label, False, True) panel = mforms.newPanel(mforms.TitledBoxPanel) panel.set_title("Schema Creation") self.content.add(panel, False, True) box = mforms.newBox(False) panel.add(box) box.set_padding(12) self._create_db = mforms.newCheckBox() self._create_db.set_text("Create schema in target RDBMS") box.add(self._create_db, False, True) # spacer box.add(mforms.newLabel(""), False, True) self._create_script = mforms.newCheckBox() self._create_script.set_text("Create a SQL script file") self._create_script.add_clicked_callback(self._toggle_sql_script) box.add(self._create_script, False, True) self._file_hbox = mforms.newBox(True) self._file_hbox.set_spacing(4) self._file_hbox.add(mforms.newLabel("Script File:"), False, True) self._create_script_file = mforms.newTextEntry() self._create_script_file.set_value(os.path.join(os.path.expanduser('~'), 'migration_script.sql')) self._file_hbox.add(self._create_script_file, True, True) button = mforms.newButton() button.set_text("Browse...") button.add_clicked_callback(self._browse_files) self._file_hbox.add(button, False, True) box.add(self._file_hbox, False, True) panel = mforms.newPanel(mforms.TitledBoxPanel) panel.set_title("Options") self.content.add(panel, False, True) box = mforms.newBox(False) panel.add(box) box.set_padding(12) box.set_spacing(8) self._keep_schema = mforms.newCheckBox() self._keep_schema.set_text("Keep schemas if they already exist. Objects that already exist will not be recreated or updated.") box.add(self._keep_schema, False, True) self._create_db.set_active(True) self._toggle_sql_script() self._check_file_duplicate = True
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 no_remote_admin_warning_label(server_instance_settings): if server_instance_settings.uses_ssh: warning = newLabel("There is no SSH connection to the server.\nTo use this functionality, the server where MySQL is located must have a SSH server running\nand you must provide its login information in the server profile.") else: if server_instance_settings.uses_wmi: warning = newLabel("There is no WMI connection to the server.\nTo use this functionality, the server where MySQL is located must be configured to use WMI\nand you must provide its login information in the server profile.") else: warning = newLabel("Remote Administration is disabled.\nTo use this functionality, the server where MySQL is located must either have an SSH server running\nor alternatively, if it is a Windows machine, must have WMI enabled.\nAdditionally you must enable remote administration in the server profile, providing login details for it.") warning.set_style(mforms.BigStyle) warning.set_text_align(mforms.MiddleCenter) return warning
def create_ui(self): self.suspend_layout() self.set_spacing(16) self.content.set_spacing(16) colbox = mforms.newBox(False) colbox.set_spacing(8) colbox.add(mforms.newLabel("Select columns you'd like to export"), False, True) self.column_list = newTreeView(mforms.TreeFlatList) self.column_list.add_column(mforms.CheckColumnType, "Export", 50, True) self.column_list.add_column(mforms.StringColumnType, "Column name", self.owner.main.get_width(), False) self.column_list.end_columns() self.column_list.set_allow_sorting(True) self.column_list.set_size(200, -1) colbox.add(self.column_list, True, True) limit_box = mforms.newBox(True) limit_box.set_spacing(8) limit_box.add(mforms.newLabel("Count: "), False, False) self.limit_entry = mforms.newTextEntry() self.limit_entry.set_size(50, -1) self.limit_entry.add_changed_callback( lambda entry=self.limit_entry: self.entry_changed(entry)) limit_box.add(self.limit_entry, False, False) offset_box = mforms.newBox(True) offset_box.set_spacing(8) offset_box.add(mforms.newLabel("Row Offset: "), False, False) self.offset_entry = mforms.newTextEntry() self.offset_entry.set_size(50, -1) self.offset_entry.add_changed_callback( lambda entry=self.offset_entry: self.entry_changed(entry)) offset_box.add(self.offset_entry, False, False) sellall_cb = mforms.newCheckBox() sellall_cb.set_text("Select / Deselect all entries") sellall_cb.set_active(True) sellall_cb.add_clicked_callback( lambda cb=sellall_cb: self.sell_all(cb)) limit_offset = mforms.newBox(True) limit_offset.set_spacing(8) limit_offset.add(sellall_cb, False, True) limit_offset.add_end(limit_box, False, True) limit_offset.add_end(offset_box, False, True) colbox.add(limit_offset, False, True) self.content.add(colbox, True, True) self.resume_layout()
def __init__(self, conn): mforms.Form.__init__(self, None) self._conn = conn self.set_title("Password Expired") vbox = mforms.newBox(False) vbox.set_padding(12) box = mforms.newTable() box.set_row_count(4) box.set_column_count(2) box.set_column_spacing(8) box.set_row_spacing(12) vbox.add(box, True, True) user = conn.parameterValues["userName"] box.add( newLabel( "Password for MySQL account '%s' from %s is expired\nand must be changed before the account can be used.\n\nPlease pick a new password:"******"Mysql@", ""))), 0, 2, 0, 1, 0) self.old_password = mforms.newTextEntry(mforms.PasswordEntry) box.add(newLabel("Old Password:"******"New Password:"******"Confirm:", True), 0, 1, 3, 4, mforms.HFillFlag) box.add(self.confirm, 1, 2, 3, 4, mforms.HFillFlag | mforms.HExpandFlag) bbox = newBox(True) bbox.set_spacing(8) self.ok = newButton() self.ok.set_text("OK") self.cancel = newButton() self.cancel.set_text("Cancel") mforms.Utilities.add_end_ok_cancel_buttons(bbox, self.ok, self.cancel) vbox.add_end(bbox, False, True) self.set_content(vbox) self.set_size(500, 240) self.center()
def search(self, grid_name): tBox = PropelForm.spaced_box(True) self.widgets[grid_name + '_search_label'] = mforms.newLabel("table pattern") tBox.add(self.widgets[grid_name + '_search_label'], False, True) self.widgets[grid_name + '_search_pattern'] = mforms.newTextEntry() tBox.add(self.widgets[grid_name + '_search_pattern'], True, True) self.widgets[grid_name + '_search_button'] = mforms.newButton() self.widgets[grid_name + '_search_button'].set_text("matching tables") self.widgets[grid_name + '_search_match_count'] = mforms.newLabel("") self.widgets[grid_name + '_search_button'].add_clicked_callback(lambda: self.find_rows(0)) tBox.add(self.widgets[grid_name + '_search_button'], False, True) tBox.add(self.widgets[grid_name + '_search_match_count'], False, True) self.add(tBox, False, True)
def create_ui(self): self.set_spacing(16) self.content.add(self.schema_label, False, True) entry_box = mforms.newBox(True) entry_box.set_spacing(5) entry_box.add(mforms.newLabel("File Path:"), False, True) self.shapefile_path = mforms.newTextEntry() entry_box.add(self.shapefile_path, True, True) self.shapefile_browse_btn = newButton() self.shapefile_browse_btn.set_text("Browse...") self.shapefile_browse_btn.add_clicked_callback(self.shapefile_browse) entry_box.add(self.shapefile_browse_btn, False, False) self.content.add(entry_box, False, True) label = mforms.newLabel("""Select a shapefile containing spatial data to load into MySQL. A new table with the imported fields will be created in the selected schema, unless the append or update options are specified.""") self.content.add(label, False, False) self.dbf_box = mforms.newBox(True) self.dbf_box.set_spacing(8) self.dbf_icon = mforms.newImageBox() self.dbf_icon.set_image("task_unchecked%s.png" % os_icon_suffix) self.dbf_box.add(self.dbf_icon, False, True) dbf_label = mforms.newLabel("Check if dbf file is present") self.dbf_box.add(dbf_label, True, True) self.dbf_box.show(True) self.content.add(self.dbf_box, False, True) self.proj_box = mforms.newBox(True) self.proj_box.set_spacing(8) self.proj_icon = mforms.newImageBox() self.proj_icon.set_image("task_unchecked%s.png" % os_icon_suffix) self.proj_box.add(self.proj_icon, False, True) proj_label = mforms.newLabel("Check if prj file is present") self.proj_box.add(proj_label, True, True) self.proj_box.show(True) self.content.add(self.proj_box, False, True) self.warning_srs = mforms.newLabel("") self.content.add(self.warning_srs, False, True)
def create_ui(self): self.suspend_layout() self.set_spacing(16) self.content.set_spacing(16) colbox = mforms.newBox(False) colbox.set_spacing(8) colbox.add(mforms.newLabel("Select columns you'd like to export"), False, True) self.column_list = newTreeNodeView(mforms.TreeFlatList) self.column_list.add_column(mforms.CheckColumnType, "Export", 50, True) self.column_list.add_column(mforms.StringColumnType, "Column name", self.owner.main.get_width(), False) self.column_list.end_columns() self.column_list.set_allow_sorting(True) self.column_list.set_size(200, -1) colbox.add(self.column_list, True, True) limit_box = mforms.newBox(True) limit_box.set_spacing(8) limit_box.add(mforms.newLabel("Count: "), False, False) self.limit_entry = mforms.newTextEntry() self.limit_entry.set_size(50, -1) self.limit_entry.add_changed_callback(lambda entry=self.limit_entry: self.entry_changed(entry)) limit_box.add(self.limit_entry, False, False) offset_box = mforms.newBox(True) offset_box.set_spacing(8) offset_box.add(mforms.newLabel("Row Offset: "), False, False) self.offset_entry = mforms.newTextEntry() self.offset_entry.set_size(50, -1) self.offset_entry.add_changed_callback(lambda entry=self.offset_entry: self.entry_changed(entry)) offset_box.add(self.offset_entry, False, False) sellall_cb = mforms.newCheckBox() sellall_cb.set_text("Select / Deselect all entries") sellall_cb.set_active(True) sellall_cb.add_clicked_callback(lambda cb = sellall_cb: self.sell_all(cb)) limit_offset = mforms.newBox(True) limit_offset.set_spacing(8) limit_offset.add(sellall_cb, False, True) limit_offset.add_end(limit_box, False, True) limit_offset.add_end(offset_box, False, True) colbox.add(limit_offset, False, True) self.content.add(colbox, True, True) self.resume_layout()
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 __init__(self, icon, title, text, button1, button2=None): mforms.Table.__init__(self) self.set_managed() self.set_release_on_add() self.set_padding(-1) # center contents self.set_column_spacing(12) self.set_row_spacing(12) self.set_row_count(3) self.set_column_count(2) if icon: image = mforms.newImageBox() image.set_image(mforms.App.get().get_resource_path(icon)) self.add(image, 0, 1, 0, 3, 0) self._label = mforms.newLabel(title) self._label.set_style(mforms.BigBoldStyle) self._label.set_text_align(mforms.MiddleCenter) self.add(self._label, 1, 2, 0, 1, mforms.HFillFlag) self.add(mforms.newLabel(text), 1, 2, 1, 2, mforms.HFillFlag) if button1 or button2: bbox = mforms.newBox(True) bbox.set_spacing(12) if button1: button_caption, button_action = button1 self._button = mforms.newButton() self._button.set_text(button_caption) self._button.add_clicked_callback(button_action) bbox.add_end(self._button, False, True) else: self._button = None if button2: button_caption, button_action = button2 self._alt_button = mforms.newButton() self._alt_button.set_text(button_caption) self._alt_button.add_clicked_callback(button_action) bbox.add_end(self._alt_button, False, True) else: self._alt_button = None if button1 or button2: self.add(bbox, 1, 2, 2, 3, 0)
def __init__(self, main): WizardPage.__init__(self, main, 'Schemata Selection') self._ui_created = False self.main.add_wizard_page(self, 'SourceTarget', 'Schemata Selection') optionspanel = mforms.newPanel(mforms.TitledBoxPanel) optionspanel.set_title('Schema Name Mapping Method') optionsbox = mforms.newBox(False) optionsbox.set_padding(8) optionsbox.set_spacing(8) optionsbox.add(mforms.newLabel('Choose how the reverse engineered schemata and objects should be mapped.\n'), False) options = [ 'Keep schemata as they are: Catalog.Schema.Table -> Schema.Table', 'Only one schema: Catalog.Schema.Table -> Catalog.Table', 'Only one schema, keep current schema names as a prefix: Catalog.Schema.Table -> Catalog.Schema_Table', ] rid = mforms.RadioButton.new_id() self.options = [] for opt in options: radio_button = mforms.newRadioButton(rid) radio_button.set_text(opt) optionsbox.add(radio_button, False) self.options.append(radio_button) self.options[1].set_active(True) optionspanel.add(optionsbox) self._optionspanel = optionspanel #self._advanced_shown = False #self._optionspanel.show(False) self.content.add_end(optionspanel, False)
def review_sql_code(code): form = mforms.Form(mforms.Form.main_form(), mforms.FormNormal) form.set_title("Review SQL Code to Execute") box = mforms.newBox(False) box.set_padding(12) form.set_content(box) box.set_spacing(8) box.add(mforms.newLabel("Review the SQL code to be executed."), False, True) editor = mforms.CodeEditor() box.add(editor, True, True) editor.set_language(mforms.LanguageMySQL) editor.set_text(code) editor.set_features(mforms.FeatureReadOnly, True) ok = mforms.newButton() ok.set_text("Execute") cancel = mforms.newButton() cancel.set_text("Cancel") bbox = mforms.newBox(True) bbox.set_spacing(8) bbox.add_end(ok, False, True) bbox.add_end(cancel, False, True) box.add_end(bbox, False, True) form.set_size(500, 360) return form.run_modal(ok, cancel)
def create_ui(self): self.suspend_layout() self.set_spacing(16) self.simple_export_box = mforms.newBox(False) self.simple_export_box.set_spacing(16) label = mforms.newLabel("Select source table for export.") label.set_style(mforms.BoldInfoCaptionStyle) self.simple_export_box.add(label, False, True) self.source_table_sel = mforms.newSelector() self.source_table_sel.set_size(self.get_width(), -1) self.preload_existing_tables() sorted_keys = self.table_list.keys() sorted_keys.sort() self.source_table_sel.add_items(sorted_keys) table_name = "%s.%s" % (self.main.source_table['schema'], self.main.source_table['table']) if table_name in self.table_list.keys(): self.source_table_sel.set_selected(sorted_keys.index(table_name)) self.source_table_sel.add_changed_callback(lambda selector = self.source_table_sel: self.source_table_changed(selector.get_string_value())) self.simple_export_box.add(self.source_table_sel, False, True) self.simple_export = SimpleTabExport(self.main.editor, self) self.simple_export_box.add(self.simple_export, True, True) self.content.add(self.simple_export_box, True, True) self.advanced_export = AdvancedTabExport(self.main.editor, self) self.advanced_export.show(False) self.content.add(self.advanced_export, True, True) self.resume_layout() self.preload_table_info()
def create_ui(self): self.back_button.set_enabled(False) # Main layout structure self.server_instance_box = mforms.newBox(False) self.server_instance_box.set_spacing(8) instance_label = mforms.newLabel('Source RDBMS Connection Parameters') instance_label.set_style(mforms.BoldStyle) self.server_instance_box.add(instance_label, False, True) # Add the view that corresponds to the selected RDBMS: self.panel = grt.classes.ui_db_ConnectPanel() self.panel.initializeWithRDBMSSelector(grt.root.wb.rdbmsMgmt, self.supported_sources_instances) if not self.panel.view: raise Exception("NO PANEL!!!") view = mforms.fromgrt(self.panel.view) self.server_instance_box.add(view, True, True) box = mforms.newBox(True) self._store_connection_check = mforms.newCheckBox() self._store_connection_check.set_text("Store connection for future usage as ") self._store_connection_check.add_clicked_callback(self._toggle_store_connection) box.add(self._store_connection_check, False, False) self._store_connection_entry = mforms.newTextEntry() box.add(self._store_connection_entry, True, True) self._store_connection_entry.set_enabled(False) self.server_instance_box.add(box, False, False) self.content.add(self.server_instance_box, True, True) self.advanced_button.set_text("Test Connection")
def create_ui(self): # Main layout structure self.server_instance_box = mforms.newBox(False) self.server_instance_box.set_spacing(8) instance_label = mforms.newLabel('Target RDBMS Connection Parameters') instance_label.set_style(mforms.BoldStyle) self.server_instance_box.add(instance_label, False, True) # TODO: Enable the export to script option in future versions: # self.just_script_choice = mforms.newCheckBox() # self.just_script_choice.set_text('Do not use a live instance (SQL script output)') # self.just_script_choice.set_tooltip('Check this if you just want an output script to execute it later') # self.just_script_choice.add_clicked_callback(self.just_script_toggled) # self.server_instance_box.add(self.just_script_choice, False) # Add the view that corresponds to the selected RDBMS: self.panel = grt.classes.ui_db_ConnectPanel() self.panel.initialize(grt.root.wb.rdbmsMgmt) view = mforms.fromgrt(self.panel.view) self.server_instance_box.add(view, True, True) box = mforms.newBox(True) self._store_connection_check = mforms.newCheckBox() self._store_connection_check.set_text("Store connection for future usage as ") self._store_connection_check.add_clicked_callback(self._toggle_store_connection) box.add(self._store_connection_check, False, False) self._store_connection_entry = mforms.newTextEntry() box.add(self._store_connection_entry, True, True) self._store_connection_entry.set_enabled(False) self.server_instance_box.add(box, False, False) self.content.add(self.server_instance_box, True, True) self.advanced_button.set_text("Test Connection")
def create_ui(self): box = mforms.newBox(False) box.set_spacing(12) box.set_padding(12) message = "These options allow you to configure the process. You can use default parameters\n" message += "instead of providing your own, allow the generation of the certificates and determine\n" message += "whether to update the connection settings or not." label = mforms.newLabel(message) box.add(label, False, True) box.add(self.use_default_parameters, False, True) box.add(self.generate_files, False, True) box.add(self.update_connection, False, True) button_box = mforms.newBox(True) button_box.set_spacing(12) button_box.set_padding(12) button_box.add(self.clear_button, False, True) self.content.add(box, False, True) self.content.add(button_box, False, True) box.show(True)