コード例 #1
0
    def __init__(self, main, header_label, wide=False, no_buttons=False):
        mforms.Box.__init__(self, False)
        self.set_managed()
        self.set_release_on_add()

        self.skip_this_page = False
        self.ui_created = False
        self.main = main

        self._identifier = "    " + header_label

        self.set_back_color("")  # Make the page transparent.
        self.container = mforms.newBox(True)

        # Main content
        self.content = mforms.newBox(False)
        self.content.set_spacing(12)
        self.content.set_padding(24)
        if not wide:
            self.content.set_size(800, -1)
            self.container.add(self.content, False, True)
        else:
            self.container.add(self.content, True, True)

        self.add(self.container, True, True)

        if not no_buttons:
            # Buttons at the bottom of the page:
            self.button_box = mforms.newBox(True)
            self.button_box.set_spacing(8)
            self.button_box.set_padding(24)

            if hasattr(self, "go_advanced"):
                self.advanced_button = mforms.newButton()
                self.advanced_button.set_text('Advanced >>')
                self.advanced_button.set_name('Advanced')
                self.advanced_button.add_clicked_callback(self.go_advanced)
                self.button_box.add(self.advanced_button, False, True)

            self.cancel_button = mforms.newButton()
            self.cancel_button.set_text('Cancel')
            self.button_box.add_end(self.cancel_button, False, True)
            if hasattr(self, "go_cancel"):
                self.cancel_button.add_clicked_callback(self.go_cancel)
            else:
                self.cancel_button.set_enabled(False)

            self.next_button = mforms.newButton()
            self.next_button.set_text('Next >')
            self.next_button.set_name('Next')
            self.next_button.add_clicked_callback(self.go_next)
            self.button_box.add_end(self.next_button, False, True)

            self.back_button = mforms.newButton()
            self.back_button.set_text('< Back')
            self.back_button.set_name('Back')
            self.back_button.add_clicked_callback(self.go_back)
            self.button_box.add_end(self.back_button, False, True)

            self.add_end(self.button_box, False, True)
    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)
コード例 #3
0
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)
コード例 #4
0
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)
コード例 #5
0
    def __init__(self, editor, schema):
        mforms.Splitter.__init__(self, True, False)
        self.set_managed()
        self.set_release_on_add()

        self.schema = schema
        self.editor = editor
        self.summary_view = TableManager(editor, schema)
        self.add(self.summary_view, 100, True)

        self.node_name = self.summary_view.node_name
        self.caption = self.summary_view.caption

        self.summary_view.tree.add_changed_callback(
            self.table_selection_changed)

        self.goback_btn = mforms.newButton()
        self.goback_btn.set_text("< Summary List")
        self.goback_btn.add_clicked_callback(self.switch_back)
        self.summary_view.bbox.add(self.goback_btn, False, True)
        self.goback_btn.show(False)

        self.inspect_btn = mforms.newButton()
        self.inspect_btn.set_text("Inspect Table")
        self.inspect_btn.add_clicked_callback(self.summary_view.inspect_table)
        self.summary_view.bbox.add_end(self.inspect_btn, False, True)

        self.maintenance_btn = mforms.newButton()
        self.maintenance_btn.set_text("Maintenance >")
        self.maintenance_btn.add_clicked_callback(self.switch_maintenance)
        self.summary_view.bbox.add(self.maintenance_btn, False, True)

        self.right_view = None
コード例 #6
0
    def create_ui(self):
        dprint_ex(3, "Enter")
        self.suspend_layout()

        self.warning = not_running_warning_label()
        self.add(self.warning, False, True)

        self.connection_list = newTreeView(mforms.TreeDefault)
        self.connection_list.add_column(mforms.StringColumnType, "Id", 50,
                                        False)
        self.connection_list.add_column(mforms.StringColumnType, "User", 80,
                                        False)
        self.connection_list.add_column(mforms.StringColumnType, "Host", 120,
                                        False)
        self.connection_list.add_column(mforms.StringColumnType, "DB", 100,
                                        False)
        self.connection_list.add_column(mforms.StringColumnType, "Command", 80,
                                        False)
        self.connection_list.add_column(mforms.IntegerColumnType, "Time", 80,
                                        False)
        self.connection_list.add_column(mforms.StringColumnType, "State", 80,
                                        False)
        self.connection_list.add_column(mforms.StringColumnType, "Info", 300,
                                        False)
        self.connection_list.end_columns()
        self.connection_list.set_allow_sorting(True)

        self.connection_list.add_changed_callback(
            weakcb(self, "connection_selected"))

        #self.set_padding(8)
        self.add(self.connection_list, True, True)

        self.button_box = box = newBox(True)
        self.add(box, False, True)

        box.set_spacing(12)
        box.set_padding(12)

        refresh_button = newButton()
        refresh_button.set_text("Refresh")
        box.add_end(refresh_button, False, True)
        refresh_button.add_clicked_callback(weakcb(self, "refresh"))

        self.kill_button = newButton()
        self.kill_button.set_text("Kill Connection")
        box.add_end(self.kill_button, False, True)
        self.kill_button.add_clicked_callback(weakcb(self, "kill_connection"))

        self.killq_button = newButton()
        self.killq_button.set_text("Kill Query")
        box.add_end(self.killq_button, False, True)
        self.killq_button.add_clicked_callback(weakcb(self, "kill_query"))

        self.add(box, False, True)

        self.resume_layout()

        self.connection_selected()
        dprint_ex(3, "Leave")
コード例 #7
0
    def __init__(self, editor, schema):
        mforms.Splitter.__init__(self, True, False)
        self.set_managed()
        self.set_release_on_add()

        self.schema = schema
        self.editor = editor
        self.summary_view = TableManager(editor, schema)
        self.add(self.summary_view, 100, True)

        self.node_name = self.summary_view.node_name
        self.caption = self.summary_view.caption

        self.summary_view.tree.add_changed_callback(self.table_selection_changed)

        self.goback_btn = mforms.newButton()
        self.goback_btn.set_text("< Summary List")
        self.goback_btn.add_clicked_callback(self.switch_back)
        self.summary_view.bbox.add(self.goback_btn, False, True)
        self.goback_btn.show(False)

        self.inspect_btn = mforms.newButton()
        self.inspect_btn.set_text("Inspect Table")
        self.inspect_btn.add_clicked_callback(self.summary_view.inspect_table)
        self.summary_view.bbox.add_end(self.inspect_btn, False, True)

        self.maintenance_btn = mforms.newButton()
        self.maintenance_btn.set_text("Maintenance >")
        self.maintenance_btn.add_clicked_callback(self.switch_maintenance)
        self.summary_view.bbox.add(self.maintenance_btn, False, True)

        self.right_view = None
