def run_version_select_form(version):
    form = Form(Form.main_form())
    top_vbox = newBox(False)
    top_vbox.set_padding(16)
    top_vbox.set_spacing(16)

    info_hbox = newBox(True)
    info_hbox.set_spacing(16)

    img_box = newImageBox()
    img_box.set_image("warning_icon.png")

    right_vbox = newBox(False)
    right_vbox.set_spacing(12)

    warn_label = newLabel("Server version %s is not supported by Workbench\nconfiguration file management tool." % ".".join(map(lambda x: str(x), version)))
    right_vbox.add(warn_label, False, False)

    warn_label = newLabel("Although, you can select different server version\nfor the tool to use. Suggested version "
                          "is given\nbelow. You can either pick version or type one."
                         )
    right_vbox.add(warn_label, False, False)

    warn_label = newLabel("Valid version formats are X.Y.ZZ or X.Y.\nAll other variants will resort to default - 5.1.")
    right_vbox.add(warn_label, False, False)

    if (type(version) is not tuple):
      version = (5,1)
      dprint_ex(1, "Given version is not a valid tuple object")

    try:
      version_maj = int(version[0]) + int(version[1]) / 10.0
    except (ValueError, IndexError), e:
      version_maj = 5.1
    def _add_script_checkbox_option(self, box, name, caption, path_caption, browser_caption):
        check = mforms.newCheckBox()
        check.set_text(caption)
        box.add(check, False, True)
        vbox = mforms.newBox(False)
        vbox.set_spacing(4)
        file_box = mforms.newBox(True)
        file_box.set_spacing(4)
        file_box.add(mforms.newLabel(path_caption), False, True)
        file_entry = mforms.newTextEntry()
        file_entry.add_changed_callback(lambda self=self, option=name: setattr(self, name+"_check_duplicate", True))
        file_box.add(file_entry, True, True)
        check.add_clicked_callback(lambda box=vbox, check=check: box.set_enabled(check.get_active()))
        button = mforms.newButton()
        button.set_text("Browse...")
        button.add_clicked_callback(lambda option=name, title=browser_caption: self._browse_files(option, title))
        file_box.add(button, False, True)
        vbox.add(file_box, False, True)
        label = mforms.newLabel("You should edit this file to add the source and target server passwords before running it.")
        label.set_style(mforms.SmallHelpTextStyle)
        vbox.add(label, False, True)
        vbox.set_enabled(False)
        box.add(vbox, False, True)

        setattr(self, name+"_check_duplicate", False)
        setattr(self, name+"_checkbox", check)
        setattr(self, name+"_entry", file_entry)
    def create_ui(self):
        box = mforms.newBox(False)
        box.set_spacing(12)
        box.set_padding(12)

        message = "These options allow you to configure the process. You can use default parameters\n"
        message += "instead of providing your own, allow the generation of the certificates and determine\n"
        message += "whether to update the connection settings or not."

        label = mforms.newLabel(message)

        box.add(label, False, True)
        box.add(self.use_default_parameters, False, True)
        box.add(self.generate_files, False, True)
        box.add(self.update_connection, False, True)
        
        button_box = mforms.newBox(True)
        button_box.set_spacing(12)
        button_box.set_padding(12)
        
        button_box.add(self.clear_button, False, True)
        
        self.content.add(box, False, True)
        self.content.add(button_box, False, True)
        box.show(True)
    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")
예제 #6
0
파일: test3.py 프로젝트: dashiad/Siviglia
 def __init__(self,container,modelName,modelData):
   self.manager=ModelManager(modelName,modelData)    
   
   self.panel=mforms.newPanel(mforms.TitledGroupPanel);    
   container.add(self.panel,True,True);
   self.origContainer=container    
   self.panel.set_title("Edicion de Modelo "+modelName);
   subcontainer=mforms.newBox(False)
   self.panel.add(subcontainer);
   UIHelper.__init__(self,subcontainer)
       
   self.modelName=modelName
   self.modelData=modelData
   self.addTextInput('Label',modelData.customData,'LABEL');
   self.addTextInput('Label corta',modelData.customData,'SHORTLABEL');
   self.addMultipleColumnSelector('Campo Indice',modelData,modelData.customData,'INDEXFIELDS')
   self.addTableSelector('Extiende',modelData.customData,'EXTENDS',None);
   self.addTableSelector('Modulo',modelData.customData,'MODULE',self.onChangeModule)        
   self.addTextInput('Tabla',modelData.customData,'TABLE');
   self.addTextInput('Cardinalidad',modelData.customData,'CARDINALITY');
   self.addSelectInput("Tipo de Cardinalidad",["","FIXED","VARIABLE"],modelData.customData,'CARDINALITY_TYPE',None)
   self.addColumnSelector('Campo Tipo',modelData,modelData.customData,'TYPEFIELD')
   self.addColumnSelector('Propietario',modelData,modelData.customData,'OWNERSHIP')    
   self.multBox=mforms.newBox(False)
   self.multBox.set_padding(3)
   self.multBox.set_spacing(3)
   self.container.add(self.multBox,False,True)
   self.multiplicityOptions=MultiplicityOptions(self.multBox,modelName,modelData,self.container)        
def review_sql_code(code):
    form = mforms.Form(mforms.Form.main_form(), mforms.FormNormal)
    form.set_title("Review SQL Code to Execute")
    box = mforms.newBox(False)
    box.set_padding(12)
    form.set_content(box)

    box.set_spacing(8)
    box.add(mforms.newLabel("Review the SQL code to be executed."), False, True)

    editor = mforms.CodeEditor()
    box.add(editor, True, True)
    editor.set_language(mforms.LanguageMySQL)
    editor.set_text(code)
    editor.set_features(mforms.FeatureReadOnly, True)

    ok = mforms.newButton()
    ok.set_text("Execute")
    cancel = mforms.newButton()
    cancel.set_text("Cancel")

    bbox = mforms.newBox(True)
    bbox.set_spacing(8)
    bbox.add_end(ok, False, True)
    bbox.add_end(cancel, False, True)
    box.add_end(bbox, False, True)

    form.set_size(500, 360)
    return form.run_modal(ok, cancel)
    def create_ui(self):
        self.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")
