Example #1
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()
    def __init__(self, conn):
        mforms.Form.__init__(self, None)
        self._conn = conn
        self.set_title("Password Expired")

        vbox = mforms.newBox(False)
        vbox.set_padding(20)
        vbox.set_spacing(18)

        user = conn.parameterValues["userName"]
        l = newLabel("Password for MySQL account '%s'@%s expired.\nPlease pick a new password:"******"Mysql@", "")))
        l.set_style(mforms.BoldStyle)
        vbox.add(l, False, True)

        box = mforms.newTable()
        box.set_padding(1)
        box.set_row_count(3)
        box.set_column_count(2)
        box.set_column_spacing(7)
        box.set_row_spacing(8)

        hbox = mforms.newBox(True)
        hbox.set_spacing(12)
        icon = mforms.newImageBox()
        icon.set_image(mforms.App.get().get_resource_path("wb_lock.png"))
        hbox.add(icon, False, True)
        hbox.add(box, True, True)
        vbox.add(hbox, False, True)

        self.old_password = mforms.newTextEntry(mforms.PasswordEntry)
        box.add(newLabel("Old Password:"******"New Password:"******"Confirm:", True), 0, 1, 2, 3, mforms.HFillFlag)
        box.add(self.confirm, 1, 2, 2, 3, mforms.HFillFlag|mforms.HExpandFlag)

        bbox = newBox(True)
        bbox.set_spacing(8)
        self.ok = newButton()
        self.ok.set_text("OK")

        self.cancel = newButton()
        self.cancel.set_text("Cancel")
        mforms.Utilities.add_end_ok_cancel_buttons(bbox, self.ok, self.cancel)

        vbox.add_end(bbox, False, True)

        self.set_content(vbox)

        self.set_size(500, 260)
        self.center()
    def create_ui(self):
        self.suspend_layout()
        self.set_spacing(16)
        self.content.set_spacing(16)

        colbox = mforms.newBox(False)
        colbox.set_spacing(8)
        colbox.add(mforms.newLabel("Select columns you'd like to export"),
                   False, True)

        self.column_list = newTreeView(mforms.TreeFlatList)
        self.column_list.add_column(mforms.CheckColumnType, "Export", 50, True)
        self.column_list.add_column(mforms.StringColumnType, "Column name",
                                    self.owner.main.get_width(), False)
        self.column_list.end_columns()
        self.column_list.set_allow_sorting(True)
        self.column_list.set_size(200, -1)
        colbox.add(self.column_list, True, True)

        limit_box = mforms.newBox(True)
        limit_box.set_spacing(8)
        limit_box.add(mforms.newLabel("Count: "), False, False)
        self.limit_entry = mforms.newTextEntry()
        self.limit_entry.set_size(50, -1)
        self.limit_entry.add_changed_callback(
            lambda entry=self.limit_entry: self.entry_changed(entry))
        limit_box.add(self.limit_entry, False, False)

        offset_box = mforms.newBox(True)
        offset_box.set_spacing(8)
        offset_box.add(mforms.newLabel("Row Offset: "), False, False)
        self.offset_entry = mforms.newTextEntry()
        self.offset_entry.set_size(50, -1)
        self.offset_entry.add_changed_callback(
            lambda entry=self.offset_entry: self.entry_changed(entry))

        offset_box.add(self.offset_entry, False, False)

        sellall_cb = mforms.newCheckBox()
        sellall_cb.set_text("Select / Deselect all entries")
        sellall_cb.set_active(True)
        sellall_cb.add_clicked_callback(
            lambda cb=sellall_cb: self.sell_all(cb))

        limit_offset = mforms.newBox(True)
        limit_offset.set_spacing(8)
        limit_offset.add(sellall_cb, False, True)
        limit_offset.add_end(limit_box, False, True)
        limit_offset.add_end(offset_box, False, True)

        colbox.add(limit_offset, False, True)
        self.content.add(colbox, True, True)
        self.resume_layout()
Example #4
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()
    def create_ui(self):
        self.suspend_layout()
        self.set_spacing(16)
        self.content.set_spacing(16)
        
        colbox = mforms.newBox(False)
        colbox.set_spacing(8)
        colbox.add(mforms.newLabel("Select columns you'd like to export"), False, True)
        
        self.column_list = newTreeNodeView(mforms.TreeFlatList)
        self.column_list.add_column(mforms.CheckColumnType, "Export", 50, True)
        self.column_list.add_column(mforms.StringColumnType, "Column name", self.owner.main.get_width(), False)
        self.column_list.end_columns()
        self.column_list.set_allow_sorting(True)
        self.column_list.set_size(200, -1)
        colbox.add(self.column_list, True, True)
        
        limit_box = mforms.newBox(True)
        limit_box.set_spacing(8)
        limit_box.add(mforms.newLabel("Count: "), False, False)
        self.limit_entry = mforms.newTextEntry()
        self.limit_entry.set_size(50, -1)
        self.limit_entry.add_changed_callback(lambda entry=self.limit_entry: self.entry_changed(entry))
        limit_box.add(self.limit_entry, False, False)
        
        offset_box = mforms.newBox(True)
        offset_box.set_spacing(8)
        offset_box.add(mforms.newLabel("Row Offset: "), False, False)
        self.offset_entry = mforms.newTextEntry()
        self.offset_entry.set_size(50, -1)
        self.offset_entry.add_changed_callback(lambda entry=self.offset_entry: self.entry_changed(entry))

        offset_box.add(self.offset_entry, False, False)
        
        
        sellall_cb = mforms.newCheckBox()
        sellall_cb.set_text("Select / Deselect all entries")
        sellall_cb.set_active(True)
        sellall_cb.add_clicked_callback(lambda cb = sellall_cb: self.sell_all(cb))
        
        limit_offset = mforms.newBox(True)
        limit_offset.set_spacing(8)
        limit_offset.add(sellall_cb, False, True)
        limit_offset.add_end(limit_box, False, True)
        limit_offset.add_end(offset_box, False, True)

        colbox.add(limit_offset, False, True)
        self.content.add(colbox, True, True)
        self.resume_layout()
    def _add_script_radiobutton_option(self, box, name, caption, path_caption, browser_caption, label_caption, rid):
        holder = mforms.newBox(False)
        holder.set_spacing(4)
        radio = mforms.newRadioButton(rid)
        radio.set_text(caption)
        holder.add(radio, False, True)
        vbox = mforms.newBox(False)
        vbox.set_spacing(4)
        file_box = mforms.newBox(True)
        file_box.set_spacing(4)
        file_box.add(mforms.newLabel(path_caption), False, True)
        file_entry = mforms.newTextEntry()
        file_entry.add_changed_callback(lambda self=self, option=name: setattr(self, name + "_check_duplicate", True))
        file_box.add(file_entry, True, True)
        radio.add_clicked_callback(self._script_radio_option_callback)
        button = mforms.newButton()
        button.set_text("Browse...")
        button.add_clicked_callback(lambda option=name, title=browser_caption: self._browse_files(option, title))
        file_box.add(button, False, True)
        vbox.add(file_box, False, True)
        label = mforms.newLabel(label_caption)
        label.set_style(mforms.SmallHelpTextStyle)
        vbox.add(label, False, True)
        vbox.set_enabled(False)
        holder.add(vbox, False, True)
        box.add(holder, False, True)

        setattr(self, name + "_check_duplicate", False)
        setattr(self, name + "_radiobutton", radio)
        setattr(self, name + "_entry", file_entry)
        setattr(self, name + "_vbox", vbox)
 def create_options(self, box, options):
     optlist = []
     for option in options:
         cont = None
         if option.paramType == "boolean":
             opt = mforms.newCheckBox()
             opt.set_active(self.defaultValue == "1")
             box.add(opt, False, True)
             getter = opt.get_string_value
         elif option.paramType == "string":
             hbox = mforms.newBox(True)
             hbox.set_spacing(8)
             hbox.add(mforms.newLabel(option.caption), False, True)
             opt = mforms.newTextEntry()
             opt.set_value(option.defaultValue)
             hbox.add(opt, True, True)
             l = mforms.newLabel(option.description)
             l.set_style(mforms.SmallHelpTextStyle)
             hbox.add(l, False, True)
             box.add(hbox, False, True)
             cont = hbox
             getter = opt.get_string_value
         else:
             grt.send_error("MigrationWizard", "migrationOption() for source has an invalid parameter of type %s (%s)" % (option.paramType, option.name))
             continue
         optlist.append((cont or opt, option.name, getter))
     return optlist
    def create_ui(self):
        # Main layout structure
        self.server_instance_box = mforms.newBox(False)
        self.server_instance_box.set_spacing(8)
        instance_label = mforms.newLabel('Target RDBMS Connection Parameters')
        instance_label.set_style(mforms.BoldStyle)
        self.server_instance_box.add(instance_label, False, True)

        # TODO: Enable the export to script option in future versions:
