Exemple #1
0
    def __init__(self, win):
        """Constructor.

        :param win: A MainWindow instance.
        """
        self.__gobject_init__()
        PaneItem.__init__(self, win.app)
        self.app = win.app
        self.win = win
        self.connection = None
        self._buffer_dirty = False
        self.__conn_close_tag = None
        self._query_timer = None
        self._filename = None
        self._filecontent_read = ""
        self.builder = gtk.Builder()
        self.builder.set_translation_domain('crunchyfrog')
        self.builder.add_from_file(self.app.get_glade_file('editor.glade'))
        self.widget = self.builder.get_object('box_editor')
        self._setup_widget()
        self._setup_connections()
        self.on_messages_copy = self.results.on_messages_copy
        self.on_messages_clear = self.results.on_messages_clear
        self.on_copy_data = self.results.on_copy_data
        self.on_export_data = self.results.on_export_data
        self.builder.connect_signals(self)
        self.set_data("win", None)
        self.win.emit('editor-created', self)
        self.show_all()
        if self.app.config.get('editor.hide_results_pane'):
            gobject.idle_add(self.toggle_results_pane)
Exemple #2
0
    def __init__(self, win):
        """Constructor.

        :param win: A MainWindow instance.
        """
        self.__gobject_init__()
        PaneItem.__init__(self, win.app)
        self.app = win.app
        self.win = win
        self.connection = None
        self._buffer_dirty = False
        self.__conn_close_tag = None
        self._query_timer = None
        self._filename = None
        self._filecontent_read = ""
        self.builder = gtk.Builder()
        self.builder.set_translation_domain('crunchyfrog')
        self.builder.add_from_file(self.app.get_glade_file('editor.glade'))
        self.widget = self.builder.get_object('box_editor')
        self._setup_widget()
        self._setup_connections()
        self.on_messages_copy = self.results.on_messages_copy
        self.on_messages_clear = self.results.on_messages_clear
        self.on_copy_data = self.results.on_copy_data
        self.on_export_data = self.results.on_export_data
        self.builder.connect_signals(self)
        self.set_data("win", None)
        self.win.emit('editor-created', self)
        self.show_all()
        if self.app.config.get('editor.hide_results_pane'):
            gobject.idle_add(self.toggle_results_pane)
Exemple #3
0
 def __init__(self, app, instance):
     gtk.ScrolledWindow.__init__(self)
     PaneItem.__init__(self, app)
     self.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
     self.set_shadow_type(gtk.SHADOW_ETCHED_IN)
     self.app = app
     self.instance = instance
     self.iview = IPythonView()
     self.iview.updateNamespace({"app": self.app, "window": self.instance})
     self.add(self.iview)
     self.set_size_request(-1, 100)
     self.show_all()
Exemple #4
0
 def __init__(self, app, instance):
     gtk.ScrolledWindow.__init__(self)
     PaneItem.__init__(self, app)
     self.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
     self.set_shadow_type(gtk.SHADOW_ETCHED_IN)
     self.app = app
     self.instance = instance
     self.iview = IPythonView()
     self.iview.updateNamespace({"app": self.app,
                                 "window": self.instance})
     self.add(self.iview)
     self.set_size_request(-1, 100)
     self.show_all()
Exemple #5
0
 def __init__(self, app, instance, datasource):
     gtk.ScrolledWindow.__init__(self)
     PaneItem.__init__(self, app)
     self.app = app
     self.instance = instance
     self.datasource = datasource
     self.tab_label.set_datasource(datasource)
     self.tab_label.set_text(_(u'Shell') + (': %s' % datasource.public_url))
     self.term = vte.Terminal()
     self.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
     self.add(self.term)
     self.term.show()
     cmd, args = self.datasource.backend.get_native_shell_command(
         self.datasource.url)
     args.insert(0, cmd)
     self.term.connect('child-exited', self.on_child_exited, cmd, args)
     self.term.fork_command(cmd, args)
 def __init__(self, app, instance, datasource):
     gtk.ScrolledWindow.__init__(self)
     PaneItem.__init__(self, app)
     self.app = app
     self.instance = instance
     self.datasource = datasource
     self.tab_label.set_datasource(datasource)
     self.tab_label.set_text(_(u'Shell') + (': %s' % datasource.public_url))
     self.term = vte.Terminal()
     self.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
     self.add(self.term)
     self.term.show()
     cmd, args = self.datasource.backend.get_native_shell_command(
         self.datasource.url)
     args.insert(0, cmd)
     self.term.connect('child-exited', self.on_child_exited, cmd, args)
     self.term.fork_command(cmd, args)