예제 #9
0
def selectServer(title):
    # No need to select an instance if there's only one:
    if len(grt.root.wb.rdbmsMgmt.storedInstances) == 1:
        return grt.root.wb.rdbmsMgmt.storedInstances[0]

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

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

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

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

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

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

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

    bbox.set_spacing(8)

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

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

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

    if window.run_modal(ok, cancel):
        i = listbox.get_selected_index()
        if i >= 0:
            return grt.root.wb.rdbmsMgmt.storedInstances[i]
    return None
    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 create_ui(self):
        self.content.set_padding(20)

        self.content.add(mforms.newLabel('''Select the connection for the source MySQL server where databases will be copied from
and the destination server where they should be copied to.'''), False, True)

        source_panel = mforms.newPanel(mforms.TitledBoxPanel)
        source_panel.set_title('Source MySQL Server')

        box = mforms.newBox(False)
        box.set_spacing(12)
        box.set_padding(8)
        box.add(mforms.newLabel('Select the connection for the source MySQL server instance'), False, True)
        
        source_hbox = mforms.newBox(True)
        source_hbox.set_spacing(8)
        source_hbox.add(mforms.newLabel('Source Connection:'), False, True)
        self.source_selector = mforms.newSelector()
        source_hbox.add(self.source_selector, True, True)
        box.add(source_hbox, False, True)

        self.source_connection_status = mforms.newLabel('')
        self.source_connection_status.set_color('#aa3333')
        box.add(self.source_connection_status, True, True)
        self.source_selector.add_changed_callback(functools.partial(self.selector_changed, label=self.source_connection_status, selector=self.source_selector))

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

        target_panel = mforms.newPanel(mforms.TitledBoxPanel)
        target_panel.set_title('Destination MySQL Server')

        tbox = mforms.newBox(False)
        tbox.set_spacing(12)
        tbox.set_padding(8)
        tbox.add(mforms.newLabel('Select the connection object for the destination MySQL server instance'), False, True)
        
        target_hbox = mforms.newBox(True)
        target_hbox.set_spacing(8)
        target_hbox.add(mforms.newLabel('Target Connection:'), False, True)
        self.target_selector = mforms.newSelector()
        target_hbox.add(self.target_selector, True, True)
        tbox.add(target_hbox, False, True)

        self.target_connection_status = mforms.newLabel('')
        self.target_connection_status.set_color('#aa3333')
        tbox.add(self.target_connection_status, True, True)
        self.target_selector.add_changed_callback(functools.partial(self.selector_changed, label=self.target_connection_status, selector=self.target_selector))
        
        target_panel.add(tbox)
        self.content.add(target_panel, False, True)

        self.advanced_button.set_text('Test Connections')

        self.back_button.set_enabled(False)

        self.load_connections()
    def __init__(self, results, checksum=False):
        mforms.Form.__init__(self, mforms.Form.main_form(), mforms.FormNormal)

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

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

        self._checksum = checksum

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

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

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

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

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

        self.set_size(500, 400)
    def __init__(self, main, header_label, wide=False, no_buttons= False):
        mforms.Box.__init__(self, False)
        self.set_managed()
        self.set_release_on_add()

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

        self._identifier = "    "+header_label

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

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

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

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

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

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

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

            self.add_end(self.button_box, False, True)
예제 #14
0
    def __init__(self, conn):
        mforms.Form.__init__(self, None)
        self._conn = conn
        self.set_title("Password Expired")

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

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

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

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

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

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

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

        vbox.add_end(bbox, False, True)

        self.set_content(vbox)

        self.set_size(500, 260)
        self.center()