#        self.just_script_choice = mforms.newCheckBox()
#        self.just_script_choice.set_text('Do not use a live instance (SQL script output)')
#        self.just_script_choice.set_tooltip('Check this if you just want an output script to execute it later')
#        self.just_script_choice.add_clicked_callback(self.just_script_toggled)
#        self.server_instance_box.add(self.just_script_choice, False)

        # Add the view that corresponds to the selected RDBMS:
        self.panel = grt.classes.ui_db_ConnectPanel()
        self.panel.initialize(grt.root.wb.rdbmsMgmt)
        view = mforms.fromgrt(self.panel.view)
        self.server_instance_box.add(view, True, True)

        box = mforms.newBox(True)
        self._store_connection_check = mforms.newCheckBox()
        self._store_connection_check.set_text("Store connection for future usage as ")
        self._store_connection_check.add_clicked_callback(self._toggle_store_connection)
        box.add(self._store_connection_check, False, False)
        self._store_connection_entry = mforms.newTextEntry()
        box.add(self._store_connection_entry, True, True)
        self._store_connection_entry.set_enabled(False)

        self.server_instance_box.add(box, False, False)
        self.content.add(self.server_instance_box, True, True)

        self.advanced_button.set_text("Test Connection")
    def _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)
Example #10
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)
    def create_ui(self):
        self.back_button.set_enabled(False)

        # Main layout structure
        self.server_instance_box = mforms.newBox(False)
        self.server_instance_box.set_spacing(8)
        instance_label = mforms.newLabel('Source RDBMS Connection Parameters')
        instance_label.set_style(mforms.BoldStyle)
        self.server_instance_box.add(instance_label, False, True)

        # Add the view that corresponds to the selected RDBMS:
        self.panel = grt.classes.ui_db_ConnectPanel()
        self.panel.initializeWithRDBMSSelector(grt.root.wb.rdbmsMgmt, self.supported_sources_instances)
        if not self.panel.view:
            raise Exception("NO PANEL!!!")
        view = mforms.fromgrt(self.panel.view)
        self.server_instance_box.add(view, True, True)
        
        box = mforms.newBox(True)
        self._store_connection_check = mforms.newCheckBox()
        self._store_connection_check.set_text("Store connection for future usage as ")
        self._store_connection_check.add_clicked_callback(self._toggle_store_connection)
        box.add(self._store_connection_check, False, False)
        self._store_connection_entry = mforms.newTextEntry()
        box.add(self._store_connection_entry, True, True)
        self._store_connection_entry.set_enabled(False)

        self.server_instance_box.add(box, False, False)
        self.content.add(self.server_instance_box, True, True)

        self.advanced_button.set_text("Test Connection")
    def _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)
Example #13
0
    def create_numeric(self, name, ctrl_def):
        #spin_box = newBox(True)
        #spin_box.set_spacing(5)
        te = newTextEntry()
        #spin_box.add(te, True, True)
        te.set_enabled(False)
        te.set_tooltip(
            "For numeric values, you may specify a K, M or G size suffix, if appropriate."
        )

        te.add_changed_callback(lambda: self.control_action(name))

        #unit = None
        #if ctrl_def.has_key('unitcontrol'):
        #  unit = ctrl_def['unitcontrol']

        #unitcontrol = None
        #unit_items = None

        #if unit is not None:
        #  unitcontrol = newSelector()
        #  unit_items = unit.split(";")
        #  for item in unit_items:
        #    unitcontrol.add_item(item)
        #
        #  spin_box.add(unitcontrol, False, False)
        #  unitcontrol.set_enabled(False)
        #  unitcontrol.add_changed_callback(lambda: self.control_action(name))

        #return (spin_box, te, unitcontrol, unit_items)
        return te
    def _add_script_radiobutton_option(self, box, name, caption, path_caption,
                                       browser_caption, label_caption, rid):
        holder = mforms.newBox(False)
        holder.set_spacing(4)
        radio = mforms.newRadioButton(rid)
        radio.set_text(caption)
        holder.add(radio, False, True)
        vbox = mforms.newBox(False)
        vbox.set_spacing(4)
        file_box = mforms.newBox(True)
        file_box.set_spacing(4)
        file_box.add(mforms.newLabel(path_caption), False, True)
        file_entry = mforms.newTextEntry()
        file_entry.add_changed_callback(lambda self=self, option=name: setattr(
            self, name + "_check_duplicate", True))
        file_box.add(file_entry, True, True)
        radio.add_clicked_callback(self._script_radio_option_callback)
        button = mforms.newButton()
        button.set_text("Browse...")
        button.add_clicked_callback(lambda option=name, title=browser_caption:
                                    self._browse_files(option, title))
        file_box.add(button, False, True)
        vbox.add(file_box, False, True)
        label = mforms.newLabel(label_caption)
        label.set_style(mforms.SmallHelpTextStyle)
        vbox.add(label, False, True)
        vbox.set_enabled(False)
        holder.add(vbox, False, True)
        box.add(holder, False, True)

        setattr(self, name + "_check_duplicate", False)
        setattr(self, name + "_radiobutton", radio)
        setattr(self, name + "_entry", file_entry)
        setattr(self, name + "_vbox", vbox)
    def create_ui(self):
        # Main layout structure
        self.server_instance_box = mforms.newBox(False)
        self.server_instance_box.set_spacing(8)
        instance_label = mforms.newLabel('Target RDBMS Connection Parameters')
        instance_label.set_style(mforms.BoldStyle)
        self.server_instance_box.add(instance_label, False, True)

        # TODO: Enable the export to script option in future versions:
#        self.just_script_choice = mforms.newCheckBox()
#        self.just_script_choice.set_text('Do not use a live instance (SQL script output)')
#        self.just_script_choice.set_tooltip('Check this if you just want an output script to execute it later')
#        self.just_script_choice.add_clicked_callback(self.just_script_toggled)
#        self.server_instance_box.add(self.just_script_choice, False)

        # Add the view that corresponds to the selected RDBMS:
        self.panel = grt.classes.ui_db_ConnectPanel()
        self.panel.initialize(grt.root.wb.rdbmsMgmt)
        view = mforms.fromgrt(self.panel.view)
        self.server_instance_box.add(view, True, True)

        box = mforms.newBox(True)
        self._store_connection_check = mforms.newCheckBox()
        self._store_connection_check.set_text("Store connection for future usage as ")
        self._store_connection_check.add_clicked_callback(self._toggle_store_connection)
        box.add(self._store_connection_check, False, False)
        self._store_connection_entry = mforms.newTextEntry()
        box.add(self._store_connection_entry, True, True)
        self._store_connection_entry.set_enabled(False)

        self.server_instance_box.add(box, False, False)
        self.content.add(self.server_instance_box, True, True)

        self.advanced_button.set_text("Test Connection")
Example #16
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)
Example #17
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
Example #18
0
 def create_options(self, box, options):
     optlist = []
     for option in options:
         cont = None
         if option.paramType == "boolean":
             opt = mforms.newCheckBox()
             opt.set_active(self.defaultValue == "1")
             box.add(opt, False, True)
             getter = opt.get_string_value
         elif option.paramType == "string":
             hbox = mforms.newBox(True)
             hbox.set_spacing(8)
             hbox.add(mforms.newLabel(option.caption), False, True)
             opt = mforms.newTextEntry()
             opt.set_value(option.defaultValue)
             hbox.add(opt, True, True)
             l = mforms.newLabel(option.description)
             l.set_style(mforms.SmallHelpTextStyle)
             hbox.add(l, False, True)
             box.add(hbox, False, True)
             cont = hbox
             getter = opt.get_string_value
         else:
             grt.send_error("MigrationWizard", "migrationOption() for source has an invalid parameter of type %s (%s)" % (option.paramType, option.name))
             continue
         optlist.append((cont or opt, option.name, getter))
     return optlist
Example #19
0
    def create_ui(self):
        self.back_button.set_enabled(False)

        # Main layout structure
        self.server_instance_box = mforms.newBox(False)
        self.server_instance_box.set_spacing(8)
        instance_label = mforms.newLabel('Source RDBMS Connection Parameters')
        instance_label.set_style(mforms.BoldStyle)
        self.server_instance_box.add(instance_label, False, True)

        # Add the view that corresponds to the selected RDBMS:
        self.panel = grt.classes.ui_db_ConnectPanel()
        self.panel.initializeWithRDBMSSelector(
            grt.root.wb.rdbmsMgmt, self.supported_sources_instances)
        if not self.panel.view:
            raise Exception("NO PANEL!!!")
        view = mforms.fromgrt(self.panel.view)
        self.server_instance_box.add(view, True, True)

        box = mforms.newBox(True)
        self._store_connection_check = mforms.newCheckBox()
        self._store_connection_check.set_text(
            "Store connection for future usage as ")
        self._store_connection_check.add_clicked_callback(
            self._toggle_store_connection)
        box.add(self._store_connection_check, False, False)
        self._store_connection_entry = mforms.newTextEntry()
        box.add(self._store_connection_entry, True, True)
        self._store_connection_entry.set_enabled(False)

        self.server_instance_box.add(box, False, False)
        self.content.add(self.server_instance_box, True, True)

        self.advanced_button.set_text("Test Connection")
