Пример #1
0
def initialize():
    # this is called when WB finishes initializing itself

    # register ourselves for when SQL Editor tabs are opened
    nc = NotificationCenter()
    nc.add_observer(attachToSQLEditor, name = "GRNSQLEditorOpened")
    nc.add_observer(handleReconnect, name = "GRNSQLEditorReconnected")

    return 1
Пример #2
0
    def menu_will_show(self, item):
        # item is the parent node which will be None when the
        # context menu has just being opened.
        # So when the call is done for a sub-menu, no reset is needed.
        if item is None:
            self.menu.remove_all()

            if item is None:
                parent_nodes = {}
                selection = grt.List()
                pobj = None
                for node in self.tree.get_selection():
                    name = node.get_string(self.name_column)
                    obj = grt.classes.db_query_LiveDBObject()
                    obj.name = name
                    obj.schemaName = self.schema
                    obj.type = self.klass
                    if hasattr(self, 'parent_name_column'):
                        if hasattr(self, 'table'):
                            parent_name = self.table
                        else:
                            parent_name = node.get_string(
                                self.parent_name_column)

                        if parent_nodes.has_key(parent_name):
                            obj.owner = parent_nodes[parent_name]
                        else:
                            pobj = grt.classes.db_query_LiveDBObject()
                            obj.owner = pobj
                            pobj.type = 'db.Table'
                            pobj.name = parent_name
                            pobj.schemaName = self.schema
                            parent_nodes[parent_name] = pobj
                    selection.append(obj)

                if not selection and self.node_name:
                    obj = grt.classes.db_query_LiveDBObject()
                    obj.schemaName = self.schema
                    obj.type = self.node_name
                    selection.append(obj)

                    sobj = grt.classes.db_query_LiveDBObject()
                    sobj.schemaName = self.schema
                    sobj.name = self.schema
                    sobj.type = "db.Schema"
                    obj.owner = sobj

                separator = mforms.newMenuItem("", mforms.SeparatorMenuItem)
                separator.set_name("Bottom Plugins Separator")
                separator.setInternalName("bottom_plugins_separator")
                self.menu.add_item(separator)
                self.menu.add_item_with_title("Refresh", self.refresh,
                                              "Refresh", "refresh")

                args = grt.Dict()
                args["selection"] = selection
                args["menu"] = mforms.togrt(self.menu, "ContextMenu")
                args['schema_inspector'] = True
                NotificationCenter().send("GRNLiveDBObjectMenuWillShow",
                                          self.editor, args)
Пример #3
0
def initialize():
    # this is called when WB finishes initializing itself

    # register ourselves for when SQL Editor tabs are opened
    nc = NotificationCenter()
    nc.add_observer(attachToSQLEditor, name="GRNSQLEditorOpened")
    nc.add_observer(handleReconnect, name="GRNSQLEditorReconnected")

    return 1
Пример #4
0
def initialize0():
    nc = NotificationCenter()
    nc.add_observer(handleResultsetContextMenu, name = "GRNSQLResultsetMenuWillShow")

    sqlide_schematree_ext.init()

    # register a handler for when the SQLIDE live schema tree context menu is about to be shown
    nc.add_observer(sqlide_schematree_ext.handleLiveTreeContextMenu, name = "GRNLiveDBObjectMenuWillShow") # must be 1st
    nc.add_observer(sqlide_catalogman_ext.handleLiveTreeContextMenu, name = "GRNLiveDBObjectMenuWillShow")