예제 #15
0
파일: test3.py 프로젝트: dashiad/Siviglia
 def __init__(self):    
   mforms.Form.__init__(self,None);     
   self.set_managed()
   self.currentModel=None
   #Lista de campos del modelo actual.
   schema=grt.root.wb.doc.physicalModels[0].catalog.schemata[0]
   self.schema=schema        
   self.set_size(800,400)
   self.center()        
   self.set_title('Siviglia Editor')
   f1=mforms.newBox(False)
   
   bx = mforms.newBox(True)
   bx.set_padding(12)
   bx.set_spacing(12)
   
   self.lbox=mforms.newListBox(False)
   self.lbox.set_size(100,200);
   list=[];
   
   for curTable in schema.tables:      
     list.append(curTable.name);
   list.sort();
   for tName in list:
       self.lbox.add_item(tName)    
   self.lbox.add_changed_callback(lambda:self.changedModel());
   
   #self.lbox.add_changed_callback(lambda:self.changedField());
   #for curField in curTable.columns:
   #  self.lbox.add_item(curField.name);
   bx.add(self.lbox,False,False);    
   #sp=mforms.newScrollPanel();
   #bx.add(sp,True,True);        
   self.fieldContainer=mforms.newBox(False);    
   #self.autoUI=AutoUI(fieldContainer)
   #self.autoUI.reset('Testing',{'a':{'b':1,'c':2},'h':{'p':4,'m':'hola'}},{})    
   bx.add(self.fieldContainer,True,True)
   f1.add(bx,True,True)
   bx2=mforms.newBox(True)
   bx2.set_padding(12);
   bx2.set_size(500,20)
   #bx2.set_preferred_height(40);
   l=mforms.newLabel('Output Path')    
   bx2.add(l,False,True)
   p=mforms.newTextEntry()
   p.set_value("c:\\xampp\\htdocs");
   p.set_size(300,20)
   self.pathInput=p
   bx2.add(p,False,True)
   p=mforms.newButton()
   p.set_text("Generar")
   p.add_clicked_callback(self.onGenerate)
   bx2.add(p,False,True)
   f1.add(bx2,False,False)
   self.tabView=None
   self.set_content(f1)        
    def __init__(self, main):
        WizardPage.__init__(self, main, "Target Creation Options")

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

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

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

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

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

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

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

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

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

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

        self._create_db.set_active(True)
        self._toggle_sql_script()
        self._check_file_duplicate = True
    def __init__(self, ctrl_be, thread_id):
        mforms.Form.__init__(self, mforms.Form.main_form())
        self.set_title("Thread Stack for %d" % thread_id)
        self.ctrl_be = ctrl_be

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

        self.thread_id = thread_id

        splitter = mforms.newSplitter(True, False)

        self.tree = mforms.newTreeNodeView(mforms.TreeDefault)
        self.tree.add_column(mforms.IntegerColumnType, "Event Id", 50, False)
        self.tree.add_column(mforms.StringColumnType, "Event info", 200, False)
        self.tree.add_column(mforms.StringColumnType, "Type", 100, False)
        self.tree.add_column(mforms.StringColumnType, "Timer wait [\xC2\xB5s]", 80, False)
        if self.enable_debug_info:
            self.tree.add_column(mforms.StringColumnType, "Source", 200, False)
        self.tree.end_columns()
        self.tree.set_size(400, -1)
        self.tree.add_changed_callback(self.event_selected)
        splitter.add(self.tree, 500);

        l = mforms.newLabel("Wait info")
        l.set_style(mforms.BoldStyle)
        tbox = newBox(False)
        lbox = newBox(False)
        lbox.set_spacing(5)
        lbox.set_padding(5)
        lbox.add(l, False, False)
        tbox.add(lbox, False, False)

        self.text = mforms.newTextBox(mforms.VerticalScrollBar)
        self.text.set_read_only(True)
        self.text.set_size(150, -1)

        tbox.add(self.text, True, True)
        splitter.add(tbox, 150)

        vbox.add(splitter, True, True)

        self.set_content(vbox)

        bbox = newBox(True)
        bbox.set_spacing(8)
        self.ok = newButton()
        self.ok.set_text("Close")
        self.ok.add_clicked_callback(self.close_form)
        bbox.add_end(self.ok, False, False)
        vbox.add_end(bbox, False, True)

        self.set_size(800, 600)
        self.center()
    def __init__(self, ctrl_be, title, descr, stop_callback = None, close_callback=None, progress_parser_callback=None):
        mforms.Form.__init__(self, mforms.Form.main_form(), mforms.FormDialogFrame)
        self.ctrl_be = ctrl_be

        self._done = False
        self._update_tm = None

        self.finished_callback = None
        self.stop_callback = stop_callback
        self.close_callback = close_callback
        self.progress_parser_callback = progress_parser_callback

        self.show(False)

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

        self.set_title(title)
        self.label = mforms.newLabel(descr)
        self.box.add(self.label, False, True)

        hb = mforms.newBox(True)
        self.progress = mforms.newProgressBar()
        self.progress_label = mforms.newLabel("")
        self.progress_label.set_size(100, -1)
        hb.add(self.progress_label, False, True)
        hb.add(self.progress, True, True)
        self.box.add(hb, False, True)

        self.logbox = mforms.newTextBox(mforms.VerticalScrollBar)
        self.logbox.set_read_only(True)
        panel = mforms.newPanel(mforms.TitledBoxPanel)
        panel.set_title("Command Output")

        self.logbox.set_padding(8)
        panel.add(self.logbox)
        self.box.add(panel, True, True)


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

        self.stop = mforms.newButton()
        if stop_callback:
            self.stop.set_text("Stop")
        else:
            self.stop.set_text("Close")
        self.stop.add_clicked_callback(self.do_stop)
        bbox.add_end(self.stop, False, True)

        self.set_size(700, 500)
        self.center()
 def create_ui(self):
     box = mforms.newBox(False)
     box.set_spacing(8)
     lbl_box = mforms.newBox(False)
     lbl_box.set_spacing(8)
     lbl_box.add(mforms.newLabel("Type query that will be used as a base for export."), False, True)
     box.add(lbl_box, False, True)
     self.code_editor = mforms.CodeEditor()
     self.code_editor.set_language(mforms.LanguageMySQL)
     self.code_editor.set_managed()
     self.code_editor.set_release_on_add()
     box.add(self.code_editor, True, True)
     self.content.add(box, True, True)
    def __init__(self, ctrl_be, server_profile, main_view):
        mforms.Box.__init__(self, True)
        self.set_managed()
        self.set_release_on_add()

        self.ui_created = False

        self.set_spacing(24)

        self.ctrl_be = ctrl_be
        self.server_profile = server_profile
        self.main_view = main_view

        lbox = mforms.newBox(False)
        self.add(lbox, True, True)

        self.connection_info = ConnectionInfo()
        self.connection_info.set_padding(24)
        lbox.add(self.connection_info, False, True)

        self.scrollbox = mforms.newScrollPanel(mforms.ScrollPanelDrawBackground)
        self.scrollbox.set_padding(24)
        self.content = mforms.newBox(False)
        self.content.set_padding(20)
        self.content.set_spacing(4)
        self.scrollbox.add(self.content)
        lbox.add(self.scrollbox, True, True)

        image = mforms.newImageBox()
        if self.server_profile.host_os == "linux":
            image.set_image(mforms.App.get().get_resource_path("mysql-status-separator-linux.png"))
        else:
          image.set_image(mforms.App.get().get_resource_path("mysql-status-separator.png"))
        image.set_image_align(mforms.MiddleCenter)
        self.add(image, False, True)

        self.on_icon = mforms.App.get().get_resource_path("mysql-status-on.png")
        self.off_icon = mforms.App.get().get_resource_path("mysql-status-off.png")

        self.status = wb_admin_monitor.WbAdminMonitor(server_profile, self.ctrl_be)
        self.status.set_size(360, -1)
        self.status.set_padding(0, 24, 24, 24)
        self.add(self.status, False, False)

        self.controls = {}

        self.currently_started = None
        self.ctrl_be.add_me_for_event("server_started", self)
        self.ctrl_be.add_me_for_event("server_stopped", self)

        self.connection_info.update(self.ctrl_be)
    def create_ui(self):
        self.set_spacing(16)

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

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

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

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

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

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

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

        self.dbf_box = mforms.newBox(True)
        self.dbf_box.set_spacing(8)
        self.dbf_icon = mforms.newImageBox()
        self.dbf_icon.set_image("task_unchecked%s.png" % os_icon_suffix)
        self.dbf_box.add(self.dbf_icon, False, True)
        dbf_label = mforms.newLabel("Check if dbf file is present")
        self.dbf_box.add(dbf_label, True, True)
        self.dbf_box.show(True)
         
        self.content.add(self.dbf_box, False, True)
         
        self.proj_box = mforms.newBox(True)
        self.proj_box.set_spacing(8)
        self.proj_icon = mforms.newImageBox()
        self.proj_icon.set_image("task_unchecked%s.png" % os_icon_suffix)
        self.proj_box.add(self.proj_icon, False, True)
        proj_label = mforms.newLabel("Check if prj file is present")
        self.proj_box.add(proj_label, True, True)
        self.proj_box.show(True)
         
        self.content.add(self.proj_box, False, True)
        
        self.warning_srs = mforms.newLabel("")
        self.content.add(self.warning_srs, False, True)
    def create_ui(self):
        self.suspend_layout()
        self.set_spacing(16)
        self.content.set_spacing(16)
        
        colbox = mforms.newBox(False)
        colbox.set_spacing(8)
        colbox.add(mforms.newLabel("Select columns you'd like to export"), False, True)
        
        self.column_list = newTreeNodeView(mforms.TreeFlatList)
        self.column_list.add_column(mforms.CheckColumnType, "Export", 50, True)
        self.column_list.add_column(mforms.StringColumnType, "Column name", self.owner.main.get_width(), False)
        self.column_list.end_columns()
        self.column_list.set_allow_sorting(True)
        self.column_list.set_size(200, -1)
        colbox.add(self.column_list, True, True)
        
        limit_box = mforms.newBox(True)
        limit_box.set_spacing(8)
        limit_box.add(mforms.newLabel("Count: "), False, False)
        self.limit_entry = mforms.newTextEntry()
        self.limit_entry.set_size(50, -1)
        self.limit_entry.add_changed_callback(lambda entry=self.limit_entry: self.entry_changed(entry))
        limit_box.add(self.limit_entry, False, False)
        
        offset_box = mforms.newBox(True)
        offset_box.set_spacing(8)
        offset_box.add(mforms.newLabel("Row Offset: "), False, False)
        self.offset_entry = mforms.newTextEntry()
        self.offset_entry.set_size(50, -1)
        self.offset_entry.add_changed_callback(lambda entry=self.offset_entry: self.entry_changed(entry))

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

        colbox.add(limit_offset, False, True)
        self.content.add(colbox, True, True)
        self.resume_layout()
 def create_ui(self):
     self.suspend_layout()
     self.set_spacing(16)
     
     self.simple_export_box = mforms.newBox(False)
     self.simple_export_box.set_spacing(16)
     
     label = mforms.newLabel("Select source table for export.")
     label.set_style(mforms.BoldInfoCaptionStyle)
     self.simple_export_box.add(label, False, True)
     
     self.source_table_sel = mforms.newSelector()
     self.source_table_sel.set_size(self.get_width(), -1)
     self.preload_existing_tables()
     sorted_keys = self.table_list.keys()
     sorted_keys.sort()
     self.source_table_sel.add_items(sorted_keys)
     table_name = "%s.%s" % (self.main.source_table['schema'], self.main.source_table['table'])
     if table_name in self.table_list.keys():
         self.source_table_sel.set_selected(sorted_keys.index(table_name))
     self.source_table_sel.add_changed_callback(lambda selector = self.source_table_sel: self.source_table_changed(selector.get_string_value()))
     self.simple_export_box.add(self.source_table_sel, False, True)
     
     self.simple_export = SimpleTabExport(self.main.editor, self)
     self.simple_export_box.add(self.simple_export, True, True)
     self.content.add(self.simple_export_box, True, True)
     
     self.advanced_export = AdvancedTabExport(self.main.editor, self)
     self.advanced_export.show(False)
     self.content.add(self.advanced_export, True, True)
     self.resume_layout()
     
     self.preload_table_info()