Example #20
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
Example #21
0
    def create_numeric(self, name, ctrl_def):
      #spin_box = newBox(True)
      #spin_box.set_spacing(5)
      te = newTextEntry()
      #spin_box.add(te, True, True)
      te.set_enabled(False)
      te.set_tooltip("For numeric values, you may specify a K, M or G size suffix, if appropriate.")

      te.add_changed_callback(lambda: self.control_action(name))

      #unit = None
      #if ctrl_def.has_key('unitcontrol'):
      #  unit = ctrl_def['unitcontrol']

      #unitcontrol = None
      #unit_items = None

      #if unit is not None:
      #  unitcontrol = newSelector()
      #  unit_items = unit.split(";")
      #  for item in unit_items:
      #    unitcontrol.add_item(item)
      #
      #  spin_box.add(unitcontrol, False, False)
      #  unitcontrol.set_enabled(False)
      #  unitcontrol.add_changed_callback(lambda: self.control_action(name))

      #return (spin_box, te, unitcontrol, unit_items)
      return te
    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()
Example #23
0
 def create_textedit(self, name, ctrl_def):
     te = newTextEntry()
     te.set_enabled(False)
     te.add_changed_callback(lambda: self.control_action(name))
     te.set_tooltip("To convert option to a multi-line one, use " +
                    multi_separator + " to separate values. The symbol " +
                    multi_separator + " should not be the first char")
     return te
    def create_ui(self):
        self.suspend_layout()
        self.set_spacing(16)
        
        label = mforms.newLabel("Table Data Export allows you to easily export data into csv, json datafiles.\n")
        label.set_style(mforms.BoldInfoCaptionStyle)

        self.content.add(label, False, False)

        entry_box = mforms.newBox(True)
        entry_box.set_spacing(5)

        entry_box.add(mforms.newLabel("File Path:"), False, True)

        self.exportfile_path = mforms.newTextEntry()
        self.exportfile_path.add_changed_callback(lambda entry=self.exportfile_path: self.entry_changed(entry))
        entry_box.add(self.exportfile_path, True, True)
        if last_location != None:
            self.exportfile_path.set_value(last_location)
            self.confirm_file_overwrite = True
            self.get_module(True)

        browse_btn = mforms.newButton()
        browse_btn.set_text("Browse...")
        browse_btn.add_clicked_callback(self.browse)
        entry_box.add(browse_btn, False, False)
        self.content.add(entry_box, False, True)
        
        radio_box = mforms.newBox(True)
        radio_box.set_spacing(8)
        for format in self.main.formats:
            fradio = mforms.newRadioButton(1)
            fradio.set_text(format.title)
            fradio.set_active(bool(self.active_module and self.active_module.name == format.name))
            fradio.add_clicked_callback(lambda f = format: self.output_type_changed(f))
            radio_box.add(fradio, False, False)
            self.radio_opts.append({'radio':fradio, 'name': format.name})
        self.content.add(radio_box, False, False)

        self.optpanel = mforms.newPanel(mforms.TitledBoxPanel)
        self.optpanel.set_title("Options:")

        self.content.add(self.optpanel, False, True)
        self.optpanel.show(False)
        
        self.export_local_box = mforms.newBox(False)
        self.export_local_cb = mforms.newCheckBox()
        self.export_local_cb.set_text("Export to local machine")
        self.export_local_cb.set_active(True)
        self.export_local_box.add(self.export_local_cb, False, True)
        l = mforms.newLabel("""If checked rows will be exported on the location that started Workbench.\nIf not checked, rows will be exported on the server.\nIf server and computer that started Workbench are different machines, import of that file can be done manual way only.""")
        l.set_style(mforms.SmallHelpTextStyle)
        self.export_local_box.add(l, False, True)
        
        self.content.add(self.export_local_box, False, True)
        self.resume_layout()
        
        self.load_module_options()
    def __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)
Example #26
0
 def add_label_row(self, row, label, help):
     control = mforms.newTextEntry()
     self.table.add(mforms.newLabel(label, True), 0, 1, row, row+1, mforms.HFillFlag)
     self.table.add(control, 1, 2, row, row+1, mforms.HFillFlag|mforms.HExpandFlag)
     l = mforms.newLabel(help)
     l.set_style(mforms.SmallHelpTextStyle)
     self.table.add(l, 2, 3, row, row+1, mforms.HFillFlag)
     control.set_size(100, -1)
     return row+1, control
Example #27
0
 def add_label_row(self, row, label, help):
     control = mforms.newTextEntry()
     self.table.add(mforms.newLabel(label, True), 0, 1, row, row+1, mforms.HFillFlag)
     self.table.add(control, 1, 2, row, row+1, mforms.HFillFlag|mforms.HExpandFlag)
     l = mforms.newLabel(help)
     l.set_style(mforms.SmallHelpTextStyle)
     self.table.add(l, 2, 3, row, row+1, mforms.HFillFlag)
     control.set_size(100, -1)
     return row+1, control
    def load_module_options(self):
        self.suspend_layout()

        self.optpanel.show(False)
        if self.optbox:
            self.optpanel.remove(self.optbox)
        if self.active_module and len(self.active_module.options) != 0:

            def set_text_entry(field, output):
                txt = field.get_string_value().encode('utf-8').strip()
                if len(txt) == 0:
                    operator.setitem(output, 'value', None)
                elif len(txt) == 1:
                    operator.setitem(output, 'value', txt)
                else:
                    field.set_value("")
                    mforms.Utilities.show_error(
                        self.main.title,
                        "Due to the nature of this wizard, you can't use unicode characters in this place, as only one character is allowed.",
                        "Ok", "", "")

            def set_selector_entry(selector, output):
                operator.setitem(
                    output, 'value',
                    output['opts'][str(selector.get_string_value())])

            self.optbox = mforms.newBox(False)
            self.optbox.set_spacing(8)
            self.optbox.set_padding(8)
            for name, opts in self.active_module.options.iteritems():
                label_box = mforms.newBox(True)
                label_box.set_spacing(8)
                label_box.add(mforms.newLabel(opts['description']), False,
                              True)
                if opts['type'] == 'text':
                    opt_val = mforms.newTextEntry()
                    opt_val.set_size(35, -1)
                    opt_val.set_value(opts['value'])
                    opt_val.add_changed_callback(
                        lambda field=opt_val, output=opts: set_text_entry(
                            field, output))
                    label_box.add_end(opt_val, False, True)
                if opts['type'] == 'select':
                    opt_val = mforms.newSelector()
                    opt_val.set_size(75, -1)
                    opt_val.add_items([v for v in opts['opts']])
                    opt_val.set_selected(opts['opts'].values().index(
                        opts['value']))
                    opt_val.add_changed_callback(
                        lambda selector=opt_val, output=opts:
                        set_selector_entry(selector, output))
                    label_box.add_end(opt_val, False, True)
                self.optbox.add(label_box, False, True)
            self.optpanel.add(self.optbox)
            self.optpanel.show(True)
        self.resume_layout()