コード例 #8
0
def selectServer(title):
    # No need to select an instance if there's only one:
    if len(grt.root.wb.rdbmsMgmt.storedInstances) == 1:
        return grt.root.wb.rdbmsMgmt.storedInstances[0]

    window = mforms.Form(None)
    window.set_title(title)
    box = mforms.newBox(False)
    window.set_content(box)

    box.set_padding(12)
    box.set_spacing(12)

    label = mforms.newLabel()
    label.set_text("Select Server to Connect to:")
    box.add(label, False, True)

    listbox = mforms.newListBox(False)
    box.add(listbox, True, True)
    listbox.show()

    for inst in grt.root.wb.rdbmsMgmt.storedInstances:
        listbox.add_item(inst.name)

    if len(grt.root.wb.rdbmsMgmt.storedInstances) > 0:
        listbox.set_selected(0)
    else:
        Utilities.show_warning(
            "No Database Server Instances",
            """You have not defined a database server instance. At least one
    server instance is needed. Please define one by clicking in 
    "New Server Instance" and retry.""",
            "OK",
            "",
            "",
        )
        return None

    bbox = mforms.newBox(True)
    box.add(bbox, False, True)

    bbox.set_spacing(8)

    ok = mforms.newButton()
    ok.set_text("OK")
    bbox.add_end(ok, False, True)

    cancel = mforms.newButton()
    cancel.set_text("Cancel")
    bbox.add_end(cancel, False, True)

    window.set_size(400, 300)
    window.center()

    if window.run_modal(ok, cancel):
        i = listbox.get_selected_index()
        if i >= 0:
            return grt.root.wb.rdbmsMgmt.storedInstances[i]
    return None
コード例 #9
0
    def create_ui(self):
        label = mforms.newLabel(
            "Welcome to the MySQL Workbench Migration 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(
            "This wizard will assist you in migrating tables and data from a supported database system to MySQL.\n"
            +
            "You can also use this to copy databases from one MySQL instance to another."
        )
        self.content.add(label, False, True)
        label = mforms.newLabel("Prerequisites")
        label.set_style(mforms.BoldStyle)
        self.content.add(label, False, True)
        label = mforms.newLabel(
            "Before starting, check the following preparation steps:\n\n" +
            "- The Migration Wizard uses ODBC to connect to the source database. You must have an ODBC driver for\n"
            "the source database installed and configured, as Workbench does not bundle any such drivers.\n"
            "For MySQL connections, the native client library is used.\n\n" +
            "- Ensure you can connect to both source and target RDBMS servers.\n\n"
            +
            "- Make sure you have privileges to read schema information and data from the source database and\n"
            +
            "create objects and inserting data in the target MySQL server.\n\n"
            +
            "- The max_allowed_packet option in the target MySQL server must be enough to fit\n"
            +
            "the largest field value to be copied from source (especially BLOBs and large TEXT fields).\n\n"
            + "\n" +
            "The wizard supports migrating from specific database systems, but a \"generic\" RDBMS support is also provided.\n"
            +
            "The generic support is capable of migrating tables from many RDBMS that can be connected to using ODBC,\n"
            +
            "although certain type mappings may not be performed correctly. A manual mapping step is provided for\n"
            + "reviewing and fixing any migration problems that could occur.")
        self.content.add(label, False, True)

        box = mforms.newBox(True)
        box.add(mforms.newLabel(""), True, True)
        button_start = mforms.newButton()
        button_start.set_text("Start Migration")
        button_start.add_clicked_callback(self.start)
        box.add(button_start, True, True)
        box.add(mforms.newLabel(""), True, True)
        button_odbc = mforms.newButton()
        button_odbc.set_text("Open ODBC Administrator")
        button_odbc.add_clicked_callback(self.start_odbc)
        box.add(button_odbc, True, True)
        box.add(mforms.newLabel(""), True, True)
        button_doc = mforms.newButton()
        button_doc.set_text("View Documentation")
        button_doc.add_clicked_callback(lambda: mforms.Utilities.open_url(
            'http://dev.mysql.com/doc/workbench/en/wb-migration.html'))
        box.add(button_doc, True, True)
        box.add(mforms.newLabel(""), True, True)
        self.content.add_end(box, False, True)
コード例 #10
0
    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()
コード例 #11
0
    def __init__(self, main, header_label, wide=False, no_buttons= False):
        mforms.Box.__init__(self, False)
        self.set_managed()
        self.set_release_on_add()

        self.skip_this_page = False
        self.ui_created = False
        self.main = main

        self._identifier = "    "+header_label

        self.set_back_color("") # Make the page transparent.
        self.container = mforms.newBox(True)

        # Main content
        self.content = mforms.newBox(False)
        self.content.set_spacing(12)
        self.content.set_padding(24)
        if not wide:
            self.content.set_size(800, -1)
            self.container.add(self.content, False, True)
        else:
            self.container.add(self.content, True, True)
        
        self.add(self.container, True, True)

        if not no_buttons:
            # Buttons at the bottom of the page:
            self.button_box = mforms.newBox(True)
            self.button_box.set_spacing(8)
            self.button_box.set_padding(16)

            if hasattr(self, "go_advanced"):
                self.advanced_button = mforms.newButton()
                self.advanced_button.set_text('Advanced >>')
                self.advanced_button.add_clicked_callback(self.go_advanced)
                self.button_box.add(self.advanced_button, False, True)

            self.cancel_button = mforms.newButton()
            self.cancel_button.set_text('Cancel')
            self.button_box.add_end(self.cancel_button, False, True)
            if hasattr(self, "go_cancel"):
                self.cancel_button.add_clicked_callback(self.go_cancel)
            else:
                self.cancel_button.set_enabled(False)

            self.next_button = mforms.newButton()
            self.next_button.set_text('Next >')
            self.next_button.add_clicked_callback(self.go_next)
            self.button_box.add_end(self.next_button, False, True)

            self.back_button = mforms.newButton()
            self.back_button.set_text('< Back')
            self.back_button.add_clicked_callback(self.go_back)
            self.button_box.add_end(self.back_button, False, True)

            self.add_end(self.button_box, False, True)