예제 #24
0
 def header_box(self):
   headBox = mforms.newBox(True)
   img = mforms.newImageBox()
   img.set_image(str(os.path.dirname(os.path.realpath(__file__))) + '/PropelUtility/propel-logo.png')
   img.set_size(self.defaults['width']/2-PropelForm.defaults['space']*2, 100)
   headBox.add(img, False, False)
   return headBox
예제 #25
0
    def create_search_panel(self):
      search_label = newLabel("Locate option:")
      self.option_lookup_entry  = newTextEntry()
      self.option_lookup_entry.set_size(200,-1)
      search_btn = newButton()
      search_btn.set_text("Find")
      search_btn.set_size(70, -1)

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

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

      search_btn.add_clicked_callback(lookup_option_wrapper)

      return search_panel
    def __init__(self, main):
        WizardPage.__init__(self, main, 'Schemata Selection')

        self._ui_created = False
        self.main.add_wizard_page(self,  'SourceTarget', 'Schemata Selection')

        optionspanel = mforms.newPanel(mforms.TitledBoxPanel)
        optionspanel.set_title('Schema Name Mapping Method')
        optionsbox = mforms.newBox(False)
        optionsbox.set_padding(8)
        optionsbox.set_spacing(8)
        
        optionsbox.add(mforms.newLabel('Choose how the reverse engineered schemata and objects should be mapped.\n'), False)

        options = [ 'Keep schemata as they are: Catalog.Schema.Table -> Schema.Table',
                    'Only one schema: Catalog.Schema.Table -> Catalog.Table',
                    'Only one schema, keep current schema names as a prefix: Catalog.Schema.Table -> Catalog.Schema_Table',
                  ]
        rid = mforms.RadioButton.new_id()
        self.options = []
        for opt in options:
            radio_button = mforms.newRadioButton(rid)
            radio_button.set_text(opt)
            optionsbox.add(radio_button, False)
            self.options.append(radio_button)
        self.options[1].set_active(True)

        optionspanel.add(optionsbox)
        self._optionspanel = optionspanel
        #self._advanced_shown = False
        #self._optionspanel.show(False)
        self.content.add_end(optionspanel, False)