Example #29
0
 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)        
    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)
    def __init__(self, main):
        WizardPage.__init__(self, main, "Target Creation Options")

        self.main.add_wizard_page(self, "ObjectMigration", "Target Creation Options")

        label = mforms.newLabel("Select options for the creation of the migrated schema in the target\nMySQL server and click [Next >] to execute.")
        self.content.add(label, False, True)

        panel = mforms.newPanel(mforms.TitledBoxPanel)
        panel.set_title("Schema Creation")
        self.content.add(panel, False, True)

        box = mforms.newBox(False)
        panel.add(box)
        box.set_padding(12)

        self._create_db = mforms.newCheckBox()
        self._create_db.set_text("Create schema in target RDBMS")
        box.add(self._create_db, False, True)

        # spacer
        box.add(mforms.newLabel(""), False, True)

        self._create_script = mforms.newCheckBox()
        self._create_script.set_text("Create a SQL script file")
        self._create_script.add_clicked_callback(self._toggle_sql_script)
        box.add(self._create_script, False, True)
        self._file_hbox = mforms.newBox(True)
        self._file_hbox.set_spacing(4)
        self._file_hbox.add(mforms.newLabel("Script File:"), False, True)
        self._create_script_file = mforms.newTextEntry()
        self._create_script_file.set_value(os.path.join(os.path.expanduser('~'), 'migration_script.sql'))
        self._file_hbox.add(self._create_script_file, True, True)
        button = mforms.newButton()
        button.set_text("Browse...")
        button.add_clicked_callback(self._browse_files)
        self._file_hbox.add(button, False, True)
        box.add(self._file_hbox, False, True)

        panel = mforms.newPanel(mforms.TitledBoxPanel)
        panel.set_title("Options")
        self.content.add(panel, False, True)

        box = mforms.newBox(False)
        panel.add(box)
        box.set_padding(12)
        box.set_spacing(8)

        self._keep_schema = mforms.newCheckBox()
        self._keep_schema.set_text("Keep schemas if they already exist. Objects that already exist will not be recreated or updated.")
        box.add(self._keep_schema, False, True)

        self._create_db.set_active(True)
        self._toggle_sql_script()
        self._check_file_duplicate = True
    def __init__(self, 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
Example #33
0
  def addTextInput(self,label,saveObject,objectKey,Help='None'):
    curBox=self.createBaseInput(label)
    input=mforms.newTextEntry()
    input.set_size(200,20)
    curBox.add(input,False,True)
    input.add_changed_callback(lambda:self.changeTextValue(input,saveObject,objectKey))

    if saveObject.has_key(objectKey):
        input.set_value(saveObject[objectKey])
    if Help!=None:
        curBox.add(mforms.newLabel(Help),False,True)
 def search(self, grid_name):
   tBox = PropelForm.spaced_box(True)
   self.widgets[grid_name + '_search_label'] = mforms.newLabel("table pattern")
   tBox.add(self.widgets[grid_name + '_search_label'], False, True)
   self.widgets[grid_name + '_search_pattern'] = mforms.newTextEntry()
   tBox.add(self.widgets[grid_name + '_search_pattern'], True, True)
   self.widgets[grid_name + '_search_button'] = mforms.newButton()
   self.widgets[grid_name + '_search_button'].set_text("matching tables")
   self.widgets[grid_name + '_search_match_count'] = mforms.newLabel("")
   self.widgets[grid_name + '_search_button'].add_clicked_callback(lambda: self.find_rows(0))
   tBox.add(self.widgets[grid_name + '_search_button'], False, True)
   tBox.add(self.widgets[grid_name + '_search_match_count'], False, True)
   self.add(tBox, False, True)
    def create_ui(self):
        self.set_spacing(16)

        self.content.add(self.schema_label, False, True)

        entry_box = mforms.newBox(True)
        entry_box.set_spacing(5)

        entry_box.add(mforms.newLabel("File Path:"), False, True)

        self.shapefile_path = mforms.newTextEntry()
        entry_box.add(self.shapefile_path, True, True)

        self.shapefile_browse_btn = newButton()
        self.shapefile_browse_btn.set_text("Browse...")
        self.shapefile_browse_btn.add_clicked_callback(self.shapefile_browse)
        entry_box.add(self.shapefile_browse_btn, False, False)

        self.content.add(entry_box, False, True)

        label = mforms.newLabel(
            """Select a shapefile containing spatial data to load into MySQL.
A new table with the imported fields will be created in the selected schema,
unless the append or update options are specified.""")
        self.content.add(label, False, False)

        self.dbf_box = mforms.newBox(True)
        self.dbf_box.set_spacing(8)
        self.dbf_icon = mforms.newImageBox()
        self.dbf_icon.set_image("task_unchecked%s.png" % os_icon_suffix)
        self.dbf_box.add(self.dbf_icon, False, True)
        dbf_label = mforms.newLabel("Check if dbf file is present")
        self.dbf_box.add(dbf_label, True, True)
        self.dbf_box.show(True)

        self.content.add(self.dbf_box, False, True)

        self.proj_box = mforms.newBox(True)
        self.proj_box.set_spacing(8)
        self.proj_icon = mforms.newImageBox()
        self.proj_icon.set_image("task_unchecked%s.png" % os_icon_suffix)
        self.proj_box.add(self.proj_icon, False, True)
        proj_label = mforms.newLabel("Check if prj file is present")
        self.proj_box.add(proj_label, True, True)
        self.proj_box.show(True)

        self.content.add(self.proj_box, False, True)

        self.warning_srs = mforms.newLabel("")
        self.content.add(self.warning_srs, False, True)
    def create_ui(self):
        self.set_spacing(16)

        self.content.add(self.schema_label, False, True)

        entry_box = mforms.newBox(True)
        entry_box.set_spacing(5)

        entry_box.add(mforms.newLabel("File Path:"), False, True)

        self.shapefile_path = mforms.newTextEntry()
        entry_box.add(self.shapefile_path, True, True)

        self.shapefile_browse_btn = newButton()
        self.shapefile_browse_btn.set_text("Browse...")
        self.shapefile_browse_btn.add_clicked_callback(self.shapefile_browse)
        entry_box.add(self.shapefile_browse_btn, False, False)

        self.content.add(entry_box, False, True)

        label = mforms.newLabel("""Select a shapefile containing spatial data to load into MySQL.
A new table with the imported fields will be created in the selected schema,
unless the append or update options are specified.""")
        self.content.add(label, False, False)

        self.dbf_box = mforms.newBox(True)
        self.dbf_box.set_spacing(8)
        self.dbf_icon = mforms.newImageBox()
        self.dbf_icon.set_image("task_unchecked%s.png" % os_icon_suffix)
        self.dbf_box.add(self.dbf_icon, False, True)
        dbf_label = mforms.newLabel("Check if dbf file is present")
        self.dbf_box.add(dbf_label, True, True)
        self.dbf_box.show(True)
         
        self.content.add(self.dbf_box, False, True)
         
        self.proj_box = mforms.newBox(True)
        self.proj_box.set_spacing(8)
        self.proj_icon = mforms.newImageBox()
        self.proj_icon.set_image("task_unchecked%s.png" % os_icon_suffix)
        self.proj_box.add(self.proj_icon, False, True)
        proj_label = mforms.newLabel("Check if prj file is present")
        self.proj_box.add(proj_label, True, True)
        self.proj_box.show(True)
         
        self.content.add(self.proj_box, False, True)
        
        self.warning_srs = mforms.newLabel("")
        self.content.add(self.warning_srs, False, True)
 def add_check_entry_row(table, row, label, name):
     check = mforms.newCheckBox()
     check.set_text(label)
     table.add(check, 0, 1, row, row+1, mforms.HFillFlag)
     entry = mforms.newTextEntry()
     entry.add_changed_callback(self.save_changes)
     table.add(entry, 1, 2, row, row+1, mforms.HFillFlag|mforms.HExpandFlag) 
     setattr(self, name+"_check", check)
     setattr(self, name+"_entry", entry)
     entry.set_enabled(False)
     def callback(entry, check):
         if not check.get_active():
             entry.set_value("-2")
         entry.set_enabled(check.get_active())
         self.save_changes()
     check.add_clicked_callback(lambda: callback(entry, check))
 def browse_extra_behaviors_box(self):
   tBox = PropelForm.spaced_box(True)
   label = mforms.newLabel("extra behaviors")
   tBox.add(label, False, True)
   self.widgets['extra_behaviors_path'] = mforms.newTextEntry()
   self.widgets['extra_behaviors_path'].set_value(self.db.cache['extra_behaviors_path'])
   tBox.add(self.widgets['extra_behaviors_path'], True, True)
   self.widgets['extra_behaviors_file'] = mforms.newFileChooser(mforms.OpenFile)
   self.widgets['extra_behaviors_file'].set_extensions('Python files (*.py)|*.py','py')
   self.widgets['extra_behaviors_file'].set_title("extra behaviors file")
   browse = mforms.newButton()
   browse.set_text("Browse")
   browse.add_clicked_callback(lambda: self.browse_schema())
   tBox.add(browse, False, True)
   label = mforms.newLabel("see http://m4z3.me/extrabehaviors for details")
   tBox.add(label, False, True)
   self.add_end(tBox, False, True)
Example #39
0
    def create_dir_file_edit(self, name, ctrl_def):
      dir_box = newBox(True)
      dir_box.set_spacing(4)

      te = newTextEntry()
      te.set_tooltip("To convert option to a multi-line one, use " + multi_separator + " to separate values. The symbol " + multi_separator + " should not be the first char")
      btn = newButton()
      btn.set_text("...")
      btn.enable_internal_padding(False)
      btn.add_clicked_callback(lambda: self.open_file_chooser(OpenDirectory, te, name))

      dir_box.add(te, True, True)
      dir_box.add(btn, False, False)
      te.set_enabled(False)
      btn.set_enabled(False)

      return (dir_box, te, btn)
Example #40
0
    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)
    def load_module_options(self):
        self.suspend_layout()
        
        self.optpanel.show(False)
        if self.optbox:
            self.optpanel.remove(self.optbox)
        if self.active_module and len(self.active_module.options) != 0:
            def set_text_entry(field, output):
                txt = field.get_string_value().encode('utf-8').strip()
                if len(txt) == 0:
                    operator.setitem(output, 'value', None)
                elif len(txt) == 1:
                    operator.setitem(output, 'value', txt)
                else:
                    field.set_value("")
                    mforms.Utilities.show_error(self.main.title, "Due to the nature of this wizard, you can't use unicode characters in this place, as also only one character is allowed.","Ok","","")
                    

            def set_selector_entry(selector, output):
                operator.setitem(output, 'value', output['opts'][str(selector.get_string_value())])
            
            self.optbox = mforms.newBox(False)
            self.optbox.set_spacing(8)
            self.optbox.set_padding(8)
            for name, opts in self.active_module.options.iteritems():
                label_box = mforms.newBox(True)
                label_box.set_spacing(8)
                label_box.add(mforms.newLabel(opts['description']), False, False)
                if opts['type'] == 'text':
                    opt_val = mforms.newTextEntry()
                    opt_val.set_size(35, -1)
                    opt_val.set_value(opts['value'])
                    opt_val.add_changed_callback(lambda field = opt_val, output = opts: set_text_entry(field, output))
                    label_box.add_end(opt_val, False, False)
                if opts['type'] == 'select':
                    opt_val = mforms.newSelector()
                    opt_val.set_size(75, -1)
                    opt_val.add_items([v for v in opts['opts']])
                    opt_val.set_selected(opts['opts'].values().index(opts['value']))
                    opt_val.add_changed_callback(lambda selector = opt_val, output = opts: set_selector_entry(selector, output))
                    label_box.add_end(opt_val, False, False)
                self.optbox.add(label_box, False, False)
            self.optpanel.add(self.optbox)
            self.optpanel.show(True)        
        self.resume_layout()