コード例 #12
0
    def __init__(self, results, checksum=False):
        mforms.Form.__init__(self, mforms.Form.main_form(), mforms.FormNormal)

        self.box = mforms.newBox(False)
        self.box.set_padding(12)
        self.box.set_spacing(8)
        self.set_content(self.box)

        self.tree = mforms.newTreeNodeView(mforms.TreeFlatList|mforms.TreeAltRowColors|mforms.TreeShowColumnLines)
        self.tree.set_selection_mode(mforms.TreeSelectMultiple)
        self.box.add(self.tree, True, True)
        self.tree.add_column(mforms.StringColumnType, "Table", 200, False)
        if checksum:
            self.tree.add_column(mforms.StringColumnType, "Checksum", 100, False)
        else:
            self.tree.add_column(mforms.StringColumnType, "Operation", 80, False)
            self.tree.add_column(mforms.IconStringColumnType, "Message", 400, False)
        self.tree.end_columns()

        self._checksum = checksum

        app = mforms.App.get()
        icon_path = {
            'status': app.get_resource_path('mini_ok.png'),
            'error': app.get_resource_path('mini_error.png'),
            'info': '',
            'note': app.get_resource_path('mini_notice.png'),
            'warning': app.get_resource_path('mini_warning.png'),
        }

        ok = results.goToFirstRow()
        while ok:
            node = self.tree.add_node()
            node.set_string(0, results.stringFieldValue(0))
            if not checksum:
                node.set_string(1, results.stringFieldValue(1))
                node.set_icon_path(2, icon_path.get(results.stringFieldValue(2), ''))
                node.set_string(2, results.stringFieldValue(3))
                node.set_tag(results.stringFieldValue(2))
            else:
                node.set_string(1, results.stringFieldValue(1))
            ok = results.nextRow()

        bbox = mforms.newBox(True)
        self.box.add(bbox, False, True)

        copy = mforms.newButton()
        copy.add_clicked_callback(self.copy_to_clipboard)
        copy.set_text("Copy to Clipboard")
        bbox.add(copy, False, True)

        self.ok = mforms.newButton()
        self.ok.set_text("OK")
        self.ok.add_clicked_callback(self.close)
        bbox.add_end(self.ok, False, True)

        self.set_size(500, 400)
コード例 #13
0
    def __init__(self, results, checksum=False):
        mforms.Form.__init__(self, mforms.Form.main_form(), mforms.FormNormal)

        self.box = mforms.newBox(False)
        self.box.set_padding(12)
        self.box.set_spacing(8)
        self.set_content(self.box)

        self.tree = mforms.newTreeView(mforms.TreeFlatList|mforms.TreeAltRowColors|mforms.TreeShowColumnLines)
        self.tree.set_selection_mode(mforms.TreeSelectMultiple)
        self.box.add(self.tree, True, True)
        self.tree.add_column(mforms.StringColumnType, "Table", 200, False)
        if checksum:
            self.tree.add_column(mforms.StringColumnType, "Checksum", 100, False)
        else:
            self.tree.add_column(mforms.StringColumnType, "Operation", 80, False)
            self.tree.add_column(mforms.IconStringColumnType, "Message", 400, False)
        self.tree.end_columns()

        self._checksum = checksum

        app = mforms.App.get()
        icon_path = {
            'status': app.get_resource_path('mini_ok.png'),
            'error': app.get_resource_path('mini_error.png'),
            'info': '',
            'note': app.get_resource_path('mini_notice.png'),
            'warning': app.get_resource_path('mini_warning.png'),
        }

        ok = results.goToFirstRow()
        while ok:
            node = self.tree.add_node()
            node.set_string(0, results.stringFieldValue(0))
            if not checksum:
                node.set_string(1, results.stringFieldValue(1))
                node.set_icon_path(2, icon_path.get(results.stringFieldValue(2), ''))
                node.set_string(2, results.stringFieldValue(3))
                node.set_tag(results.stringFieldValue(2))
            else:
                node.set_string(1, results.stringFieldValue(1))
            ok = results.nextRow()

        bbox = mforms.newBox(True)
        self.box.add(bbox, False, True)

        copy = mforms.newButton()
        copy.add_clicked_callback(self.copy_to_clipboard)
        copy.set_text("Copy to Clipboard")
        bbox.add(copy, False, True)

        self.ok = mforms.newButton()
        self.ok.set_text("OK")
        self.ok.add_clicked_callback(self.close)
        bbox.add_end(self.ok, False, True)

        self.set_size(500, 400)
コード例 #14
0
    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()
コード例 #15
0
def selectServer(title):
    # No need to select an instance if there's only one:
    if len(grt.root.wb.rdbmsMgmt.storedInstances) == 1:
        return grt.root.wb.rdbmsMgmt.storedInstances[0]

    window = mforms.Form(None)
    window.set_title(title)
    box = mforms.newBox(False)
    window.set_content(box)

    box.set_padding(12)
    box.set_spacing(12)

    label = mforms.newLabel()
    label.set_text("Select Server to Connect to:")
    box.add(label, False, True)

    listbox = mforms.newListBox(False)
    box.add(listbox, True, True)
    listbox.show()

    for inst in grt.root.wb.rdbmsMgmt.storedInstances:
        listbox.add_item(inst.name)

    if len(grt.root.wb.rdbmsMgmt.storedInstances) > 0:
        listbox.set_selected(0)
    else:
        Utilities.show_warning(
            "No Database Server Instances",
            '''You have not defined a database server instance. At least one
    server instance is needed. Please define one by clicking in 
    "New Server Instance" and retry.''', "OK", "", "")
        return None

    bbox = mforms.newBox(True)
    box.add(bbox, False, True)

    bbox.set_spacing(8)

    ok = mforms.newButton()
    ok.set_text("OK")
    bbox.add_end(ok, False, True)

    cancel = mforms.newButton()
    cancel.set_text("Cancel")
    bbox.add_end(cancel, False, True)

    window.set_size(400, 300)
    window.center()

    if window.run_modal(ok, cancel):
        i = listbox.get_selected_index()
        if i >= 0:
            return grt.root.wb.rdbmsMgmt.storedInstances[i]
    return None
