Пример #1
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
Пример #2
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)        
Пример #3
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
Пример #4
0
def selectServer(title):
    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)

    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
Пример #5
0
def selectServer(title):
    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)

    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
Пример #6
0
    def __init__(self, secman, user=""):
        mforms.Form.__init__(self, None,
                             mforms.FormResizable | mforms.FormMinimizable)

        self.set_title("New Schema Privilege Definition")

        self.secman = secman

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

        label = newLabel()
        label.set_text(
            "Select the Host and the Schema for which the user '%s'\nwill have the privileges you want to define."
            % user)
        box.add(label, False, True)

        panel = newPanel(mforms.TitledBoxPanel)
        panel.set_title("Host")
        box.add(panel, False, True)
        table = newTable()
        panel.add(table)
        table.set_padding(8)
        table.set_row_count(3)
        table.set_column_count(3)
        table.set_row_spacing(8)

        self.host1 = newRadioButton(mforms.RadioButton.new_id())
        self.host1.set_active(True)
        self.host1.add_clicked_callback(self.host_radio_changed)
        self.host1.set_text("Any Host (%)")
        table.add(self.host1, 0, 1, 0, 1, mforms.HFillFlag)

        self.host2 = newRadioButton(self.host1.group_id())
        self.host2.set_text("Hosts matching pattern or name:")
        self.host2.add_clicked_callback(self.host_radio_changed)
        table.add(self.host2, 0, 1, 1, 2, mforms.HFillFlag)

        self.host2entry = newTextEntry()
        table.add(self.host2entry, 1, 2, 1, 2,
                  mforms.HFillFlag | mforms.HExpandFlag)

        self.host3 = newRadioButton(self.host1.group_id())
        self.host3.set_text("Selected host:")
        self.host3.add_clicked_callback(self.host_radio_changed)
        table.add(self.host3, 0, 1, 2, 3, mforms.HFillFlag)

        self.host3sel = newSelector()
        table.add(self.host3sel, 1, 2, 2, 3,
                  mforms.HFillFlag | mforms.HExpandFlag)

        hosts = [h for u, h in secman.account_names if u == user]
        self.host3sel.add_items(hosts)

        panel = newPanel(mforms.TitledBoxPanel)
        panel.set_title("Schema")
        box.add(panel, True, True)
        table = newTable()
        panel.add(table)
        table.set_padding(8)
        table.set_row_count(3)
        table.set_column_count(3)
        table.set_row_spacing(8)

        self.schema1 = newRadioButton(mforms.RadioButton.new_id())
        self.schema1.set_active(True)
        self.schema1.add_clicked_callback(self.schema_radio_changed)
        self.schema1.set_text("Any Schema (%)")
        table.add(self.schema1, 0, 1, 0, 1, mforms.HFillFlag)

        self.schema2 = newRadioButton(self.schema1.group_id())
        self.schema2.add_clicked_callback(self.schema_radio_changed)
        self.schema2.set_text("Schemas matching pattern or name:")
        table.add(self.schema2, 0, 1, 1, 2, mforms.HFillFlag)

        self.schema2entry = newTextEntry()
        table.add(self.schema2entry, 1, 2, 1, 2,
                  mforms.HFillFlag | mforms.HExpandFlag)

        self.schema3 = newRadioButton(self.schema1.group_id())
        self.schema3.add_clicked_callback(self.schema_radio_changed)
        self.schema3.set_text("Selected schema:")
        table.add(self.schema3, 0, 1, 2, 3, mforms.HFillFlag)

        self.schema3sel = newListBox(False)
        table.add(
            self.schema3sel, 1, 2, 2, 3, mforms.HFillFlag | mforms.HExpandFlag
            | mforms.VFillFlag | mforms.VExpandFlag)
        self.schema3sel.add_items(self.secman.schema_names)

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

        bbox.set_spacing(8)

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

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

        self.set_size(450, 500)

        self.host_radio_changed()
        self.schema_radio_changed()

        self.center()