Example #42
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()
 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)
    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()
        def add_check_entry_row(table, row, label, name):
            check = mforms.newCheckBox()
            check.set_text(label)
            table.add(check, 0, 1, row, row + 1, mforms.HFillFlag)
            entry = mforms.newTextEntry()
            entry.add_changed_callback(self.save_changes)
            table.add(entry, 1, 2, row, row + 1,
                      mforms.HFillFlag | mforms.HExpandFlag)
            setattr(self, name + "_check", check)
            setattr(self, name + "_entry", entry)
            entry.set_enabled(False)

            def callback(entry, check):
                if not check.get_active():
                    entry.set_value("-2")
                entry.set_enabled(check.get_active())
                self.save_changes()

            check.add_clicked_callback(lambda: callback(entry, check))
 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)
Example #47
0
    def create_destination_tab(self):
        self._destination = newBox(False)
        self._destination.set_spacing(12)
        self._destination.set_padding(12)
        self._configuration.add_page(self._destination, "Options")

        table = mforms.newTable()

        table.set_row_count(7)
        table.set_column_count(2)
        table.set_row_spacing(8)
        table.set_column_spacing(4)

        add_table_field_label(table, 0, "Backup Storage Directory:")
        hbox = mforms.newBox(True)
        self._dest_directory  = newTextEntry()
        self._dest_directory.set_size(300,-1)
        hbox.add(self._dest_directory, False, False)
        self._dest_dir_button = newButton()
        self._dest_dir_button.set_text("Browse...")
        self._dest_dir_button.enable_internal_padding(False)
        self._dest_dir_button.add_clicked_callback(lambda: self.open_file_chooser(OpenDirectory, self._dest_directory))
        
        hbox.add(self._dest_dir_button, False, False)
        add_table_field_value(table, 0, hbox, mforms.HFillFlag)

        l = mforms.newLabel("Backups will be written to the specified directory in the target MySQL server.\nA new subdirectory is created for each backup, named with its timestamp.")
        l.set_style(mforms.SmallHelpTextStyle)
        add_table_field_value(table, 1, l)
        
        self._compress_backup = mforms.newCheckBox()
        self._compress_backup.set_text("Compress backup (non-incremental InnoDB backups only)")
        add_table_field_value(table, 3, self._compress_backup)
        
        self._apply_log = mforms.newCheckBox()
        self._apply_log.set_text("Apply log after backup (backup-and-apply-log)")
        add_table_field_value(table, 5, self._apply_log)
        l = mforms.newLabel("After a backup is done, an apply-log operation is needed before it can be recovered.\nThat may be done right after backup, before recovering it or at any other time.")
        l.set_style(mforms.SmallHelpTextStyle)
        add_table_field_value(table, 6, l)
        
        self._destination.add(table, False, False)
Example #48
0
    def __init__(self, container, tName, tData):
        self.tName=tName
        self.tData=tData        
        UIHelper.__init__(self,container)
        curBox=mforms.newBox(True)
        curBox.set_padding(3)
        curBox.set_spacing(3)        
        self.container.add(curBox,False,False)        

        self.newLabel=mforms.newTextEntry()
        self.newLabel.set_size(200,20)
        addButton=mforms.newButton()
        addButton.set_text('Nueva')        
        curBox.add(self.newLabel,False,False)
        curBox.add(addButton,False,False)
        self.lastCreated=None
        addButton.add_clicked_callback(lambda:self.onNew())
        if self.tData.customData.has_key("Queries"):
            for k in self.tData.customData["Queries"].keys():
                cQ=SingleQuery(self,self.container,self.tData.customData["Queries"],k);
Example #49
0
    def create_dir_file_edit(self, name, ctrl_def):
        dir_box = newBox(True)
        dir_box.set_spacing(4)

        te = newTextEntry()
        te.set_tooltip("To convert option to a multi-line one, use " +
                       multi_separator + " to separate values. The symbol " +
                       multi_separator + " should not be the first char")
        btn = newButton()
        btn.set_text("...")
        btn.enable_internal_padding(False)
        btn.add_clicked_callback(
            lambda: self.open_file_chooser(OpenDirectory, te, name))

        dir_box.add(te, True, True)
        dir_box.add(btn, False, False)
        te.set_enabled(False)
        btn.set_enabled(False)

        return (dir_box, te, btn)
    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)
Example #51
0
  def __init__(self,c,o,k):
    self.c=c    
    self.o=o
    self.k=k
    self.container=mforms.newBox(False)
    self.buttonContainer=mforms.newBox(True)
    self.container.add(self.buttonContainer, True, True)
    self.buttons={}
    if o.has_key(k):
        v=o[k]
        for k in v:
            self.buttons[k]=CustomMultipleSelectorButton(self.buttonContainer,self,k)

    selContainer=mforms.newBox(True)
    self.container.add(selContainer,False,True)
    
    self.entry=mforms.newTextEntry()
    self.entry.set_size(200,20)
    selContainer.add(self.entry,False,True)
    selectButton=mforms.newButton();
    selectButton.add_clicked_callback(lambda:self.addCurrent())
    selectButton.set_text('Add');
    selContainer.add(selectButton,False,True)    
    self.c.add(self.container,True,True)
    def create_ui(self):
        self.set_spacing(16)
        self.content.set_padding(16)
        
        layer_box = mforms.newBox(True)
        layer_box.set_spacing(16)
        layer_heading = mforms.newLabel("Layer name:")
        layer_box.add(layer_heading, False, False)
        self.layer_name_lbl = mforms.newLabel("")
        layer_box.add(self.layer_name_lbl, False, False)
        self.content.add(layer_box, False, False)

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

        entry_box.add(mforms.newLabel("Destination table:"), False, True)

        self.table_name = mforms.newTextEntry()
        entry_box.add(self.table_name, True, True)
        
        self.content.add(entry_box, False, True)
        entry_box.show(True)

        cbox = mforms.newBox(False)

        self.column_list = newTreeNodeView(mforms.TreeFlatList)
        self.column_list.add_column(mforms.CheckColumnType, "", 40, True)
        self.column_list.add_column(mforms.StringColumnType, "Column name", 300, False)
        self.column_list.end_columns()
        self.column_list.set_size(-1, 100)

        cbox.add(self.column_list, False, True)
        cbox.add(small_label("Please select columns you'd like to import"), False, True)

        self.content.add(cbox, False, True)
        cbox.show(True)
        
        options_layer = mforms.newPanel(mforms.TitledBoxPanel)
        options_layer.set_title("Additional options")
        
        options_box = mforms.newBox(False)
        options_box.set_spacing(12)
        options_box.set_padding(12)
        
        boxfailures = mforms.newBox(False)
        
        self.skipfailures_chb = newCheckBox()
        self.skipfailures_chb.set_text("Skip failures");
        self.skipfailures_chb.set_active(False)
        
        boxfailures.add(self.skipfailures_chb, False, False)
        boxfailures.add(small_label("if error occurs, skip it and continue processing the data"), False, False)
        options_box.add(boxfailures, False, False)
        
        boxappend = mforms.newBox(False)
        
        self.append_chb = newCheckBox()
        self.append_chb.set_text("Append to existing data");
        self.append_chb.set_active(False)
        boxappend.add(self.append_chb, False, False)
        boxappend.add(small_label("append to existing table instead of creating new one"), False, False)
        options_box.add(boxappend, False, False)
        
        boxoverwrite = mforms.newBox(False)
        
        self.overwrite_chb = newCheckBox()
        self.overwrite_chb.set_text("Overwrite existing data");
        self.overwrite_chb.set_active(False)
        boxoverwrite.add(self.overwrite_chb, False, False)
        boxoverwrite.add(small_label("delete current table and recreate it empty"), False, False)
        options_box.add(boxoverwrite, False, False)
        
        options_layer.add(options_box)
        options_layer.show(True)
        
        self.content.add(options_layer, False, False)

        boxconvert = mforms.newBox(False)
        self.cartesian_convert_chb = newCheckBox()
        self.cartesian_convert_chb.set_text("Convert data to cartesian coordinate system");
        self.cartesian_convert_chb.set_active(True)

        boxconvert.add(self.cartesian_convert_chb, False, True)
        boxconvert.add(small_label("MySQL supports only Cartesian format. Leaving this checkbox in its initial state will convert the data which may lead to data loss"), False, False)
        
        self.content.add(boxconvert, False, True)
        self.get_info()