コード例 #16
0
 def ui_ok_cancel_button(self, box):
   tBox = PropelForm.spaced_box(True)
   #label = mforms.newLabel("remember to validate your changes by press OK, and save you .mwb file in MySQLWorkbench to save you Propel Utilty changes ;)")
   #tBox.add(label, False, True)
   self.cancelButton = mforms.newButton()
   self.cancelButton.set_text("cancel")
   tBox.add_end(self.cancelButton, False, True)
   self.okButton = mforms.newButton()
   self.okButton.set_text("ok")
   tBox.add_end(self.okButton, False, True)
   self.okButton.add_clicked_callback(self.save)
   box.add_end(tBox, False, True)
コード例 #17
0
ファイル: wb_admin_connections.py プロジェクト: Arrjaan/Cliff
    def create_ui(self):
        dprint_ex(3, "Enter")
        self.suspend_layout()
        
        self.warning = not_running_warning_label()
        self.add(self.warning, False, True)
    
        self.connection_list = newTreeView(mforms.TreeDefault)
        self.connection_list.add_column(mforms.StringColumnType, "Id", 50, False)
        self.connection_list.add_column(mforms.StringColumnType, "User", 80, False)
        self.connection_list.add_column(mforms.StringColumnType, "Host", 120, False)
        self.connection_list.add_column(mforms.StringColumnType, "DB", 100, False)
        self.connection_list.add_column(mforms.StringColumnType, "Command", 80, False)
        self.connection_list.add_column(mforms.IntegerColumnType, "Time", 80, False)
        self.connection_list.add_column(mforms.StringColumnType, "State", 80, False)
        self.connection_list.add_column(mforms.StringColumnType, "Info", 300, False)        
        self.connection_list.end_columns()
        self.connection_list.set_allow_sorting(True)
        
        self.connection_list.add_changed_callback(weakcb(self, "connection_selected"))

        #self.set_padding(8)
        self.add(self.connection_list, True, True)

        self.button_box = box = newBox(True)
        self.add(box, False, True)
        
        box.set_spacing(12)
        box.set_padding(12)
        
        refresh_button = newButton()
        refresh_button.set_text("Refresh")
        box.add_end(refresh_button, False, True)
        refresh_button.add_clicked_callback(weakcb(self, "refresh"))

        self.kill_button = newButton()
        self.kill_button.set_text("Kill Connection")
        box.add_end(self.kill_button, False, True)
        self.kill_button.add_clicked_callback(weakcb(self, "kill_connection"))

        self.killq_button = newButton()
        self.killq_button.set_text("Kill Query")
        box.add_end(self.killq_button, False, True)
        self.killq_button.add_clicked_callback(weakcb(self, "kill_query"))


        self.add(box, False, True)
        
        self.resume_layout()

        self.connection_selected()
        dprint_ex(3, "Leave")
コード例 #18
0
    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()
コード例 #19
0
 def add_remove_behavior_button(self):
   tBox = PropelForm.spaced_box(True)
   self.widgets['selectBehaviors'] = mforms.newSelector(mforms.SelectorPopup)
   self.widgets['selectBehaviors'].add_items(PropelBehavior.fields['name']['items'])
   tBox.add(self.widgets['selectBehaviors'], False, True)
   addBehavior = mforms.newButton()
   addBehavior.set_text("add selected behavior to selected table")
   addBehavior.add_clicked_callback(lambda: self.add_behavior())
   tBox.add(addBehavior, False, True)
   removeBehavior = mforms.newButton()
   removeBehavior.set_text("remove this behavior")
   removeBehavior.add_clicked_callback(lambda: self.remove_behavior())
   tBox.add(removeBehavior, False, True)
   self.add_end(tBox, False, True)
コード例 #20
0
 def add_remove_behavior_button(self):
   tBox = PropelForm.spaced_box(True)
   self.widgets['selectBehaviors'] = mforms.newSelector(mforms.SelectorPopup)
   self.widgets['selectBehaviors'].add_items(sorted(PropelBehavior.getBehaviorsDict(self.widgets['extra_behaviors_path'].get_string_value()).keys()))
   tBox.add(self.widgets['selectBehaviors'], False, True)
   addBehavior = mforms.newButton()
   addBehavior.set_text("add selected behavior to selected table")
   addBehavior.add_clicked_callback(lambda: self.add_behavior())
   tBox.add(addBehavior, False, True)
   removeBehavior = mforms.newButton()
   removeBehavior.set_text("remove this behavior")
   removeBehavior.add_clicked_callback(lambda: self.remove_behavior())
   tBox.add(removeBehavior, False, True)
   self.add_end(tBox, False, True)
コード例 #21
0
    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(4)
        self.set_column_count(2)
        self._buttonBox = None
        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.VFillFlag | mforms.HFillFlag)

        self.add(mforms.newLabel(text), 1, 2, 1, 2,
                 mforms.VFillFlag | mforms.HFillFlag)

        if button1 or button2:
            self._buttonBox = mforms.newBox(True)
            self._buttonBox.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)
            self._buttonBox.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)
            self._buttonBox.add_end(self._alt_button, False, True)
        else:
            self._alt_button = None

        if button1 or button2:
            self.add(self._buttonBox, 1, 2, 2, 3,
                     mforms.VFillFlag | mforms.HFillFlag)
コード例 #22
0
 def __init__(self, Title, Message):
     mforms.Form.__init__(self, None, mforms.FormDialogFrame)
     self.set_title(Title)
     box = mforms.newBox(False)
     self.set_content(box)
     box.set_padding(12)
     box.set_spacing(12)
     label = mforms.newLabel(Message)
     box.add(label, False, True)
     self.cancelButton = mforms.newButton()
     self.cancelButton.set_text("No")
     box.add_end(self.cancelButton, False, True)
     self.okButton = mforms.newButton()
     self.okButton.set_text("Yes")
     box.add_end(self.okButton, False, True)
コード例 #23
0
 def __init__(self, Title, Message):
     mforms.Form.__init__(self, None, mforms.FormDialogFrame)
     self.set_title(Title)
     box = mforms.newBox(False)
     self.set_content(box)
     box.set_padding(12)
     box.set_spacing(12)
     label = mforms.newLabel(Message)
     box.add(label, False, True)
     self.cancelButton = mforms.newButton()
     self.cancelButton.set_text("No")
     box.add_end(self.cancelButton, False, True)
     self.okButton = mforms.newButton()
     self.okButton.set_text("Yes")
     box.add_end(self.okButton, False, True)