예제 #27
0
    def __init__(self):
        mforms.AppView.__init__(self, False, 'db_copy', True)

        self.background = None
        self.content = mforms.newBox(False)

        if platform.system() == 'Windows':
            self.set_back_color(mforms.App.get().get_system_color(mforms.SystemColorContainer).to_html())
            content_panel = mforms.newPanel(mforms.FilledPanel)
            self.content.set_back_image("migration_background.png", mforms.TopRight)
        else:
            content_panel = mforms.newPanel(mforms.StyledHeaderPanel)
            content_panel.set_back_image("migration_background.png", mforms.TopRight)

        content_panel.set_back_color("#FFFFFF")
        content_panel.set_padding(8)
        self.header = mforms.newLabel("")
        self.header.set_style(mforms.WizardHeadingStyle)
        self.content.add(self.header, False)
        self.tabview = mforms.newTabView(mforms.TabViewTabless)
        self.content.add(self.tabview, True, True)
        content_panel.add(self.content)
        self.add(content_panel, True, True)

        self._ui_created = False
        
        self._page_list = []
        self._page_trail = []
        self._current_page = 0

        # Load current user numeric locale:
        locale.setlocale(locale.LC_NUMERIC, '')

        self.plan = migration.MigrationPlan()
        self.create_ui()
        def make_command_box(callable, title, desc, tooltip, options = None, extra_options = None):
            l = mforms.newLabel(title)
            l.set_style(mforms.BoldStyle)
            self.content.add(l, False, True)

            l = mforms.newLabel(desc)
            self.content.add(l, False, True)

            if extra_options:
                self.content.add(extra_options, False, True)

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

            l = mforms.newImageBox()
            l.set_image(mforms.App.get().get_resource_path("mini_notice.png"))
            l.set_tooltip(tooltip)
            hb.add(l, False, True)

            for o in options:
                hb.add(o, False, True)

            btn = mforms.newButton()
            btn.add_clicked_callback(callable)
            btn.set_text(title.strip())
            hb.add_end(btn, False, True)

            self._buttons.append(btn)

            self.content.add(hb, False, True)
    def __init__(self, owner):
        mforms.Box.__init__(self, True)
        self.set_release_on_add()
        self.set_managed()
        
        self.owner = owner

        self.set_spacing(35)

        self.icon = mforms.newImageBox()
        self.icon.set_image(mforms.App.get().get_resource_path("mysql-logo-00.png"))

        self.add(self.icon, False, True)

        vbox = mforms.newBox(False)
        self.vbox = vbox
        self.add(vbox, True, True)
        vbox.set_spacing(2)
        vbox.add(mforms.newLabel("Connection Name"), False, True)

        self.connection_name = mforms.newLabel("?")
        self.connection_name.set_style(mforms.VeryBigStyle)
        vbox.add(self.connection_name, False, True)

        self.info_table = None
 def 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
예제 #31
0
    def create_ui(self):
        box = mforms.newBox(False)
        box.set_padding(20)
        box.set_spacing(20)

        message = "This wizard will assist you generating a set of SSL certificates and self-signed keys that are required \n"
        message += "by the MySQL server to enable SSL. Other files will also be generated so that you can check how to \n"
        message += "configure your server and clients as well as the attributes used to generate them."

        label = mforms.newLabel(message)
        box.add(label, False, True)
        
        self.content.add(box, False, True)
        box.show(True)
    def add_info_section(self, title, info, params):
        label = mforms.newLabel(title)
        label.set_style(mforms.BigBoldStyle)
        label.set_color("#5f5f5f")
        self.content.add(label, False, True)
        sep = mforms.newBox(False)
        sep.set_back_color("#b2b2b2")
        sep.set_size(-1, 1)
        self.content.add(sep, False, True)

        info_table = self.make_info_table([x for x in info if x], params)
        self.content.add(info_table, False, True)
        self.controls[title] = (info_table, None)
        self.content.get_parent().relayout()
예제 #33
0
    def __init__(self, owner_form):
        mforms.Form.__init__(self, owner_form)

        self.pages = []

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

        hbox = mforms.newBox(True)
        self.header = mforms.newLabel("")
        self.header.set_style(mforms.WizardHeadingStyle)
        hbox.add(self.header, True, True)
        hbox.set_padding(24)

        self.content.add(hbox, False, True)
        self.tabview = mforms.newTabView(mforms.TabViewTabless)
        self.content.add(self.tabview, True, True)

        self.set_content(self.content)
        self.set_size(800, 600)
        self.center()
        
        self.set_on_close(self.on_close)
    def __init__(self, editor, owner):
        mforms.Box.__init__(self, False)
        self.set_managed()
        self.set_release_on_add()
        self.editor = editor
        self.caption = "Simple"
        self.owner = owner
        
        self.columns = []

        self.content = mforms.newBox(False)
        self.add(self.content, True, True)

        self.create_ui()
    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)
        self._store_connection_check.set_size(270, -1)
        box.add(self._store_connection_check, False, True)
        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, True)
        self.content.add(self.server_instance_box, True, True)

        self.advanced_button.set_text("Test Connection")

        self.odbc_button = mforms.newButton()
        self.odbc_button.set_text("Open ODBC Administrator")
        self.odbc_button.add_clicked_callback(self.open_odbc)
        self.button_box.add(self.odbc_button, False, True)