Example #53
0
    def __init__(self, owner, context):
        mforms.Box.__init__(self, False)
        self._owner = owner
        self._context = context
        self._profile = None
        self._days   = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
        self._months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
        self._freqs =  ["Hour", "Day", "Week", "Month"]
        self._monthdays = []
        
        self.profile_saved_callback = None
        self.profile_delete_callback = None
        self.label_validation = None

        for index in range(31):
            suffix = "th"
            day = index+1
            if day in [1,21,31]:
                suffix = "st"
            elif day in [2,22]:
                suffix = "nd"
            elif day in [3,23]:
                suffix = "rd"
          
            self._monthdays.append(str(day) + suffix)
            

        table = mforms.newTable()
        table.set_padding(12)
        table.set_row_count(1)
        table.set_column_count(2)
        table.set_row_spacing(6)
        table.set_column_spacing(4)

        add_table_field_label(table, 0, "Profile Name:")
        self._name = newTextEntry()
        self._name.add_changed_callback(self.name_edited)
        self._name.set_size(200, -1)
        self._backup_type = newLabel("", True)
        hbox = newBox(True)
        hbox.set_spacing(12)
        hbox.set_padding(12)
        hbox.add(self._name, False, True)
        hbox.add(self._backup_type, False, True)
        table.add(hbox, 1, 2, 0, 1, mforms.HFillFlag)

        self.add(table, True, True)

        # Creates the configuration tabs
        self._configuration = newTabView(False)
        self.add(self._configuration, True, True)
        
        # enable back when supported self.create_contents_tab()
        self.create_destination_tab()
        self.create_schedule_tab()
        self.create_comments_tab()

        # Creates the buttons line at the bottom of the screen
        hbox = newBox(True)
        hbox.set_spacing(12)
        hbox.set_padding(12)
        self.add(hbox, False, True)

        self._cancel_button = mforms.newButton()
        self._cancel_button.set_text("Cancel")
        self._cancel_button.add_clicked_callback(self.cancel_changes)
        hbox.add_end(self._cancel_button, False, True)

        self._ok_button = mforms.newButton()
        self._ok_button.set_text("Save and Reschedule")
        self._ok_button.add_clicked_callback(self.save_changes)
        hbox.add_end(self._ok_button, False, True)

        self._del_job_button = mforms.newButton()
        self._del_job_button.set_text("Delete")
        self._del_job_button.add_clicked_callback(self.delete_clicked)
        hbox.add_end(self._del_job_button, False, True)
Example #54
0
    def __init__(self, editor):
        mforms.Box.__init__(self, False)
        self.set_managed()
        self.set_release_on_add()

        self.editor = editor

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

        heading = mforms.newLabel("Table Maintenance Operations")
        heading.set_style(mforms.BigStyle)
        self.add(heading, False, True)

        help = mforms.newLabel(
            "Select tables and click the operation you want to perform.\nNOTE: Some commands may require locking tables until completion,\nwhich may take a long time for large tables."
        )
        self.add(help, False, True)

        self.scroll = mforms.newScrollPanel(0)
        self.add(self.scroll, True, True)
        self.content = mforms.newBox(False)
        self.content.set_spacing(8)
        self.content.set_padding(12)
        self.scroll.add(self.content)

        self._buttons = []

        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)

        self.analyze_local = mforms.newCheckBox()
        self.analyze_local.set_text("Don't write to BINLOG (local)")

        make_command_box(
            self.analyze_table, "Analyze Table",
            """Analyzes and stores the key distribution for a table.
During the analysis, the table is locked with a read lock for InnoDB and MyISAM.""",
            """With InnoDB tables, when you enable the innodb_stats_persistent option, you must run ANALYZE TABLE after loading substantial data into an InnoDB table, or creating a new index for one.

MySQL uses the stored key distribution to decide the order in which tables should be joined when you perform a join on something other than a constant. In addition, key distributions can be used when deciding which indexes to use for a specific table within a query.""",
            [self.analyze_local])

        if editor.serverVersion.majorNumber > 5 or (
                editor.serverVersion.majorNumber == 5
                and editor.serverVersion.minorNumber >= 6):
            extra_options = mforms.newBox(True)
            extra_options.set_spacing(4)

            self.optimize_ft_only = mforms.newCheckBox()
            self.optimize_ft_only.set_text("Optimize FULLTEXT only")
            self.optimize_ft_only.add_clicked_callback(
                self.optimize_ft_only_toggled)
            extra_options.add(self.optimize_ft_only, False, True)

            l = mforms.newLabel("")
            l.set_size(20, -1)
            extra_options.add(l, False, True)

            extra_options.add(
                mforms.newLabel("Number of words to optimize per run:"), False,
                True)
            self.optimize_ft_numwords = mforms.newTextEntry()
            self.optimize_ft_numwords.set_size(50, -1)
            self.optimize_ft_numwords.set_enabled(False)
            extra_options.add(self.optimize_ft_numwords, False, True)

            result = editor.executeManagementQuery(
                "SHOW VARIABLES LIKE 'innodb_ft_num_word_optimize'", 0)
            if result and result.goToFirstRow():
                self.optimize_ft_numwords.set_value(result.stringFieldValue(1))
        else:
            extra_options = None
            self.optimize_ft_only = None

        self.optimize_local = mforms.newCheckBox()
        self.optimize_local.set_text("Don't write to BINLOG (local)")

        make_command_box(
            self.optimize_table, "\n\n" + "Optimize Table",
            """Reorganizes the physical storage of table data and associated index data, 
to reduce storage space and improve I/O efficiency when accessing the table.""",
            """The exact changes made to each table depend on the storage engine used by that table.

Use OPTIMIZE TABLE in these cases, depending on the type of table:

* After doing substantial insert, update, or delete operations on an InnoDB table that has its own .ibd file. The table and indexes are reorganized, and disk space can be reclaimed for use by the operating system.

* After doing substantial insert, update, or delete operations on columns that are part of a FULLTEXT index in an InnoDB table. Set the configuration option innodb_optimize_fulltext_only=1 first. To keep the index maintenance period to a reasonable time, set the innodb_ft_num_word_optimize option to specify how many words to update in the search index, and run Optimize Table until the search index is fully updated.""",
            [self.optimize_local], extra_options)

        self.check_scan_opt = mforms.newSelector()
        self.check_scan_opt.add_items(
            ["", "Quick", "Medium", "Extended", "For Upgrade"])

        self.check_fast_opt = mforms.newCheckBox()
        self.check_fast_opt.set_text("Fast")

        self.check_changed_opt = mforms.newCheckBox()
        self.check_changed_opt.set_text("Changed")

        options = [
            self.check_scan_opt, self.check_fast_opt, self.check_changed_opt
        ]

        make_command_box(
            self.check_table, "\n\n" + "Check Table",
            """CHECK TABLE checks a table or tables for errors. 
For MyISAM tables, the key statistics are updated as well.""",
            """The FOR UPGRADE option checks whether the named tables are compatible with the current version of MySQL. With FOR UPGRADE, the server checks each table to determine whether there have been any incompatible changes in any of the table's data types or indexes since the table was created.
                             
Check Options:
- QUICK    Do not scan the rows to check for incorrect links. Applies to InnoDB and MyISAM tables and views.
- FAST    Check only tables that have not been closed properly. Applies only to MyISAM tables and views; ignored for InnoDB.
- CHANGED    Check only tables that have been changed since the last check or that have not been closed properly. Applies only to MyISAM tables and views; ignored for InnoDB.
- MEDIUM    Scan rows to verify that deleted links are valid. This also calculates a key checksum for the rows and verifies this with a calculated checksum for the keys. Applies only to MyISAM tables and views; ignored for InnoDB.
- EXTENDED    Do a full key lookup for all keys for each row. This ensures that the table is 100% consistent, but takes a long time. Applies only to MyISAM tables and views; ignored for InnoDB.""",
            options)

        # The manual is full of scary warnings about this one, maybe better just leave user perform it by hand
        #        make_command_box("\n"+"Repair Table",
        #                         """""",
        #                         """
        #                             """)

        self.checksum_quick = mforms.newCheckBox()
        self.checksum_quick.set_text("Quick (if supported)")
        options = [self.checksum_quick]
        make_command_box(
            self.checksum_table, "\n\n" + "Checksum Table",
            """CHECKSUM TABLE reports a checksum for the contents of a table.""",
            """You can use this statement to verify that the contents are the same before and after a backup, rollback, or other operation that is intended to put the data back to a known state.""",
            options)
    def create_ui(self):
        self.set_spacing(16)
        layer_box = mforms.newBox(True)
        layer_box.set_spacing(8)
        layer_heading = mforms.newLabel("Layer name:")
        layer_box.add(layer_heading, False, False)
        self.layer_name_lbl = mforms.newLabel("")
        layer_box.add(self.layer_name_lbl, False, False)
        self.content.add(layer_box, False, False)

        epsg_box = mforms.newBox(True)
        epsg_box.set_spacing(8)
        epsg_box_heading = mforms.newLabel("EPSG:")
        epsg_box.add(epsg_box_heading, False, False)
        self.epsg_lbl = mforms.newLabel("")
        epsg_box.add(self.epsg_lbl, False, False)
        self.content.add(epsg_box, False, False)

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

        entry_box.add(mforms.newLabel("Destination table:"), False, True)

        self.table_name = mforms.newTextEntry()
        entry_box.add(self.table_name, True, True)

        self.content.add(entry_box, False, True)
        entry_box.show(True)

        cbox = mforms.newBox(False)

        self.column_list = newTreeView(mforms.TreeFlatList)
        self.column_list.add_column(mforms.CheckColumnType, "", 40, True)
        self.column_list.add_column(mforms.StringColumnType, "Column name",
                                    300, False)
        self.column_list.end_columns()
        self.column_list.set_size(-1, 150)

        cbox.add(small_label("Please select the columns you want to import:"),
                 False, True)
        cbox.add(self.column_list, False, True)

        self.content.add(cbox, False, True)
        cbox.show(True)

        options_layer = mforms.newPanel(mforms.TitledBoxPanel)
        options_layer.set_title("Additional options")

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

        boxfailures = mforms.newBox(False)

        self.skipfailures_chb = newCheckBox()
        self.skipfailures_chb.set_text("Skip failures")
        self.skipfailures_chb.set_active(False)

        boxfailures.add(self.skipfailures_chb, False, False)
        boxfailures.add(
            small_label(
                "If an error occurs ignore it and continue processing data."),
            False, False)
        options_box.add(boxfailures, False, False)

        boxappend = mforms.newBox(False)

        self.append_chb = newCheckBox()
        self.append_chb.set_text("Append to existing data")
        self.append_chb.set_active(False)
        boxappend.add(self.append_chb, False, False)
        boxappend.add(
            small_label(
                "Append to existing table instead of creating a new one."),
            False, False)
        options_box.add(boxappend, False, False)

        boxoverwrite = mforms.newBox(False)

        self.overwrite_chb = newCheckBox()
        self.overwrite_chb.set_text("Overwrite existing data")
        self.overwrite_chb.set_active(False)

        self.append_chb.add_clicked_callback(
            lambda checkbox1=self.append_chb, checkbox2=self.overwrite_chb:
            self.one_check_only(checkbox1, checkbox2))
        self.overwrite_chb.add_clicked_callback(
            lambda checkbox2=self.append_chb, checkbox1=self.overwrite_chb:
            self.one_check_only(checkbox1, checkbox2))
        boxoverwrite.add(self.overwrite_chb, False, False)
        boxoverwrite.add(
            small_label("Drop the selected table and recreate it."), False,
            False)
        options_box.add(boxoverwrite, False, False)

        if self.support_spatial_index:
            boxspatial = mforms.newBox(False)
            self.spatial_index_chb = newCheckBox()
            self.spatial_index_chb.set_text("Create spatial index")
            self.spatial_index_chb.set_active(False)
            boxspatial.add(self.spatial_index_chb, False, False)
            boxspatial.add(
                small_label(
                    "import will make spatial index around geometry column"),
                False, False)
            options_box.add(boxspatial, False, False)

        options_layer.add(options_box)
        options_layer.show(True)

        self.content.add(options_layer, False, False)

        boxconvert = mforms.newBox(False)
        entry_box = mforms.newBox(True)
        entry_box.set_spacing(8)
        entry_box.add(mforms.newLabel("Convert data to the following EPSG:"),
                      False, True)
        self.convert_to_epsg = mforms.newTextEntry()
        entry_box.add(self.convert_to_epsg, False, False)
        boxconvert.add(entry_box, True, True)
        boxconvert.add(
            small_label("leave empty to import the data with no conversion"),
            False, False)

        self.content.add(boxconvert, False, True)
        self.get_info()