Exemple #7
0
 def __init__(self, app, instance, library):
     """Constructor."""
     self.app = app
     self.instance = instance
     self.lib = library
     gtk.ScrolledWindow.__init__(self)
     PaneItem.__init__(self, app)
     self.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
     self.model = gtk.TreeStore(
         gobject.TYPE_PYOBJECT,  # 0 item
         str,  # 1 stock id
         str,  # 2 label
         str,  # 3 content
         bool,  # 4 editable
     )
     self.list = gtk.TreeView(self.model)
     col = gtk.TreeViewColumn()
     renderer = gtk.CellRendererPixbuf()
     col.pack_start(renderer, expand=False)
     col.add_attribute(renderer, 'stock-id', 1)
     renderer = gtk.CellRendererText()
     renderer.set_property('ellipsize', pango.ELLIPSIZE_END)
     col.pack_start(renderer, expand=True)
     col.add_attribute(renderer, 'text', 2)
     col.add_attribute(renderer, 'editable', 4)
     renderer.connect('edited', self.on_entry_edited)
     self.list.append_column(col)
     self.list.set_headers_visible(False)
     self.add(self.list)
     self.list.show()
     self.list.connect("button-press-event", self.on_button_press_event)
     # Drag'n'drop
     targets = [
         ('MY_TREE_MODEL_ROW', gtk.TARGET_SAME_WIDGET, 0),
         ('text/plain', 0, 1),
     ]
     self.list.enable_model_drag_source(
         gtk.gdk.BUTTON1_MASK, targets,
         gtk.gdk.ACTION_DEFAULT | gtk.gdk.ACTION_MOVE)
     self.list.enable_model_drag_dest(targets, gtk.gdk.ACTION_DEFAULT)
     self.list.connect('drag_data_get', self.on_drag_data_get)
     self.list.connect('drag_data_received', self.on_drag_data_received)
Exemple #8
0
 def __init__(self, app, instance, library):
     """Constructor."""
     self.app = app
     self.instance = instance
     self.lib = library
     gtk.ScrolledWindow.__init__(self)
     PaneItem.__init__(self, app)
     self.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
     self.model = gtk.TreeStore(gobject.TYPE_PYOBJECT,   # 0 item
                                str,                     # 1 stock id
                                str,                     # 2 label
                                str,                     # 3 content
                                bool,                    # 4 editable
                                )
     self.list = gtk.TreeView(self.model)
     col = gtk.TreeViewColumn()
     renderer = gtk.CellRendererPixbuf()
     col.pack_start(renderer, expand=False)
     col.add_attribute(renderer, 'stock-id', 1)
     renderer = gtk.CellRendererText()
     renderer.set_property('ellipsize', pango.ELLIPSIZE_END)
     col.pack_start(renderer, expand=True)
     col.add_attribute(renderer, 'text', 2)
     col.add_attribute(renderer, 'editable', 4)
     renderer.connect('edited', self.on_entry_edited)
     self.list.append_column(col)
     self.list.set_headers_visible(False)
     self.add(self.list)
     self.list.show()
     self.list.connect("button-press-event", self.on_button_press_event)
     # Drag'n'drop
     targets = [
         ('MY_TREE_MODEL_ROW', gtk.TARGET_SAME_WIDGET, 0),
         ('text/plain', 0, 1),
     ]
     self.list.enable_model_drag_source(gtk.gdk.BUTTON1_MASK, targets,
                                        gtk.gdk.ACTION_DEFAULT|
                                        gtk.gdk.ACTION_MOVE)
     self.list.enable_model_drag_dest(targets, gtk.gdk.ACTION_DEFAULT)
     self.list.connect('drag_data_get', self.on_drag_data_get)
     self.list.connect('drag_data_received', self.on_drag_data_received)