예제 #36
0
 def _add_script_radiobutton_option(self, box, name, caption, path_caption, browser_caption, label_caption, rid):
     ctrl_name = name.replace(" ", "")
     holder = mforms.newBox(False)
     holder.set_spacing(4)
     radio = mforms.newRadioButton(rid)
     radio.set_text(caption)
     radio.set_name("%s Option" % name)
     holder.add(radio, False, True)
     vbox = mforms.newBox(False)
     vbox.set_spacing(4)
     file_box = mforms.newBox(True)
     file_box.set_spacing(4)
     path_label = mforms.newLabel(path_caption)
     path_label.set_name(name)
     file_box.add(path_label, False, True)
     file_entry = mforms.newTextEntry()
     file_entry.set_name(name + " Value")
     file_entry.add_changed_callback(lambda self=self, option=name: setattr(self, ctrl_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.set_name("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_name(name + " Help")
     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, ctrl_name + "_check_duplicate", False)
     setattr(self, ctrl_name + "_radiobutton", radio)
     setattr(self, ctrl_name + "_entry", file_entry)
     setattr(self, ctrl_name + "_vbox", vbox)
예제 #37
0
 def __init__(self, Title, Message):
     mforms.Form.__init__(self, None, mforms.FormDialogFrame)
     self.set_title(Title)
     box = mforms.newBox(False)
     self.set_content(box)
     box.set_padding(12)
     box.set_spacing(12)
     label = mforms.newLabel(Message)
     box.add(label, False, True)
     self.cancelButton = mforms.newButton()
     self.cancelButton.set_text("No")
     box.add_end(self.cancelButton, False, True)
     self.okButton = mforms.newButton()
     self.okButton.set_text("Yes")
     box.add_end(self.okButton, False, True)
    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, True)
        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, True)
        self.content.add(self.server_instance_box, True, True)

        self.advanced_button.set_text("Test Connection")
예제 #39
0
    def create_ui(self):
        button_box = mforms.newBox(True)
        # button_box.set_padding(8)
        button_box.set_padding(0)
        button_box.set_spacing(12)

        # label = mforms.newLabel("Select the folder to save your migration(s) to.")
        # button_box.add(label, False, True)
        button_box.add(self.save_button, False, True)

        self.content.add_end(button_box, False, True)
        self.content.add_end(self.sql_text, True, True)
        # self.content.add_end(self.save_button, False, True)

        self.content.set_padding(12)
        self.content.set_spacing(12)
예제 #40
0
    def create_labeled_info(self, lbl_txt, lbl_name, tooltip_name = None):
        lbox = newBox(True)
        lbox.set_spacing(5)
        l = mforms.newLabel(lbl_txt)
        lbox.add(l, False, False)
        setattr(self, lbl_name, mforms.newLabel(""))
        l.set_style(mforms.BoldStyle)
        lbox.add(getattr(self, lbl_name), False, False)
        if tooltip_name != None:
            i = mforms.newImageBox()
            i.set_image(mforms.App.get().get_resource_path("mini_notice.png"))
            i.set_tooltip("")
            lbox.add(i, False, False)
            setattr(self, tooltip_name, i)

        return lbox
예제 #41
0
    def update(self, ctrl_be):
        self.suspend_layout()
        self.connection_name.set_text(ctrl_be.server_profile.name)

        info = ctrl_be.server_variables
        status = ctrl_be.status_variables

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

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

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

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

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

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

        version = ctrl_be.target_version
        if version and info:
            icon = mforms.App.get().get_resource_path("mysql-logo-%i%i.png" % (version.majorNumber, version.minorNumber))
            if icon:
                self.icon.set_image(icon)
        self.resume_layout()
예제 #42
0
    def __init__(self, main):
        WizardPage.__init__(self, main, "Migration Options")

        self.main.add_wizard_page(self, "ObjectMigration", "Migration Options")

        label = mforms.newLabel("Select options for the migration of the source schema/schemas to MySQL.")
        self.content.add(label, False, True)

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

        self._db_options_box = mforms.newBox(False)
        panel.add(self._db_options_box)
        self._db_options_box.set_padding(12)
        self._db_options_box.set_spacing(8)
        self._db_options = []
예제 #43
0
    def handle_hover_in(self, fig, x, y):
        if self.tooltip:
            self.tooltip.close()
            self.tooltip = None

        if not mforms.Form.main_form().is_active():
            return

        if fig and getattr(fig, 'hover_text_template', None):
            text = self.make_tooltip_text(fig, fig.hover_text_template)
            if text:
                self.tooltip = mforms.newPopover(None,
                                                 mforms.PopoverStyleTooltip)

                fx = fig.x + self.offset[0] + fig.width + 4
                fy = fig.y + self.offset[1] + fig.height / 2

                xx, yy = self.client_to_screen(fx, fy)
                box = mforms.newBox(False)
                box.set_spacing(0)
                t = ""
                for line in text.split("\n"):
                    if line.startswith("*"):
                        if t:
                            if t.endswith("\n"):
                                t = t[:-1]
                            label = mforms.newLabel(t)
                            label.set_style(mforms.SmallStyle)
                            box.add(label, False, True)
                            t = ""
                        label = mforms.newLabel(line[1:].rstrip("\n"))
                        label.set_style(mforms.SmallBoldStyle)
                        box.add(label, False, True)
                    else:
                        t += line + "\n"
                if t:
                    label = mforms.newLabel(t.rstrip("\n"))
                    label.set_style(mforms.SmallStyle)
                    box.add(label, False, True)

                self.tooltip.set_size(max(box.get_preferred_width(), 100),
                                      max(box.get_preferred_height(), 50))

                self.tooltip.set_content(box)
                self.tooltip.add_close_callback(self.close_tooltip)
                self.tooltip.show_and_track(self, xx, yy, mforms.StartRight)