Example #56
0
    def __init__(self, ctrl_be, variables, command):
        mforms.Box.__init__(self, False)
        self.set_managed()

        self.suspend_layout()

        self.command = command
        self.ctrl_be = ctrl_be

        box = newBox(True)
        box.set_spacing(12)
        self.add(box, True, True)
        self.tree = newTreeView(mforms.TreeDefault)
        self.tree.set_size(180, -1)

        sidebox = newBox(False)

        box.add(sidebox, False, True)

        self.searchEntry = newTextEntry(mforms.SearchEntry)

        sidebox.set_spacing(12)
        sidebox.add(self.searchEntry, False, True)
        sidebox.add(self.tree, True, True)

        self.searchEntry.add_changed_callback(self.filterOutput)

        self.tree.add_column(mforms.StringColumnType, "", 160, False)
        self.tree.end_columns()
        self.tree.add_changed_callback(weakcb(self, "refresh"))

        self.values = newTreeView(mforms.TreeDefault)
        box.add(self.values, True, True)

        self.values.add_column(mforms.StringColumnType, "Name", 200, False)
        self.values.add_column(mforms.StringColumnType, "Value", 120, False)
        self.values.add_column(mforms.StringColumnType, "Description", 1000, False)
        self.values.end_columns()
        self.values.set_allow_sorting(True)

        box = newBox(True)
        box.set_spacing(8)
        copy_all_button = newButton()
        copy_all_button.set_text("Copy Global Status and Variables to Clipboard")
        copy_all_button.add_clicked_callback(self.copy_status_to_clipboard)
        box.add(copy_all_button, False, False)
        copy_shown_button = newButton()
        copy_shown_button.set_text("Copy Shown Variables to Clipboard")
        copy_shown_button.add_clicked_callback(self.copy_visible_vars_to_clipboard)
        box.add(copy_shown_button, False, False)
        button = newButton()
        box.add_end(button, False, True)
        button.set_text("Refresh")
        box.set_padding(12)

        button.add_clicked_callback(weakcb(self, "refresh"))

        self.add(box, False, True)

        self.groups = {}
        self.descriptions = {}

        def analyze(tree, level, d, groupd, version, vars, existing_vars):
            groups = {}
            variables = []
            for group_name, group_variables in vars.iteritems():
                vars_added_to_the_group = []
                groups[group_name] = vars_added_to_the_group
                for v in group_variables:
                    if v.var in existing_vars:
                        name = v.var
                        variables.append(name)
                        vars_added_to_the_group.append(v.var)
                        d[name] = v.description
                        existing_vars.remove(name)
                if vars_added_to_the_group:
                    row = tree.add_row()
                    tree.set_string(row, 0, group_name)
                    tree.set_row_tag(row, group_name)
            return groups, variables

        row = self.tree.add_row()
        self.tree.set_string(row, 0, "All")
        row = self.tree.add_row()
        self.tree.set_string(row, 0, "Search Results")
        self.resume_layout()

        variables_in_server = []
        result = self.ctrl_be.exec_query(self.command)
        if result is not None:
            while result.nextRow():
                name = result.stringByName("Variable_name")
                variables_in_server.append(name)

        allgroups, allvars = analyze(
            self.tree,
            0,
            self.descriptions,
            self.groups,
            self.ctrl_be.get_server_version(),
            variables,
            variables_in_server,
        )
        if variables_in_server:
            allvars += variables_in_server
            group_name = "Other"
            allgroups[group_name] = variables_in_server
            row = self.tree.add_row()
            self.tree.set_string(row, 0, group_name)
            self.tree.set_row_tag(row, group_name)

        self.groups = allgroups
        self.known_variables = allvars
Example #57
0
    def __init__(self, group_container, vars):
        mforms.Form.__init__(self, None)
        self.pending_changes = False
        self.sel_vars = vars
        self.group_container = group_container
        self.suspend_layout()
        
        self.set_title("Custom Variable Categories")

        content = mforms.newBox(False)
        self.set_content(content)
        content.set_padding(20)
        content.set_spacing(12)
        
        l = mforms.newLabel("Select or create new category for custom variable categories.")
        content.add(l, False, False)
        
        self.groups = newTreeNodeView(mforms.TreeFlatList)
        self.groups.set_selection_mode(mforms.TreeSelectMultiple)
        self.groups.add_column(mforms.StringColumnType, "Category name", 100, False)
        self.groups.end_columns()
        self.groups.set_size(200, 200)
        self.menu = mforms.newContextMenu()
        self.menu.add_item_with_title("Delete Category", self.group_delete, "group_delete")
        self.groups.set_context_menu(self.menu)

        content.add(self.groups, True, True)

        entry_box = mforms.newBox(True)
        entry_box.set_spacing(5)

        l = mforms.newLabel("Category name:")
        entry_box.add(l, False, False)
        self.name = mforms.newTextEntry()
        self.name.add_action_callback(self.group_name_action)
        entry_box.add(self.name, True, True)
        self.add_btn = newButton()
        self.add_btn.set_text("Add")
        self.add_btn.add_clicked_callback(self.group_add)
        entry_box.add_end(self.add_btn, False, False)

        content.add(entry_box, False, True)

        self.cancel = newButton()
        self.cancel.set_text("Cancel")
        self.cancel.add_clicked_callback(self.cancel_click)
        self.ok = newButton()
        self.ok.set_text("OK")
        self.ok.add_clicked_callback(self.ok_click)

        self.delete = newButton()
        self.delete.set_text("Delete")
        self.delete.add_clicked_callback(self.group_delete)
        
        bbox = mforms.newBox(True)
        bbox.set_spacing(12)
        
        okcancel_box = mforms.newBox(True)
        okcancel_box.set_spacing(12)

        bbox.add_end(okcancel_box, False, True)
        bbox.add(self.delete, False, True)

        mforms.Utilities.add_end_ok_cancel_buttons(okcancel_box, self.ok, self.cancel)
        content.add_end(bbox, False, True)

        self.set_size(550, -1)
        self.center()
        self.load_groups()

        self.resume_layout()