コード例 #24
0
    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)
コード例 #25
0
    def create_search_panel(self):
        search_label = newLabel("Locate option:")
        self.option_lookup_entry = newTextEntry()
        self.option_lookup_entry.set_size(200, -1)
        search_btn = newButton()
        search_btn.set_text("Find")
        search_btn.set_size(70, -1)

        search_box = newBox(True)
        search_box.set_padding(2)
        search_box.set_spacing(4)
        #search_box.set_size(300, -1)
        search_box.add(search_label, False, False)
        search_box.add(self.option_lookup_entry, False, True)
        search_box.add(search_btn, False, False)
        search_panel = newPanel(mforms.FilledPanel)
        search_panel.add(search_box)
        self.main_view.ui_profile.apply_style(search_panel,
                                              'option-search-panel')

        def lookup_option_wrapper():
            self.locate_option(self.option_lookup_entry.get_string_value())

        search_btn.add_clicked_callback(lookup_option_wrapper)

        return search_panel
コード例 #26
0
    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)
コード例 #27
0
    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()
コード例 #28
0
    def __init__(self, context, profile, backup_path):
        mforms.Form.__init__(self, None, 0)

        box = mforms.newBox(False)
        box.set_padding(12)
        box.set_spacing(12)
        self.set_content(box)

        self.set_title("mysqlbackup logs for %s" % backup_path)

        self.viewer = BackupLogViewer(context, profile)
        box.add(self.viewer, True, True)

        self.viewer.load(backup_path)

        bbox = mforms.newBox(True)
        bbox.set_spacing(12)

        close = mforms.newButton()
        close.set_text("Close")
        bbox.add_end(close, False, True)
        close.add_clicked_callback(self.close)

        box.add_end(bbox, False, True)


        self.set_size(800, 600)
        self.center()
コード例 #29
0
    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)
コード例 #30
0
    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)
コード例 #31
0
    def create_search_panel(self):
      search_label = newLabel("Locate option:")
      self.option_lookup_entry  = newTextEntry()
      self.option_lookup_entry.set_size(200,-1)
      search_btn = newButton()
      search_btn.set_text("Find")
      search_btn.set_size(70, -1)

      search_box = newBox(True)
      search_box.set_padding(2)
      search_box.set_spacing(4)
      #search_box.set_size(300, -1)
      search_box.add(search_label, False, False)
      search_box.add(self.option_lookup_entry, False, True)
      search_box.add(search_btn, False, False)
      search_panel = newPanel(mforms.FilledPanel)
      search_panel.add(search_box)
      self.main_view.ui_profile.apply_style(search_panel, 'option-search-panel')

      def lookup_option_wrapper():
          self.locate_option(self.option_lookup_entry.get_string_value())

      search_btn.add_clicked_callback(lookup_option_wrapper)

      return search_panel
コード例 #32
0
    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)
コード例 #33
0
        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)
コード例 #34
0
    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)
コード例 #35
0
ファイル: run_script.py プロジェクト: zfh521/mysql-workbench
    def start_import(self, file, default_schema, default_charset):
        self.panel = RunPanel(self.editor, self.report)
        self.set_title("Run SQL Script")

        box = mforms.newBox(False)
        box.set_padding(12)
        box.set_spacing(12)

        box.add(self.panel, False, True)
        box.add(mforms.newLabel("Output:"), False, True)
        box.add(self.logbox, True, True)

        self.ok = mforms.newButton()
        self.ok.set_text("Close")
        self.ok.add_clicked_callback(self.close)

        #self.abort = mforms.newButton()
        #self.abort.set_text("Abort")

        hbox = mforms.Box(True)
        hbox.set_spacing(8)
        #hbox.add(self.abort, False, True)
        hbox.add_end(self.ok, False, True)
        box.add_end(hbox, False, True)

        self.set_content(box)

        self.set_size(800, 600)
        self.center()
        self.show()

        self.ok.set_enabled(False)
        self.panel.start(file, default_schema, default_charset)
コード例 #36
0
    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)
コード例 #37
0
    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)
        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=file_box, 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)
        box.add(file_box, False, True)
        file_box.set_enabled(False)

        setattr(self, name + "_check_duplicate", False)
        setattr(self, name + "_checkbox", check)
        setattr(self, name + "_entry", file_entry)
コード例 #38
0
        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)
コード例 #39
0
    def create_ui(self):
        label = mforms.newLabel("Welcome to the MySQL Workbench Migration 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("This wizard will assist you in migrating tables and data from a supported database system to MySQL.\n"+
              "You can also use this to copy databases from one MySQL instance to another.")
        self.content.add(label, False, True)
        label = mforms.newLabel("Prerequisites")
        label.set_style(mforms.BoldStyle)
        self.content.add(label, False, True)
        label = mforms.newLabel("Before starting, check the following preparation steps:\n\n"+
              "- The Migration Wizard uses ODBC to connect to the source database. You must have an ODBC driver for\n"
              "the source database installed and configured, as Workbench does not bundle any such drivers.\n"
              "For MySQL connections, the native client library is used.\n\n"+
              "- Ensure you can connect to both source and target RDBMS servers.\n\n"+
              "- Make sure you have privileges to read schema information and data from the source database and\n"+
              "create objects and inserting data in the target MySQL server.\n\n"+
              "- The max_allowed_packet option in the target MySQL server must be enough to fit\n"+ 
              "the largest field value to be copied from source (especially BLOBs and large TEXT fields).\n\n"+
              "\n"+
              "The wizard supports migrating from specific database systems, but a \"generic\" RDBMS support is also provided.\n"+
              "The generic support is capable of migrating tables from many RDBMS that can be connected to using ODBC,\n"+
              "although certain type mappings may not be performed correctly. A manual mapping step is provided for\n"+
              "reviewing and fixing any migration problems that could occur.")
        self.content.add(label, False, True)

        box = mforms.newBox(True)
        box.add(mforms.newLabel(""), True, True)
        button_start = mforms.newButton()
        button_start.set_text("Start Migration")
        button_start.add_clicked_callback(self.start)
        box.add(button_start, True, True)
        box.add(mforms.newLabel(""), True, True)
        button_odbc = mforms.newButton()
        button_odbc.set_text("Open ODBC Administrator")
        button_odbc.add_clicked_callback(self.start_odbc)
        box.add(button_odbc, True, True)
        box.add(mforms.newLabel(""), True, True)
        button_doc = mforms.newButton()
        button_doc.set_text("View Documentation")
        button_doc.add_clicked_callback(lambda: mforms.Utilities.open_url('http://dev.mysql.com/doc/workbench/en/wb-migration.html'))
        box.add(button_doc, True, True)
        box.add(mforms.newLabel(""), True, True)
        self.content.add_end(box, False, True)