예제 #44
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()
예제 #45
0
    def __init__(self, main):
        WizardProgressPage.__init__(self, main, "Bulk Data Transfer", use_private_message_handling=True)
        self._autostart = True
        self._resume = False
        self.retry_button = mforms.newButton()
        self.retry_button.set_text('Retry')
        self.retry_button.add_clicked_callback(self.go_retry)

        self.retry_box = mforms.newBox(True)
        self.content.remove(self._detail_label)
        self.retry_box.add(self._detail_label, False, True)
        self.retry_box.add(self.retry_button, False, True)
        self.content.add(self.retry_box, False, True)
        self.retry_button.show(False)

        self.main.add_wizard_page(self, "DataMigration", "Bulk Data Transfer")

        self._tables_to_exclude = list()
예제 #46
0
    def add_content_page(self, content, section_name, item_name, icon_name_as_cmd, return_content_container = False):
        # strip _win prefix for osx icons, because we do not install _win icons in osx
        if self.server_profile.host_os == wbaOS.darwin:
            if icon_name_as_cmd[-4:] == "_win":
                icon_name_as_cmd = icon_name_as_cmd[:-4]

        container = content
        if return_content_container:
          container = newBox(False)
          container.add_end(content, True, True)

        self.tasks_side.add_section_entry(section_name, item_name, icon_name_as_cmd + ".png", icon_name_as_cmd, False)
        i = self.tabview.add_page(container, "")
        content.set_padding(8)
        self.tabs.append(content)
        self.name2page[icon_name_as_cmd] = (i, content)

        return container
예제 #47
0
    def __init__(self, owner):
        mforms.Box.__init__(self, False)
        self.set_managed()
        self.owner = owner

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

        bbox = newBox(True)
        bbox.set_spacing(8)
        self.add_end(bbox, False, True)

        self.range_label = newLabel("")
        bbox.add(self.range_label, True, True)

        self.view_button = newButton()
        self.view_button.set_text("Copy Details")
        bbox.add(self.view_button, False, True)
        self.view_button.add_clicked_callback(self.copy_details)

        self.bof_button = newButton()
        self.bof_button.set_text("Oldest")
        bbox.add(self.bof_button, False, True)
        self.bof_button.add_clicked_callback(self.go_bof)

        self.back_button = newButton()
        self.back_button.set_text("Previous %i" % self.show_count)
        bbox.add(self.back_button, False, True)
        self.back_button.add_clicked_callback(self.go_back)

        self.next_button = newButton()
        self.next_button.set_text("Next %i" % self.show_count)
        bbox.add(self.next_button, False, True)
        self.next_button.add_clicked_callback(self.go_next)

        self.eof_button = newButton()
        self.eof_button.set_text("Newest")
        bbox.add(self.eof_button, False, True)
        self.eof_button.add_clicked_callback(self.go_eof)

        self.refresh_button = newButton()
        self.refresh_button.set_text("Refresh")
        bbox.add(self.refresh_button, False, True)
        self.refresh_button.add_clicked_callback(self.refresh)
예제 #48
0
    def create_ui(self):
        box = mforms.newBox(False)
        box.set_spacing(12)
        box.set_padding(12)

        message = "These optons allow you to configure the process. You can use default parameters\n"
        message += "instead providing your own, allow the generation of the certifcates and determine\n"
        message += "whether to uptade the connection settings or not."

        label = mforms.newLabel(message)

        box.add(label, False, False)
        box.add(self.use_default_parameters, False, False)
        box.add(self.generate_files, False, False)
        box.add(self.update_connection, False, False)
        
        self.content.add(box, False, False)
        self.content.add(self.clear_button, False, False)
        box.show(True)
    def __init__(self, editor, schema):
        mforms.Box.__init__(self, False)
        self.set_managed()
        self.set_release_on_add()

        self.schema = schema
        self.editor = editor

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

        self.tree = mforms.newTreeNodeView(mforms.TreeFlatList|mforms.TreeAltRowColors)
        self.tree.set_selection_mode(mforms.TreeSelectMultiple)
        for field, type, caption, width in self.columns:
            self.tree.add_column(type, caption, width, False)
        self.tree.end_columns()
        self.tree.set_allow_sorting(True)
        self.add(self.tree, True, True)

        self.menu = mforms.newContextMenu()
        self.menu.add_will_show_callback(self.menu_will_show)
        self.tree.set_context_menu(self.menu)

        self.icon_path = mforms.App.get().get_resource_path(self.klass+".16x16.png")

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

        self.refresh_btn = mforms.newButton()
        self.refresh_btn.set_text("Refresh")
        self.refresh_btn.add_clicked_callback(self.refresh)
        self.bbox.add_end(self.refresh_btn, False, True)

        for caption, callback_name in self.actions:
            if not caption:
                self.bbox.add(mforms.newLabel(" "), False, True)
                continue
            btn = mforms.newButton()
            btn.set_text(caption)
            btn.add_clicked_callback(getattr(self, callback_name))
            self.bbox.add(btn, False, True)