Example #58
0
    def __init__(self, ctrl_be, variables, command, type):
        mforms.Box.__init__(self, False)
        self.set_managed()
        self.set_release_on_add()

        self.user_groups = VariablesGroupContainer(type)
        self.user_groups.load()
        
        self.variables = variables

        self.suspend_layout()

        self.command = command
        self.ctrl_be = ctrl_be

        box = newBox(True)
        box.set_spacing(12)
        self.add(box, True, True)
        self.tree = newTreeNodeView(mforms.TreeFlatList)
        self.tree.set_selection_mode(mforms.TreeSelectMultiple)

        sidebox = newBox(False)
        box.add(sidebox, False, True)

        self.searchEntry = newTextEntry(mforms.SearchEntry)

        sidebox.set_spacing(12)
        sidebox.add(self.searchEntry, False, True)
        sidebox.add(self.tree, True, True)
        self.tree.set_size(210, -1)

        self.searchEntry.add_changed_callback(self.filterOutput)

        self.tree.add_column(mforms.StringColumnType, "Category", 200, False)
        self.tree.end_columns()
        self.tree.add_changed_callback(weakcb(self, "refresh"))
        self.cat_menu = mforms.newContextMenu()
        self.cat_menu.add_will_show_callback(self.cat_menu_will_show)
        self.cat_menu.add_item_with_title("Delete Category", self.delete_category, "delete")
        self.tree.set_context_menu(self.cat_menu)

        self.values = newTreeNodeView(mforms.TreeFlatList)
        self.values.set_selection_mode(mforms.TreeSelectMultiple)
        box.add(self.values, True, True)

        self.values.add_column(mforms.StringColumnType, "Name", 200, False)
        self.values.add_column(mforms.StringColumnType, "Value", 120, True)
        self.values.add_column(mforms.StringColumnType, "Description", 1000, False)
        self.values.end_columns()
        self.values.set_allow_sorting(True)
        self.values.set_cell_edited_callback(self.edit_variable)
        self.values.add_changed_callback(weakcb(self, "value_selection_changed"))
        self.menu = mforms.newContextMenu()
        self.menu.add_will_show_callback(self.menu_will_show)
        self.values.set_context_menu(self.menu)

        box = newBox(True)
        box.set_spacing(8)
        copy_all_button = newButton()
        copy_all_button.set_text('Copy Global Status and Variables to Clipboard')
        copy_all_button.add_clicked_callback(self.copy_status_to_clipboard)
        box.add(copy_all_button, False, False)
        copy_shown_button = newButton()
        copy_shown_button.set_text('Copy Selected to Clipboard')
        copy_shown_button.add_clicked_callback(self.copy_selected_to_clipboard)
        box.add(copy_shown_button, False, False)
        self.copy_selected_to_clipboard_button = copy_shown_button
        button = newButton()
        box.add_end(button, False, True)
        button.set_text("Refresh")
        box.set_padding(12)

        button.add_clicked_callback(weakcb(self, "refresh"))

        self.add(box, False, True)

        row = self.tree.add_node()
        row.set_string(0, "All")
        row = self.tree.add_node()
        row.set_string(0, "Filtered")

        self.resume_layout()

        self.variable_info = {}
        self.variables_in_group = {"Other":[]}

        self._delayed_init_tm = mforms.Utilities.add_timeout(0.1, lambda: self.delayed_init(self.variables))
    def __init__(self):
        mforms.Form.__init__(
            self, None, mforms.FormDialogFrame | mforms.FormResizable
            | mforms.FormMinimizable)

        self.set_title("Data Type Mapping for Generic Migration")

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

        hbox = mforms.newBox(True)
        content.add(hbox, True, True)
        hbox.set_spacing(12)

        self._type_list = mforms.newTreeView(
            mforms.TreeFlatList)  #|mforms.TreeAllowReorderRows)
        self._type_list.set_size(200, -1)
        self._type_list.add_column(mforms.StringColumnType, "Type", 100, False)
        self._type_list.add_column(mforms.StringColumnType, "Target Type", 100,
                                   False)
        self._type_list.end_columns()
        self._type_list.add_changed_callback(self.selection_changed)
        hbox.add(self._type_list, False, True)

        detail_box = mforms.newBox(False)
        self.detail_box = detail_box
        hbox.add(detail_box, True, True)
        detail_box.set_spacing(12)

        ##

        spanel = mforms.newPanel(mforms.TitledBoxPanel)
        spanel.set_title("Source Data Type")

        stable = mforms.newTable()
        stable.set_padding(12)
        spanel.add(stable)
        stable.set_row_count(5)
        stable.set_column_count(2)
        stable.set_row_spacing(8)
        stable.set_column_spacing(4)

        stable.add(mforms.newLabel("Type Name:", True), 0, 1, 0, 1,
                   mforms.HFillFlag)
        self._stype_entry = mforms.newTextEntry()
        self._stype_entry.add_changed_callback(self.save_changes)
        stable.add(self._stype_entry, 1, 2, 0, 1,
                   mforms.HFillFlag | mforms.HExpandFlag)

        #self._stype_user_check = mforms.newCheckBox()
        #self._stype_user_check.set_text("Is user datatype")
        #stable.add(self._stype_user_check, 1, 2, 1, 2, mforms.HFillFlag|mforms.HExpandFlag)

        stable.add(mforms.newLabel("Type Category:", True), 0, 1, 2, 3,
                   mforms.HFillFlag)
        self._sgroup_selector = mforms.newSelector()
        stable.add(self._sgroup_selector, 1, 2, 2, 3,
                   mforms.HFillFlag | mforms.HExpandFlag)
        self._sgroup_selector.add_changed_callback(self.source_group_selected)

        stable.add(mforms.newLabel("Min. Length:", True), 0, 1, 3, 4,
                   mforms.HFillFlag)
        self._sminlen_entry = mforms.newTextEntry()
        self._sminlen_entry.add_changed_callback(self.save_changes)
        stable.add(self._sminlen_entry, 1, 2, 3, 4,
                   mforms.HFillFlag | mforms.HExpandFlag)
        stable.add(mforms.newLabel("Max. Length:", True), 0, 1, 4, 5,
                   mforms.HFillFlag)
        self._smaxlen_entry = mforms.newTextEntry()
        self._smaxlen_entry.add_changed_callback(self.save_changes)
        stable.add(self._smaxlen_entry, 1, 2, 4, 5,
                   mforms.HFillFlag | mforms.HExpandFlag)

        detail_box.add(spanel, False, True)

        ##

        tpanel = mforms.newPanel(mforms.TitledBoxPanel)
        tpanel.set_title("Target MySQL Data Type")

        ttable = mforms.newTable()
        ttable.set_padding(12)
        tpanel.add(ttable)
        ttable.set_row_count(4)
        ttable.set_column_count(2)
        ttable.set_row_spacing(8)
        ttable.set_column_spacing(4)

        ttable.add(mforms.newLabel("Target Type:", True), 0, 1, 0, 1,
                   mforms.HFillFlag)
        self._ttype_selector = mforms.newSelector()
        self._ttype_selector.add_changed_callback(self.save_changes)
        ttable.add(self._ttype_selector, 1, 2, 0, 1,
                   mforms.HFillFlag | mforms.HExpandFlag)

        def add_check_entry_row(table, row, label, name):
            check = mforms.newCheckBox()
            check.set_text(label)
            table.add(check, 0, 1, row, row + 1, mforms.HFillFlag)
            entry = mforms.newTextEntry()
            entry.add_changed_callback(self.save_changes)
            table.add(entry, 1, 2, row, row + 1,
                      mforms.HFillFlag | mforms.HExpandFlag)
            setattr(self, name + "_check", check)
            setattr(self, name + "_entry", entry)
            entry.set_enabled(False)

            def callback(entry, check):
                if not check.get_active():
                    entry.set_value("-2")
                entry.set_enabled(check.get_active())
                self.save_changes()

            check.add_clicked_callback(lambda: callback(entry, check))

        add_check_entry_row(ttable, 1, "Override Length:", "_target_length")
        add_check_entry_row(ttable, 2, "Override Precision:",
                            "_target_precision")
        add_check_entry_row(ttable, 3, "Override Scale:", "_target_scale")

        detail_box.add(tpanel, False, True)

        ##

        bbox = mforms.newBox(True)

        self._add_button = mforms.newButton()
        self._add_button.set_text("Add")
        bbox.add(self._add_button, False, True)
        self._add_button.add_clicked_callback(self.add_clicked)
        self._del_button = mforms.newButton()
        self._del_button.set_text("Delete")
        self._del_button.add_clicked_callback(self.del_clicked)
        bbox.add(self._del_button, False, True)

        self._ok_button = mforms.newButton()
        self._ok_button.set_text("OK")
        self._ok_button.add_clicked_callback(self.ok_clicked)
        self._cancel_button = mforms.newButton()
        self._cancel_button.set_text("Cancel")
        self._ok_button.add_clicked_callback(self.cancel_clicked)
        mforms.Utilities.add_end_ok_cancel_buttons(bbox, self._ok_button,
                                                   self._cancel_button)
        content.add_end(bbox, False, True)
        bbox.set_spacing(12)
        self._del_button.set_enabled(False)

        self.set_size(700, 500)