コード例 #40
0
    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()
コード例 #41
0
ファイル: wba_ssh_ui.py プロジェクト: zfh521/mysql-workbench
    def run(self):
        self._updating = False
        self._invalid_text = False
        self.form = Form(None, mforms.FormResizable)
        self.form.set_title(self.title)
        self.flist = newTreeView(mforms.TreeFlatList)
        self.curdir = newTextEntry()

        self.flist.add_column(mforms.IconStringColumnType, "File", 400, False)
        self.flist.end_columns()

        self.curdir.add_changed_callback(self.text_changed)
        self.curdir.add_action_callback(self.text_action)
        self.flist.add_activated_callback(self.on_cd)
        self.flist.add_changed_callback(self.on_change)

        accept = newButton()
        accept.set_text("OK")
        cancel = newButton()
        cancel.set_text("Cancel")
        button_box = newBox(True)
        button_box.set_padding(10)
        button_box.set_spacing(8)
        Utilities.add_end_ok_cancel_buttons(button_box, accept, cancel)

        box = newBox(False)  # Hosts all entries on that dialog.
        box.set_padding(10)
        box.set_spacing(10)
        box.add(self.curdir, False, False)
        box.add(self.flist, True, True)
        box.add(button_box, False, False)

        self.form.set_content(box)
        self.form.set_size(500, 400)

        cancel.add_clicked_callback(self.cancel_action)
        accept.add_clicked_callback(self.accept_action)

        self.form.relayout()
        self.form.center()

        self.on_cd(0, 0)

        # Don't use the accept button in run_modal or you won't be able to press <enter>
        #  to change the path via the top edit control.
        self.form.run_modal(None, cancel)
コード例 #42
0
ファイル: test3.py プロジェクト: dashiad/Siviglia
 def __init__(self, container,parent, l):
   self.container=container
   self.parent=parent
   self.l=l
   self.button=mforms.newButton()
   self.button.set_text(l)
   container.add(self.button,False,True)
   self.button.add_clicked_callback(lambda:self.onClicked())
コード例 #43
0
    def update(self, ctrl_be):
        self.suspend_layout()
        self.connection_name.set_text(ctrl_be.server_profile.name)

        info = ctrl_be.server_variables
        status = ctrl_be.status_variables

        if self.info_table:
            self.vbox.remove(self.info_table)

        self.info_table = mforms.newTable()
        self.info_table.set_column_count(2)
        self.info_table.set_row_count(8)
        self.info_table.set_column_spacing(18)
        self.info_table.set_row_spacing(5)

        stradd(self.info_table, 0, "\nHost",
               "\n" + info.get("hostname", "n/a"))
        stradd(self.info_table, 1, "Socket", info.get("socket", "n/a"))
        stradd(self.info_table, 2, "Port", info.get("port", "n/a"))
        stradd(
            self.info_table, 3, "Version", "%s (%s)" %
            (info.get("version", "n/a"), info.get("version_comment", "")))
        stradd(
            self.info_table, 4, "Compiled For",
            "%s   (%s)" % (info.get("version_compile_os", "n/a"),
                           info.get("version_compile_machine", "n/a")))

        stradd(self.info_table, 5, "Configuration File",
               ctrl_be.server_profile.config_file_path or "unknown")

        uptime = status.get("Uptime", None)
        if uptime:
            uptime = long(uptime)
            stradd(
                self.info_table, 6, "Running Since", "%s (%s)" %
                (time.ctime(ctrl_be.status_variables_time - uptime),
                 format_duration(uptime, True)))
        else:
            stradd(self.info_table, 6, "Running Since", "n/a")
        self.vbox.add(self.info_table, True, True)

        box = mforms.newBox(True)
        refresh = mforms.newButton()
        refresh.set_text("Refresh")
        refresh.set_tooltip("Refresh server status information")
        refresh.add_clicked_callback(self.owner.refresh_status)
        box.add(refresh, False, False)
        self.info_table.add(box, 1, 2, 7, 8, mforms.VFillFlag)

        version = ctrl_be.target_version
        if version and info:
            icon = mforms.App.get().get_resource_path(
                "mysql-logo-%i%i.png" %
                (version.majorNumber, version.minorNumber))
            if icon:
                self.icon.set_image(icon)
        self.resume_layout()
コード例 #44
0
    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()
コード例 #45
0
    def pack_to_top(self):
        self.suspend_layout()
        self.main_view.ui_profile.apply_style(self, 'page')

        #if self.server_profile.admin_enabled:
        self.file_name_ctrl = newTextEntry()
        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.file_name_ctrl.set_size(300, -1)
        self.file_name_ctrl.set_read_only(True)

        self.section_ctrl = newSelector()
        self.section_ctrl.set_size(150, -1)

        #spacer = newPanel(mforms.TransparentPanel)
        #spacer.set_size(100, 10)

        self.bottom_box = newBox(True)

        accept_btn = newButton()
        accept_btn.set_text("Apply ...")

        discard_btn = newButton()
        discard_btn.set_text("Discard")

        #self.add(self.search_panel, False, True)
        self.add(self.tab_view, True, True)
        self.add(self.bottom_box, False, False)

        self.bottom_box.add(newLabel("Configuration File:"), False, True)
        self.bottom_box.add(self.file_name_ctrl, True, True)
        self.bottom_box.add(self.section_ctrl, False, True)

        Utilities.add_end_ok_cancel_buttons(self.bottom_box, accept_btn,
                                            discard_btn)

        self.bottom_box.set_spacing(8)
        self.bottom_box.set_padding(12)

        accept_btn.add_clicked_callback(self.config_apply_changes_clicked)
        discard_btn.add_clicked_callback(self.config_discard_changes_clicked)

        self.resume_layout()