예제 #50
0
    def __init__(self, owner):
        WizardPage.__init__(self, owner, "Generate certificates and self-signed keys")

        self.ca_cert = os.path.join(self.main.results_path, "ca-cert.pem")
        self.server_cert = os.path.join(self.main.results_path, "server-cert.pem")
        self.server_key = os.path.join(self.main.results_path, "server-key.pem")
        self.client_cert = os.path.join(self.main.results_path, "client-cert.pem")
        self.client_key = os.path.join(self.main.results_path, "client-key.pem")

        self.table = mforms.newTable()
        self.table.set_padding(12)
        self.table.set_column_count(3)
        self.table.set_row_count(7)

        self.table.set_row_spacing(8)
        self.table.set_column_spacing(4)

        row, self.country_code = self.add_label_row(0, "Country:", "2 letter country code (eg, US)")
        row, self.state_name = self.add_label_row(row, "State or Province:", "Full state or province name")
        row, self.locality_name = self.add_label_row(row, "Locality:", "eg, city")
        row, self.org_name = self.add_label_row(row, "Organization:", "eg, company")
        row, self.org_unit = self.add_label_row(row, "Org. Unit:", "eg, section, department")
        row, self.email_address = self.add_label_row(row, "Email Address:", "")
        row, self.common_name = self.add_label_row(row, "Common:", "eg, put the FQDN of the server\nto allow server address validation")

        message = "Now you must specify the parameters to use in the certificates and self-signed key generation.\n"
        message += "This may include some data refering youself and/or the company you work for. All fields are optional."
        
        self.parameters_box = mforms.newBox(False)
        self.parameters_box.set_padding(20)
        self.parameters_box.set_spacing(20)

        self.parameters_label = mforms.newLabel(message)
        
        self.parameters_panel = mforms.newPanel(mforms.TitledBoxPanel)
        self.parameters_panel.set_title("Optional Parameters")
        self.parameters_panel.add(self.table)
        
        self.parameters_box.add(self.parameters_label, False, False)
        self.parameters_box.add(self.parameters_panel, False, False)

        self.default_label = mforms.newLabel("The wizard is ready to generate the files for you. Click 'Next >' to generate \nthe certificates and self-signed key files...")
 def mkswitch(self, state, text=None):
     box = mforms.newBox(True)
     box.set_spacing(8)
     image = mforms.newImageBox()
     box.add(image, False, True)
     if state:
         image.set_image(self.on_icon)
         box.add(mforms.newLabel("On"), False, True)
     elif state is None:
         image.set_image(self.off_icon)
         box.add(mforms.newLabel("n/a"), False, True)
     else:
         image.set_image(self.off_icon)
         box.add(mforms.newLabel("Off"), False, True)
     if text:
         l = mforms.newLabel(text)
         l.set_style(mforms.BoldStyle)
         l.set_color("#555555")
         box.add(l, False, True)
     return box
예제 #52
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 __init__(self, ctrl_be, instance_info, main_view):
        WbAdminTabBase.__init__(self, ctrl_be, instance_info, main_view)

        self.add_validation(WbAdminValidationRemoteAccess(instance_info))
        self.set_standard_header("title_startup.png", self._instance_info.name,
                                 "Startup / Shutdown MySQL Server")
        self.long_status_msg = None
        self.short_status_msg = None
        self.start_stop_btn = None
        self.offline_mode_btn = None
        self.startup_msgs_log = None
        self.is_server_running_prev_check = None
        self.copy_to_clipboard_button = None
        self.clear_messages_button = None
        self.error_log_reader = None

        if self.server_control:
            self.server_control.set_output_handler(self.print_output_cb)

        button_box = newBox(True)
        self.refresh_button = newButton()
        self.refresh_button.set_size(150, -1)
        self.refresh_button.set_text("Refresh Status")
        self.refresh_button.add_clicked_callback(lambda: self.refresh(True))
        button_box.add(self.refresh_button, False, True)

        self.copy_to_clipboard_button = newButton()
        self.copy_to_clipboard_button.set_size(150, -1)
        self.copy_to_clipboard_button.set_text("Copy to Clipboard")
        self.copy_to_clipboard_button.add_clicked_callback(
            self.copy_to_clipboard)
        button_box.add_end(self.copy_to_clipboard_button, False, True)

        self.clear_messages_button = newButton()
        self.clear_messages_button.set_size(150, -1)
        self.clear_messages_button.set_text("Clear Messages")
        self.clear_messages_button.add_clicked_callback(self.clear_messages)
        button_box.add_end(self.clear_messages_button, False, True)

        self.set_footer(button_box)
예제 #54
0
    def __init__(self, main):
        WizardPage.__init__(self, main, 'Schemas Selection')

        self._ui_created = False
        self.main.add_wizard_page(self, 'SourceTarget', 'Schemas Selection')

        optionspanel = mforms.newPanel(mforms.TitledBoxPanel)
        optionspanel.set_title('Schema Name Mapping Method')
        optionsbox = mforms.newBox(False)
        optionsbox.set_padding(8)
        optionsbox.set_spacing(8)

        label = mforms.newLabel(
            'Choose how the reverse engineered schemas and objects should be mapped.\n'
        )
        label.set_name('')
        optionsbox.add(label, False)

        options = [
            'Keep schemas as they are: Catalog.Schema.Table -> Schema.Table',
            'Only one schema: Catalog.Schema.Table -> Catalog.Table',
            'Only one schema, keep current schema names as a prefix: Catalog.Schema.Table -> Catalog.Schema_Table',
        ]
        rid = mforms.RadioButton.new_id()
        self.options = []
        for opt in options:
            radio_button = mforms.newRadioButton(rid)
            radio_button.set_name('Option %i' % options.index(opt))
            radio_button.set_text(opt)
            optionsbox.add(radio_button, False)
            self.options.append(radio_button)
        self.options[1].set_active(True)

        optionspanel.add(optionsbox)
        self._optionspanel = optionspanel
        #self._advanced_shown = False
        #self._optionspanel.show(False)
        self.content.add_end(optionspanel, False)
예제 #55
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)