本文整理汇总了Python中workbench.ui.WizardPage类的典型用法代码示例。如果您正苦于以下问题:Python WizardPage类的具体用法?Python WizardPage怎么用?Python WizardPage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WizardPage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: go_next
def go_next(self):
self.main.plan.state.objectCreationParams["KeepSchemata"] = self._keep_schema.get_active()
self.main.plan.state.objectCreationParams["CreateInDB"] = self._create_db.get_active()
if self._create_script.get_active():
path = self._create_script_file.get_string_value()
if not path or not os.path.isdir(os.path.dirname(path)):
mforms.Utilities.show_error("Create Script File", "Create Script File option was enabled, but the provided path is invalid.\nPlease correct and retry.",
"OK", "", "")
return
if os.path.isdir(path):
mforms.Utilities.show_error("Create Script File", "'%s' is a directory name. Please provide a file name for saving the script as and retry." % path,
"OK", "", "")
return
if os.path.exists(path) and self._check_file_duplicate:
if mforms.Utilities.show_error("Create Script File", "The file '%s' provided for the SQL script already exists. Do you want to replace it?" % path,
"Replace", "Cancel", "") == mforms.ResultCancel:
return
self.main.plan.state.objectCreationParams["CreateSQLFile"] = path
elif self.main.plan.state.objectCreationParams.has_key("CreateSQLFile"):
del self.main.plan.state.objectCreationParams["CreateSQLFile"]
WizardPage.go_next(self)
示例2: __init__
def __init__(self, main):
WizardPage.__init__(self, main, "Manual Editing", wide=True)
self.main.add_wizard_page(self, "ObjectMigration", "Manual Editing")
self._object_dict = {}
self._source_objects_with_errors = set()
self.error_count, self.warning_count = 0, 0
示例3: page_activated
def page_activated(self, advancing):
if advancing:
if self.main.plan.state.objectCreationParams.get("CreateInDB", True):
self._copy_db.set_active(True)
else:
self._copy_db.set_active(False)
self.refresh_table_list()
for k in self.main.plan.state.dataBulkTransferParams.keys():
del self.main.plan.state.dataBulkTransferParams[k]
if sys.platform == "win32":
filename = mforms.Utilities.get_special_folder(mforms.Desktop) + "\\copy_migrated_tables.cmd"
else:
filename = mforms.Utilities.get_special_folder(mforms.Desktop) + "/copy_migrated_tables.sh"
self.copy_script_entry.set_value(filename)
self.copy_script_check_duplicate = True
source_os = self.main.plan.migrationSource.get_os()
if not source_os:
self.bulk_copy_script_radiobutton.set_enabled(False)
bulk_copy_filename = ""
grt.send_warning("Cannot get operating system of source server.")
elif source_os == "windows":
bulk_copy_filename = os.path.join(
mforms.Utilities.get_special_folder(mforms.Desktop), "bulk_copy_tables.cmd"
)
else:
bulk_copy_filename = os.path.join(
mforms.Utilities.get_special_folder(mforms.Desktop), "bulk_copy_tables.sh"
)
self.bulk_copy_script_entry.set_value(bulk_copy_filename)
self.bulk_copy_script_check_duplicate = True
WizardPage.page_activated(self, advancing)
示例4: page_activated
def page_activated(self, advancing):
WizardPage.page_activated(self, advancing)
if advancing:
self.doesSupportCatalogs = self.main.plan.migrationSource.rdbms.doesSupportCatalogs
if self.doesSupportCatalogs:
catalog_schemata_list = [ (catalog_name, schema_name) for catalog_name, dot, schema_name in (full_name.rpartition('.')
for full_name in self.main.plan.migrationSource.schemaNames) ]
self.catalog_schemata = {}
for catalog_name, schema_name in catalog_schemata_list:
self.catalog_schemata.setdefault(catalog_name, []).append(schema_name)
self.catalog_schemata = self.catalog_schemata.items()
self._optionspanel.show(True)
#self.advanced_button.show(True)
else:
self.catalog_schemata = [ schema_name for catalog_name, dot, schema_name in (full_name.rpartition('.')
for full_name in self.main.plan.migrationSource.schemaNames) ]
self._optionspanel.show(False)
#self.advanced_button.show(False)
if self.schema_selector:
self.content.remove(self.schema_selector)
self.schema_selector = DatabaseSchemaSelector(self.catalog_schemata, tree_checked_callback=self.update_next_button)
self.content.add(self.schema_selector, True, True)
self.next_button.set_enabled(False)
示例5: page_activated
def page_activated(self, advancing):
WizardPage.page_activated(self, advancing)
if advancing:
self.doesSupportCatalogs = self.main.plan.migrationSource.rdbms.doesSupportCatalogs
match_str = r"\%s\.\%s" % (self.main.plan.migrationSource._db_module.quoteIdentifier('(.+)\\'), self.main.plan.migrationSource._db_module.quoteIdentifier('(.+)\\'))
if self.doesSupportCatalogs > 0:
catalog_schemata_list = [ (catalog_name, schema_name) for catalog_name, schema_name in (re.match(match_str, full_name).groups()
for full_name in self.main.plan.migrationSource.schemaNames) ]
self.catalog_schemata = {}
for catalog_name, schema_name in catalog_schemata_list:
self.catalog_schemata.setdefault(catalog_name, []).append(schema_name)
self.catalog_schemata = self.catalog_schemata.items()
self._optionspanel.show(True)
#self.advanced_button.show(True)
else:
self.catalog_schemata = [ schema_name for catalog_name, schema_name in (re.match(match_str, full_name).groups()
for full_name in self.main.plan.migrationSource.schemaNames) ]
self._optionspanel.show(False)
#self.advanced_button.show(False)
if self.schema_selector:
self.content.remove(self.schema_selector)
self.schema_selector = DatabaseSchemaSelector(self.catalog_schemata, tree_checked_callback=self.update_next_button)
self.content.add(self.schema_selector, True, True)
self.next_button.set_enabled(False)
示例6: __init__
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)
示例7: __init__
def __init__(self, main):
WizardPage.__init__(self, main, "Source Objects")
self.main.add_wizard_page(self, "ObjectMigration", "Source Objects")
self._scrollpanel = None
label = mforms.newLabel("You may select the objects to be migrated in the lists below.\nAll tables will be migrated by default.")
self.content.add(label, False, True)
示例8: __init__
def __init__(self, owner):
WizardPage.__init__(self, owner, "Select File to Import", wide=True)
self.schema_label = mforms.newLabel("Target schema: ")
self.back_button.set_enabled(False)
self.ogrinfo_missing = True
self.ogr2ogr_missing = True
示例9: __init__
def __init__(self, main):
WizardPage.__init__(self, main, 'Schema Mappings')
self.main.add_wizard_page(self, 'OBJECT MIGRATION', 'Schema Mappings')
self.schemata = None
self.rid = mforms.RadioButton.new_id()
self.options = []
示例10: __init__
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")
示例11: page_activated
def page_activated(self, advancing):
if advancing:
self.generate_migration_report()
if "GenerateBulkCopyScript" in self.main.plan.state.dataBulkTransferParams.keys():
self.advanced_button.set_text("Open folder that contain generated script")
self.advanced_button.show(True)
else:
self.advanced_button.show(False)
WizardPage.page_activated(self, advancing)
示例12: __init__
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
示例13: __init__
def __init__(self, owner):
WizardPage.__init__(self, owner, "Select output file location")
if self.main.formats:
self.active_module = self.main.formats[0] # We set first module as the active one
else:
self.active_module = None
self.unsupported_output_format = False
self.confirm_file_overwrite = False
self.radio_opts = []
self.optbox = None
self.destination_file_checked = False
示例14: __init__
def __init__(self, owner, sql_text):
WizardPage.__init__(self, owner, 'Review Generated Migration(s)')
self.save_button = mforms.newButton()
self.save_button.enable_internal_padding(True)
self.save_button.set_text('Save Migration(s) to Folder...')
self.save_button.set_tooltip('Select the folder to save your migration(s) to.')
self.save_button.add_clicked_callback(self.save_clicked)
self.sql_text = mforms.newCodeEditor()
self.sql_text.set_language(mforms.LanguageMySQL)
self.sql_text.set_text(sql_text)
开发者ID:edencker,项目名称:mysql-workbench-export-laravel-5-migrations,代码行数:12,代码来源:export-laravel-5-migrations.py
示例15: __init__
def __init__(self, owner):
WizardPage.__init__(self, owner, "Configure Import Settings", wide=True)
self.last_analyze_status = False
self.input_file_type = 'csv'
self.active_module = self.main.formats[0] # csv
self.encoding_list = {'cp1250 (windows-1250)':'cp1250',
'latin2 (iso8859-2)':'iso8859_2',
'latin1 (iso8859-1)':'latin_1',
'utf-8':'utf-8',
'utf-16':'utf-16'}
self.dest_cols = []
self.column_mapping = []
self.ds_show_count = 0
self.df_show_count = 0
self.opts_mapping = {}