コード例 #46
0
    def __init__(self, title, description):
        self._canceled = False
        mforms.Form.__init__(
            self, None, mforms.FormDialogFrame | mforms.FormResizable
            | mforms.FormMinimizable)
        self.set_title(title)

        content = mforms.newBox(False)
        self.set_content(content)
        content.set_padding(12)
        content.set_spacing(12)

        v_box = mforms.newBox(False)
        content.add(v_box, False, False)
        v_box.set_spacing(12)
        v_box.add(mforms.newLabel(description), False, False)

        table = mforms.newTable()
        table.set_padding(12)
        v_box.add(table, False, False)
        table.set_row_count(2)
        table.set_column_count(2)
        table.set_row_spacing(8)
        table.set_column_spacing(4)
        table.add(mforms.newLabel("Find:"), 0, 1, 0, 1)
        table.add(mforms.newLabel("Replace with:"), 0, 1, 1, 2)

        self.from_type_entry = mforms.newTextEntry()
        table.add(self.from_type_entry, 1, 2, 0, 1)

        self.to_type_entry = mforms.newTextEntry()
        table.add(self.to_type_entry, 1, 2, 1, 2)

        h_box = mforms.newBox(True)
        content.add_end(h_box, False, False)
        h_box.set_spacing(12)

        self.cancel_btn = mforms.newButton()
        self.cancel_btn.set_text("Cancel")
        h_box.add_end(self.cancel_btn, False, True)

        self.ok_btn = mforms.newButton()
        self.ok_btn.set_text("OK")
        h_box.add_end(self.ok_btn, False, True)
        self.set_size(600, 180)
コード例 #47
0
ファイル: test3.py プロジェクト: dashiad/Siviglia
 def addParamPanel(self,srcObj,key):
     paramCont=mforms.newBox(False);
     newparamUI=UIHelper(paramCont)
     tableField=TableFieldSelector(paramCont,'None',srcObj[key],'TABLE','RELATION')
     delbutton=mforms.newButton()
     delbutton.set_text('Delete')
     paramCont.add(delbutton,False,False)
     delbutton.add_clicked_callback(lambda:self.delParam(key,paramCont))
     self.paramcontainer.add(paramCont,False,True)
コード例 #48
0
    def __init__(self, owner, sql_text):
        WizardPage.__init__(self, owner, 'Review Generated Script')

        self.save_button = mforms.newButton()
        self.save_button.enable_internal_padding(True)
        self.save_button.set_text('Save to File...')
        self.save_button.set_tooltip('Save the text to a new file.')
        self.save_button.add_clicked_callback(self.save_clicked)

        self.copy_button = mforms.newButton()
        self.copy_button.enable_internal_padding(True)
        self.copy_button.set_text('Copy to Clipboard')
        self.copy_button.set_tooltip('Copy the text to the clipboard.')
        self.copy_button.add_clicked_callback(self.copy_clicked)

        self.sql_text = mforms.newCodeEditor()
        self.sql_text.set_language(mforms.LanguageMySQL)
        self.sql_text.set_text(sql_text)
コード例 #49
0
 def browse_schema_box(self):
   tBox = PropelForm.spaced_box(True)
   label = mforms.newLabel("external propel schema")
   tBox.add(label, False, True)
   self.widgets['external_schema_path'] = mforms.newTextEntry()
   tBox.add(self.widgets['external_schema_path'], True, True)
   self.widgets['external_schema_file'] = mforms.newFileChooser(mforms.OpenFile)
   self.widgets['external_schema_file'].set_extensions('XML files (*.xml)|*.xml','xml')
   self.widgets['external_schema_file'].set_title("external schema file")
   browse = mforms.newButton()
   browse.set_text("Browse")
   browse.add_clicked_callback(lambda: self.browse_schema())
   tBox.add(browse, False, True)
   add = mforms.newButton()
   add.set_text("Add")
   add.add_clicked_callback(lambda: self.add_schema())
   tBox.add(add, False, True)
   self.add(tBox, False, True)
コード例 #50
0
    def __init__(self, owner, sql_text):
        WizardPage.__init__(self, owner, 'Review Generated Script')

        self.save_button = mforms.newButton()
        self.save_button.enable_internal_padding(True)
        self.save_button.set_text('Save to File...')
        self.save_button.set_tooltip('Save the text to a new file.')
        self.save_button.add_clicked_callback(self.save_clicked)

        self.copy_button = mforms.newButton()
        self.copy_button.enable_internal_padding(True)
        self.copy_button.set_text('Copy to Clipboard')
        self.copy_button.set_tooltip('Copy the text to the clipboard.')
        self.copy_button.add_clicked_callback(self.copy_clicked)

        self.sql_text = mforms.newCodeEditor()
        self.sql_text.set_language(mforms.LanguageMySQL)
        self.sql_text.set_text(sql_text)
コード例 #51
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
コード例 #52
0
    def pack_to_top(self):
      self.suspend_layout()
      self.main_view.ui_profile.apply_style(self, 'page')

      #if self.server_profile.admin_enabled:
      self.file_name_ctrl = newTextEntry()
      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.file_name_ctrl.set_size(300, -1)
      self.file_name_ctrl.set_read_only(True)

      self.section_ctrl = newSelector()
      self.section_ctrl.set_size(150, -1)

      #spacer = newPanel(mforms.TransparentPanel)
      #spacer.set_size(100, 10)

      self.bottom_box = newBox(True)

      accept_btn = newButton()
      accept_btn.set_text("Apply ...")

      discard_btn = newButton()
      discard_btn.set_text("Discard")

      #self.add(self.search_panel, False, True)
      self.add(self.tab_view, True, True)
      self.add(self.bottom_box, False, False)

      self.bottom_box.add(newLabel("Configuration File:"), False, True)
      self.bottom_box.add(self.file_name_ctrl, True, True)
      self.bottom_box.add(self.section_ctrl, False, True)

      Utilities.add_end_ok_cancel_buttons(self.bottom_box, accept_btn, discard_btn)

      self.bottom_box.set_spacing(8)
      self.bottom_box.set_padding(12)

      accept_btn.add_clicked_callback(self.config_apply_changes_clicked)
      discard_btn.add_clicked_callback(self.config_discard_changes_clicked)

      self.resume_layout()
コード例 #53
0
ファイル: test3.py プロジェクト: dashiad/Siviglia
 def __init__(self):    
   mforms.Form.__init__(self,None);     
   self.set_managed()
   self.currentModel=None
   #Lista de campos del modelo actual.
   schema=grt.root.wb.doc.physicalModels[0].catalog.schemata[0]
   self.schema=schema        
   self.set_size(800,400)
   self.center()        
   self.set_title('Siviglia Editor')
   f1=mforms.newBox(False)
   
   bx = mforms.newBox(True)
   bx.set_padding(12)
   bx.set_spacing(12)
   
   self.lbox=mforms.newListBox(False)
   self.lbox.set_size(100,200);
   list=[];
   
   for curTable in schema.tables:      
     list.append(curTable.name);
   list.sort();
   for tName in list:
       self.lbox.add_item(tName)    
   self.lbox.add_changed_callback(lambda:self.changedModel());
   
   #self.lbox.add_changed_callback(lambda:self.changedField());
   #for curField in curTable.columns:
   #  self.lbox.add_item(curField.name);
   bx.add(self.lbox,False,False);    
   #sp=mforms.newScrollPanel();
   #bx.add(sp,True,True);        
   self.fieldContainer=mforms.newBox(False);    
   #self.autoUI=AutoUI(fieldContainer)
   #self.autoUI.reset('Testing',{'a':{'b':1,'c':2},'h':{'p':4,'m':'hola'}},{})    
   bx.add(self.fieldContainer,True,True)
   f1.add(bx,True,True)
   bx2=mforms.newBox(True)
   bx2.set_padding(12);
   bx2.set_size(500,20)
   #bx2.set_preferred_height(40);
   l=mforms.newLabel('Output Path')    
   bx2.add(l,False,True)
   p=mforms.newTextEntry()
   p.set_value("c:\\xampp\\htdocs");
   p.set_size(300,20)
   self.pathInput=p
   bx2.add(p,False,True)
   p=mforms.newButton()
   p.set_text("Generar")
   p.add_clicked_callback(self.onGenerate)
   bx2.add(p,False,True)
   f1.add(bx2,False,False)
   self.tabView=None
   self.set_content(f1)        
コード例 #54
0
    def __init__(self, title, description):
        self._canceled = False
        mforms.Form.__init__(self, None, mforms.FormDialogFrame|mforms.FormResizable|mforms.FormMinimizable)
        self.set_title(title)

        content = mforms.newBox(False)
        self.set_content(content)
        content.set_padding(12)
        content.set_spacing(12)

        v_box = mforms.newBox(False)
        content.add(v_box, False, False)
        v_box.set_spacing(12)
        v_box.add(mforms.newLabel(description), False, False)

        table = mforms.newTable()
        table.set_padding(12)
        v_box.add(table, False, False)
        table.set_row_count(2)
        table.set_column_count(2)
        table.set_row_spacing(8)
        table.set_column_spacing(4)
        table.add(mforms.newLabel("Find:"), 0, 1, 0, 1)
        table.add(mforms.newLabel("Replace with:"), 0, 1, 1, 2)

        self.from_type_entry = mforms.newTextEntry()
        table.add(self.from_type_entry, 1, 2, 0, 1)

        self.to_type_entry = mforms.newTextEntry()
        table.add(self.to_type_entry, 1, 2, 1, 2)

        h_box = mforms.newBox(True)
        content.add_end(h_box, False, False)
        h_box.set_spacing(12)

        self.cancel_btn = mforms.newButton()
        self.cancel_btn.set_text("Cancel")
        h_box.add_end(self.cancel_btn, False, True)

        self.ok_btn = mforms.newButton()
        self.ok_btn.set_text("OK")
        h_box.add_end(self.ok_btn, False, True)
        self.set_size(600, 180)
コード例 #55
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
コード例 #56
0
 def browse_schema_box(self):
   tBox = PropelForm.spaced_box(True)
   label = mforms.newLabel("export propel schema")
   tBox.add(label, False, True)
   self.widgets['export_schema_path'] = mforms.newTextEntry()
   self.widgets['export_schema_path'].set_value(self.db.cache['export_schema_path'])
   tBox.add(self.widgets['export_schema_path'], True, True)
   self.widgets['export_schema_file'] = mforms.newFileChooser(mforms.SaveFile)
   self.widgets['export_schema_file'].set_extensions('XML files (*.xml)|*.xml','xml')
   self.widgets['export_schema_file'].set_title("export schema file")
   browse = mforms.newButton()
   browse.set_text("Browse")
   browse.add_clicked_callback(lambda: self.browse_schema())
   tBox.add(browse, False, True)
   save = mforms.newButton()
   save.set_text("Save")
   save.add_clicked_callback(lambda: self.save_schema())
   tBox.add(save, False, True)
   self.add(tBox, False, True)
コード例 #57
0
    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()
コード例 #58
0
    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
コード例 #59
0
    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
コード例 #60
0
ファイル: test3.py プロジェクト: dashiad/Siviglia
    def __init__(self,qForm,container,rootObj,rootKey):
        
        self.qForm=qForm
        self.subContainer=mforms.newBox(False)        
        UIHelper.__init__(self,self.subContainer)
        self.rootObj=rootObj        
        self.rootKey=rootKey
        # Se mete un container para el nombre, y para el delete.        
        curBox=mforms.newBox(True)
        curBox.set_padding(3)
        curBox.set_spacing(3)

        label=mforms.newLabel(rootKey)
        label.set_size(140,20)
        curBox.add(label,False,False)
        delbutton=mforms.newButton()
        delbutton.set_text('Delete')
        curBox.add(delbutton,False,True)
        delbutton.add_clicked_callback(lambda:self.onDelete())        
        self.subContainer.add(curBox,False,True)

        # Se aniaden los siguientes campos.
        # Primero, la lista de tablas output.
        self.addMultipleTableSelector('Tablas',rootObj[rootKey],'TABLES')
        
        self.parampanel=mforms.newPanel(mforms.TitledGroupPanel);                    
        self.parampanel.set_title("Parametros");        
        self.paramcontainer=mforms.newBox(True)
        self.paramcontainer.set_padding(10)
        self.paramcontainer.set_spacing(10)
        self.parampanel.add(self.paramcontainer);    
        
        addParamButton=mforms.newButton()
        addParamButton.set_text('Nuevo Parametro')
        
        addParamButton.add_clicked_callback(self.addParam)

        self.paramcontainer.add(addParamButton,False,False)
        addParamButton.set_size(100,30)
        self.subContainer.add(self.parampanel,False,False);
        container.add(self.subContainer,False,False)
        self.parentContainer=container