Python gi.repository.Gtk.ScrolledWindow() Examples

The following are 30 code examples of gi.repository.Gtk.ScrolledWindow(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module gi.repository.Gtk , or try the search function .
Example #1
Source File: terminal.py    From hazzy with GNU General Public License v2.0 6 votes vote down vote up
def __init__(self, widget_window):
        Gtk.ScrolledWindow.__init__(self)

        self.terminal=Vte.Terminal()
        self.terminal.spawn_sync(
                Vte.PtyFlags.DEFAULT,   # depreciated, does nothing?
                os.environ['HOME'],     # where to start the command?
                ["/bin/bash"],          # where is the emulator?
                [],                     # it's ok to leave this list empty
                GLib.SpawnFlags.DO_NOT_REAP_CHILD,
                None,                   # at least None is required
                None,
                )

        self.terminal.set_font_scale(1.1)

        self.terminal.connect('key-press-event', self.on_key_press)

        self.set_size_request(200, 200)
        self.set_hexpand(True)
        self.set_vexpand(True)

        self.add(self.terminal) 
Example #2
Source File: bruter.py    From badKarma with GNU General Public License v3.0 6 votes vote down vote up
def get_log(self, output):
		""" bruter read function, (parser could be implemented?)"""

		scrolledwindow = Gtk.ScrolledWindow()
		scrolledwindow.set_hexpand(True)
		scrolledwindow.set_vexpand(True)

		textview = widgets.SourceView()
		textbuffer = textview.get_buffer()
		textbuffer.set_text(output)

		textview.set_editable(False)

		scrolledwindow.add(textview)
		textview.show()

		return scrolledwindow 
Example #3
Source File: screenshot.py    From badKarma with GNU General Public License v3.0 6 votes vote down vote up
def get_log(self,out):
		base64image = out

		try:
			raw_data = base64.b64decode(base64image)
			input_stream = Gio.MemoryInputStream.new_from_data(raw_data, None) 
			pixbuf = Pixbuf.new_from_stream(input_stream, None) 
		except:
			# error image
			raw_data = base64.b64decode("""iVBORw0KGgoAAAANSUhEUgAAAZAAAAFACAYAAACSgSrjAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4QoWAAsIwyEjnAAAEPhJREFUeNrt3b9uW+cZwOFXhhF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+99uL6p8wFQrq+u/EwfdwPR+QCoyuBuyOAjLJ0PgCoM7ob0OsLS+QCozuBuyJAjLJ0PgLoM6oYMeRFd5wOgLoO6IX2PsHQ+AOrUuxuy9xGWzgdA9Xp1Q27dQHQ+AJrRqxuy1wai8wHQlL26IUd7bB86HwBt2asbcmfX8ND5AGjSXt2Q2zYQnQ+Adu3shhzdtH3ofAA0b2c3ZOsRls4HAHFLN+SmDUTnA4C1rd2QNzYQnQ8AttjaDTna2Dp0PgC4ybVuyLUjLJ0PALa41g25s94+uo86HwBsc60bsnmEpfMBwC5vdEM2X0TX+QBglze6IesjLJ0PAPbx/27Ikc4HAD29iIgHdyLiU8MDgB7ejohP/wdfG3IxFRM1PgAAAABJRU5ErkJggg==""")
			input_stream = Gio.MemoryInputStream.new_from_data(raw_data, None) 
			pixbuf = Pixbuf.new_from_stream(input_stream, None) 

		self.image = Gtk.Image() 
		self.image.set_from_pixbuf(pixbuf)
		self.image.show()
		scrolledwindow = Gtk.ScrolledWindow()
		scrolledwindow.set_hexpand(True)
		scrolledwindow.set_vexpand(True)
		scrolledwindow.add(self.image)
		scrolledwindow.show()

		return scrolledwindow 
Example #4
Source File: workspace.py    From badKarma with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, service, database, view_out_scope=True):
		""" servicesview workspace tab """
		builder	 = Gtk.Builder() # glade
		builder.add_from_file(os.path.dirname(os.path.abspath(__file__)) + "/../assets/ui/servicesview.glade")	

		self.database = database
		self.service  = service

		self.notebook = builder.get_object("notebook1")
		self.portlistframe = builder.get_object("portlistframe")

		# creating the treeview, making it use the filter as a model, and adding the columns
		self.treeview = ServicesTree(self.database, self.service)

		scrolled = Gtk.ScrolledWindow()
		viewport = Gtk.Viewport()

		scrolled.add(viewport)
		viewport.add(self.treeview)
		scrolled.show_all()

		self.portlistframe.add(scrolled)

		self.refresh(self.database, view_out_scope=view_out_scope) 
Example #5
Source File: metasploit.py    From badKarma with GNU General Public License v3.0 6 votes vote down vote up
def get_log(self, output):
		""" default shell logger extension"""

		scrolledwindow = Gtk.ScrolledWindow()
		scrolledwindow.set_hexpand(True)
		scrolledwindow.set_vexpand(True)

		textview = widgets.SourceView()
		textbuffer = textview.get_buffer()
		textbuffer.set_text(output)

		textview.set_editable(False)

		scrolledwindow.add(textview)
		textview.show()

		return scrolledwindow 
Example #6
Source File: websession.py    From badKarma with GNU General Public License v3.0 6 votes vote down vote up
def get_log(self, output):
		""" default logger view"""
		
		scrolledwindow = Gtk.ScrolledWindow()
		scrolledwindow.set_hexpand(True)
		scrolledwindow.set_vexpand(True)

		textview = widgets.SourceView()
		textbuffer = textview.get_buffer()
		textbuffer.set_text(output)

		textview.set_editable(False)

		scrolledwindow.add(textview)
		scrolledwindow.show_all()

		return scrolledwindow 
Example #7
Source File: combinedview.py    From addons-source with GNU General Public License v2.0 6 votes vote down vote up
def write_album(self, person):

        self.vbox2 = Gtk.Grid(orientation=Gtk.Orientation.VERTICAL)

        scroll = Gtk.ScrolledWindow()
        scroll.add(self.vbox2)
        scroll.show_all()
        self.stack.add_titled(scroll, 'album', _('Album'))

        self.write_media(person.get_media_list(), None)

        for event_ref in person.get_event_ref_list():
            event = self.dbstate.db.get_event_from_handle(event_ref.ref)

            self.write_media(event.get_media_list(), event)

        for family_handle in person.get_family_handle_list():
            family = self.dbstate.db.get_family_from_handle(family_handle)

            self.write_media(family.get_media_list(), None)

            for event_ref in family.get_event_ref_list():
                event = self.dbstate.db.get_event_from_handle(event_ref.ref)

                self.write_media(event.get_media_list(), event) 
Example #8
Source File: RemarkableWindow.py    From Remarkable with MIT License 6 votes vote down vote up
def on_menuitem_custom_activate(self, widget):
        self.custom_window = Gtk.Window()
        self.custom_window.set_default_size(640, 480)
        self.custom_window.set_position(Gtk.WindowPosition.CENTER)
        self.custom_window.set_title("Custom CSS")

        self.custom_vbox = Gtk.VBox()
        self.custom_scroller = Gtk.ScrolledWindow()
        self.custom_button = Gtk.Button("Apply")
        self.custom_vbox.pack_end(self.custom_button, False, False, 0)
        self.custom_text_view = Gtk.TextView()
        self.custom_text_buffer = Gtk.TextBuffer()
        self.custom_text_buffer.set_text(self.custom_css)
        self.custom_text_view.set_buffer(self.custom_text_buffer)
        self.custom_scroller.add(self.custom_text_view)
        self.custom_vbox.pack_start(self.custom_scroller, True, True, 0)
        self.custom_window.add(self.custom_vbox)
        self.custom_window.show_all()
        self.custom_button.connect("clicked", self.apply_custom_css, self.custom_window, self.custom_text_buffer) 
Example #9
Source File: MediaVerify.py    From addons-source with GNU General Public License v2.0 6 votes vote down vote up
def create_tab(self, title):
        """
        Create a page in the notebook.
        """
        scrolled_window = Gtk.ScrolledWindow()
        scrolled_window.set_policy(Gtk.PolicyType.AUTOMATIC,
                                   Gtk.PolicyType.AUTOMATIC)
        view = Gtk.TreeView()
        column = Gtk.TreeViewColumn(_('Files'))
        view.append_column(column)
        cell = Gtk.CellRendererText()
        column.pack_start(cell, True)
        column.add_attribute(cell, 'text', 0)
        column.set_sort_column_id(0)
        column.set_sort_indicator(True)
        model = Gtk.ListStore(str, str)
        view.set_model(model)
        page = self.notebook.get_n_pages()
        view.connect('button-press-event', self.button_press, page)
        scrolled_window.add(view)
        self.models.append(model)
        self.views.append(view)
        label = Gtk.Label(title)
        self.notebook.append_page(scrolled_window, label) 
Example #10
Source File: GUIElements.py    From FlatCAM with MIT License 6 votes vote down vote up
def __init__(self):
        # Gtk.ScrolledWindow.__init__(self)
        # FlatCAMApp.App.log.debug('Gtk.ScrolledWindow.__init__(self)')
        super(FCTextArea, self).__init__()
        FlatCAMApp.App.log.debug('super(FCTextArea, self).__init__()')
        self.set_size_request(250, 100)
        FlatCAMApp.App.log.debug('self.set_size_request(250, 100)')
        textview = Gtk.TextView()
        #print textview
        #FlatCAMApp.App.log.debug('self.textview = Gtk.TextView()')
        #self.textbuffer = self.textview.get_buffer()
        #FlatCAMApp.App.log.debug('self.textbuffer = self.textview.get_buffer()')
        #self.textbuffer.set_text("(Nothing here!)")
        #FlatCAMApp.App.log.debug('self.textbuffer.set_text("(Nothing here!)")')
        #self.add(self.textview)
        #FlatCAMApp.App.log.debug('self.add(self.textview)')
        #self.show() 
Example #11
Source File: custom.py    From Dindo-Bot with MIT License 6 votes vote down vote up
def __init__(self, model, columns):
		Gtk.Frame.__init__(self)
		self.perform_scroll = False
		self.model = model
		self.columns = columns
		self.vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
		self.add(self.vbox)
		## ScrolledWindow
		scrolled_window = Gtk.ScrolledWindow()
		self.vbox.pack_start(scrolled_window, True, True, 0)
		# TreeView
		self.tree_view = Gtk.TreeView(model)
		scrolled_window.add(self.tree_view)
		for column in columns:
			self.tree_view.append_column(column)
		self.tree_view.connect('size-allocate', self.scroll_tree_view)
		self.selection = self.tree_view.get_selection()
		self.selection.set_mode(Gtk.SelectionMode.SINGLE) 
Example #12
Source File: editform.py    From addons-source with GNU General Public License v2.0 6 votes vote down vote up
def build_interface(self):
        """
        Builds the interface.
        """
        self.model = Gtk.ListStore(str, str)
        self.view = Gtk.TreeView(model=self.model)
        self.selection = self.view.get_selection()

        renderer = Gtk.CellRendererText()
        column = Gtk.TreeViewColumn(_('Key'), renderer, text=0)
        self.view.append_column(column)

        renderer = Gtk.CellRendererText()
        renderer.set_property('editable', True)
        renderer.connect('edited', self.__cell_edited, (self.model, 1))
        column = Gtk.TreeViewColumn(_('Value'), renderer, text=1)
        self.view.append_column(column)

        scrollwin = Gtk.ScrolledWindow()
        scrollwin.add(self.view)
        scrollwin.set_policy(Gtk.PolicyType.AUTOMATIC,
                             Gtk.PolicyType.AUTOMATIC)

        self.pack_start(scrollwin, expand=True, fill=True, padding=0) 
Example #13
Source File: pyspc_gui.py    From pyspc with GNU General Public License v3.0 6 votes vote down vote up
def add_treeview(self):
        num_columns = [float for x in range(len(self.data.columns))]

        liststore = Gtk.ListStore(*num_columns)
        for ref in self.data.values.tolist():
            liststore.append(ref)

        treeview = Gtk.TreeView.new_with_model(liststore)
        for i, column_title in enumerate(self.data.columns):
            renderer = Gtk.CellRendererText()
            column = Gtk.TreeViewColumn(column_title, renderer, text=i)
            treeview.append_column(column)

        self.scrollable_treelist = Gtk.ScrolledWindow()
        self.scrollable_treelist.add(treeview)
        self.scrollable_treelist.set_vexpand(True)
        self.scrollable_treelist.set_hexpand(True)
        self.verticalbox.pack_start(self.scrollable_treelist, True, True, 0)
        self.verticalbox.show_all() 
Example #14
Source File: libtmg.py    From addons-source with GNU General Public License v2.0 6 votes vote down vote up
def __init__(self, uistate, data, parent):
        super().__init__(uistate, [], self)
        self.window = Gtk.Dialog()
        self.set_window(self.window, None, _("Database Information"))
        self.window.set_modal(True)
        self.ok = self.window.add_button(_('_OK'), Gtk.ResponseType.OK)
        self.ok.connect('clicked', self.on_ok_clicked)
        self.window.set_position(Gtk.WindowPosition.CENTER)
        self.window.set_default_size(600, 400)
        s = Gtk.ScrolledWindow()
        titles = [
            (_('Setting'), 0, 150),
            (_('Value'), 1, 400)
        ]
        treeview = Gtk.TreeView()
        model = Gtk.ListModel(treeview, titles)
        for key, value in sorted(data.items()):
            model.add((key, str(value),), key)
        s.add(treeview)
        self.window.vbox.pack_start(s, True, True, 0)
        if parent:
            self.window.set_transient_for(parent)
        self.show() 
Example #15
Source File: gnomecast.py    From gnomecast with GNU General Public License v3.0 6 votes vote down vote up
def error_callback(self, msg):
    def f():
      dialogWindow = Gtk.MessageDialog(self.win,
                            Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
                            Gtk.MessageType.INFO,
                            Gtk.ButtonsType.OK,
                            '\nGnomecast encountered an error converting your file.')
      dialogWindow.set_title('Transcoding Error')
      dialogWindow.set_default_size(1, 400)
      
      dialogBox = dialogWindow.get_content_area()
      buffer1 = Gtk.TextBuffer()
      buffer1.set_text(msg)
      text_view = Gtk.TextView(buffer=buffer1)
      text_view.set_editable(False)
      scrolled_window = Gtk.ScrolledWindow()
      scrolled_window.set_border_width(5)
      # we scroll only if needed
      scrolled_window.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
      scrolled_window.add(text_view)
      dialogBox.pack_end(scrolled_window, True, True, 0)
      dialogWindow.show_all()
      response = dialogWindow.run()
      dialogWindow.destroy()
    GLib.idle_add(f) 
Example #16
Source File: gcode_view.py    From hazzy with GNU General Public License v2.0 5 votes vote down vote up
def demo():
    view = GcodeView()
    buf = view.get_buffer()
    buf.set_text('''(TEST OF G-CODE HIGHLIGHTING)\n\nG1 X1.2454 Y2.3446 Z-10.2342 I0 J0 K0\n\nM3''')
    view.highlight_line(3, None)

    scrolled = Gtk.ScrolledWindow()
    scrolled.set_hexpand(True)
    scrolled.add(view)

    view_map = GcodeMap()
    view_map.set_view(view)

    box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
    box.pack_start(scrolled, True, True, 0)
    box.pack_start(Gtk.Separator(), False, False, 0)
    box.pack_start(view_map, False, False, 0)

    win = Gtk.Window()
    win.set_default_size(400, 300)
    win.add(box)

    win.connect('destroy', Gtk.main_quit)

    win.show_all()
    Gtk.main() 
Example #17
Source File: uistuff.py    From pychess with GNU General Public License v3.0 5 votes vote down vote up
def appendAutowrapColumn(treeview, name, **kvargs):
    cell = Gtk.CellRendererText()
    # cell.props.wrap_mode = Pango.WrapMode.WORD
    # TODO:
    # changed to ellipsize instead until "never ending grow" bug gets fixed
    # see https://github.com/pychess/pychess/issues/1054
    cell.props.ellipsize = Pango.EllipsizeMode.END
    column = Gtk.TreeViewColumn(name, cell, **kvargs)
    treeview.append_column(column)

    def callback(treeview, allocation, column, cell):
        otherColumns = [c for c in treeview.get_columns() if c != column]
        newWidth = allocation.width - sum(c.get_width() for c in otherColumns)

        hsep = GObject.Value()
        hsep.init(GObject.TYPE_INT)
        hsep.set_int(0)
        treeview.style_get_property("horizontal-separator", hsep)
        newWidth -= hsep.get_int() * (len(otherColumns) + 1) * 2
        if cell.props.wrap_width == newWidth or newWidth <= 0:
            return
        cell.props.wrap_width = newWidth
        store = treeview.get_model()
        store_iter = store.get_iter_first()
        while store_iter and store.iter_is_valid(store_iter):
            store.row_changed(store.get_path(store_iter), store_iter)
            store_iter = store.iter_next(store_iter)
        treeview.set_size_request(0, -1)
    # treeview.connect_after("size-allocate", callback, column, cell)

    scroll = treeview.get_parent()
    if isinstance(scroll, Gtk.ScrolledWindow):
        scroll.set_policy(Gtk.PolicyType.NEVER, scroll.get_policy()[1])

    return cell 
Example #18
Source File: mdi.py    From hazzy with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, widget_window):
        Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL)

        self.set_hexpand(True)
        self.set_vexpand(True)

        # Widget Factories MDI entry widget
        self.entry = MDIEntry()
        self.pack_end(self.entry, False, False, 0)

        # Scrolled window for the MDI history view
        scrolled = Gtk.ScrolledWindow()
        self.vadj = scrolled.get_vadjustment()
        self.pack_start(scrolled, True, True, 0)

        # MDI history TreeView
        self.view = Gtk.TreeView(self.entry.model)
        self.view.set_activate_on_single_click(True)
        self.view.set_headers_visible(False)
        scrolled.add(self.view)

        renderer = Gtk.CellRendererText()
        column = Gtk.TreeViewColumn("Command", renderer, text=0)
        self.view.append_column(column)

        self.selection = self.view.get_selection()
        self.scrolled_to_bottom = False

        self.view.connect('size-allocate', self.scroll_to_bottom)
        self.view.connect('row-activated', self.on_view_row_activated)
        self.view.connect('cursor-changed', self.on_view_cursor_changed)
        self.entry.connect('activate', self.on_entry_activated)
        self.entry.connect('focus-in-event', self.on_entry_gets_focus)
        self.entry.connect('key-press-event', self.on_entry_keypress)

    # On history item clicked set the cmd in the MDI entry 
Example #19
Source File: wxcef.py    From Librian with Mozilla Public License 2.0 5 votes vote down vote up
def embed_browser(self, url):
        window_info = cef.WindowInfo()
        (width, height) = self.browser_panel.GetClientSize().Get()
        assert self.browser_panel.GetHandle(), "Window handle not available"
        if LINUX:
            handle_to_use = self.browser_panel.GetHandle()
            display = Gdk.Display.get_default()
            window = GdkX11.X11Window.foreign_new_for_display(display,handle_to_use)
            self.gtk_window = gtk_window = Gtk.Window()
            def callback(gtk_window,window):
                print("inside callback")
                gtk_window.set_window(window)
                gtk_window.set_visual( gtk_window.get_screen().lookup_visual(0x21))
            gtk_window.connect("realize",callback,window)
            gtk_window.set_has_window(True)
            gtk_window.show()
            sw = Gtk.ScrolledWindow()
            sw.show()
            gtk_window.add(sw)
            sw.set_visual( sw.get_screen().lookup_visual(0x21))
            self.sw = sw
            self.Show()
            window_info.SetAsChild(sw.get_window().get_xid(),[0, 0, width, height])
        else:
            window_info.SetAsChild(self.browser_panel.GetHandle(), [0, 0, width, height])
        self.browser = cef.CreateBrowserSync(window_info,url=url,browserSettings={'web_security_disabled': True,})
        self.browser.SetClientHandler(FocusHandler()) 
Example #20
Source File: results.py    From runsqlrun with MIT License 5 votes vote down vote up
def __init__(self, worksheet):
        super(Results, self).__init__()
        self.win = worksheet.win
        self._active_query = None

        self.data = DataList(self)
        sw = Gtk.ScrolledWindow()
        sw.add(self.data)
        self.append_page(sw, Gtk.Label('Results'))

        self.log = QueryLog()
        sw = Gtk.ScrolledWindow()
        sw.add(self.log)
        self.append_page(sw, Gtk.Label('Log')) 
Example #21
Source File: __init__.py    From runsqlrun with MIT License 5 votes vote down vote up
def __init__(self, win):
        super(Worksheet, self).__init__()
        self.win = win
        self.app = win.app
        self.connection = None
        self.editor = Editor(self)
        self.editor_context = EditorContext(self)
        self.results = Results(self)

        sw = Gtk.ScrolledWindow()
        sw.add(self.editor)

        sw_context = Gtk.ScrolledWindow()
        sw_context.set_policy(
            Gtk.PolicyType.NEVER,
            Gtk.PolicyType.AUTOMATIC
        )
        sw_context.add(self.editor_context)

        self._context_paned = Gtk.HPaned()
        if self.app.args.experimental:
            self._context_paned.add1(sw_context)
        self._context_paned.add2(sw)
        self._context_paned.set_position(200)
        self.add1(self._context_paned)

        self.add2(self.results)

        self.connect('realize', self.on_map_event)
        self.connect('size-allocate', self.on_size_allocate)
        self.app.connection_manager.connect(
            'connection-deleted', self.on_connection_deleted) 
Example #22
Source File: results.py    From runsqlrun with MIT License 5 votes vote down vote up
def __init__(self, parent, data):
        """
        The constructor of this class takes 1 argument:

        :Parameter:
            data
                A Python value to display
        """
        Gtk.Dialog.__init__(self, 'Cell Content', parent,
                            Gtk.DialogFlags.DESTROY_WITH_PARENT,
                            None, use_header_bar=True)
        self.win = parent
        self.set_border_width(10)
        sw = Gtk.ScrolledWindow()
        sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
        sw.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
        self.vbox.pack_start(sw, True, True, True)

        tv = self._initiate_textview(data)

        tv.set_border_width(10)
        tv.set_editable(False)
        tv.set_wrap_mode(Gtk.WrapMode.WORD_CHAR)
        sw.add(tv)

        sw.show_all()
        self.resize(650, 550) 
Example #23
Source File: execution_history.py    From RAFCON with Eclipse Public License 1.0 5 votes vote down vote up
def __init__(self):
        View.__init__(self)
        Gtk.ScrolledWindow.__init__(self)

        history_tree = ExecutionHistoryTreeView()

        reload_button = Gtk.Button.new_with_label("Reload")
        reload_button.set_border_width(constants.BUTTON_BORDER_WIDTH)
        clean_button = Gtk.Button.new_with_label("Clean")
        clean_button.set_border_width(constants.BUTTON_BORDER_WIDTH)
        open_separately_button = Gtk.Button.new_with_label("Open externally")
        open_separately_button.set_border_width(constants.BUTTON_BORDER_WIDTH)

        button_box = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0)
        button_box.get_style_context().add_class("widget-toolbar")
        button_box.pack_end(reload_button, False, True, 0)
        button_box.pack_end(clean_button, False, True, 0)
        button_box.pack_end(open_separately_button, False, True, 0)

        label.ellipsize_labels_recursively(button_box)

        history_vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
        history_vbox.pack_end(button_box, False, True, 0)
        history_vbox.pack_end(self, True, True, 0)

        self.add(history_tree)
        self.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
        self.show_all()

        self['history_vbox'] = history_vbox
        self['history_view'] = self
        self['history_tree'] = history_tree
        self['reload_button'] = reload_button
        self['clean_button'] = clean_button
        self['open_separately_button'] = open_separately_button
        self.top = 'history_vbox' 
Example #24
Source File: scrolled_window.py    From kano-toolset with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, hexpand=None, vexpand=None, wide_scrollbar=False):
        Gtk.ScrolledWindow.__init__(self, hexpand=hexpand, vexpand=vexpand)
        self.set_overlay_scrolling(False) 
Example #25
Source File: LecturesPanel.py    From pychess with GNU General Public License v3.0 5 votes vote down vote up
def load(self, persp):
        self.persp = persp
        self.box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)

        self.tv = Gtk.TreeView()

        renderer = Gtk.CellRendererText()
        column = Gtk.TreeViewColumn(_("Title"), renderer, text=1)
        self.tv.append_column(column)

        renderer = Gtk.CellRendererText()
        column = Gtk.TreeViewColumn(_("Author"), renderer, text=2)
        self.tv.append_column(column)

        self.tv.connect("row-activated", self.row_activated)

        self.store = Gtk.ListStore(str, str, str)

        for file_name, title, author in LECTURES:
            self.store.append([file_name, title, author])

        self.tv.set_model(self.store)
        self.tv.get_selection().set_mode(Gtk.SelectionMode.BROWSE)
        self.tv.set_cursor(conf.get("learncombo%s" % LECTURE))

        scrollwin = Gtk.ScrolledWindow()
        scrollwin.add(self.tv)
        scrollwin.show_all()

        self.box.pack_start(scrollwin, True, True, 0)
        self.box.show_all()

        return self.box 
Example #26
Source File: scorePanel.py    From pychess with GNU General Public License v3.0 5 votes vote down vote up
def load(self, gmwidg):
        self.boardview = gmwidg.board.view
        self.plot = ScorePlot(self.boardview)
        self.sw = __widget__ = Gtk.ScrolledWindow()
        __widget__.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        port = Gtk.Viewport()
        port.add(self.plot)
        port.set_shadow_type(Gtk.ShadowType.NONE)
        __widget__.add(port)
        __widget__.show_all()

        self.plot_cid = self.plot.connect("selected", self.plot_selected)
        self.cid = self.boardview.connect('shownChanged', self.shownChanged)
        self.model_cids = [
            self.boardview.model.connect_after("game_changed", self.game_changed),
            self.boardview.model.connect_after("moves_undone", self.moves_undone),
            self.boardview.model.connect_after("analysis_changed", self.analysis_changed),
            self.boardview.model.connect_after("game_started", self.game_started),
            self.boardview.model.connect_after("game_terminated", self.on_game_terminated),
        ]

        def cb_config_changed(none):
            self.fetch_chess_conf()
            self.plot.redraw()
        self.cids_conf = [
            conf.notify_add("scoreLinearScale", cb_config_changed)
        ]
        self.fetch_chess_conf()

        uistuff.keepDown(__widget__)

        return __widget__ 
Example #27
Source File: commentPanel.py    From pychess with GNU General Public License v3.0 5 votes vote down vote up
def load(self, gmwidg):

        self.gamemodel = gmwidg.board.view.model
        self.model_cids = [
            self.gamemodel.connect_after("game_changed", self.game_changed),
            self.gamemodel.connect_after("game_started", self.game_started),
            self.gamemodel.connect_after("moves_undone", self.moves_undone),
            self.gamemodel.connect_after("game_terminated", self.on_game_terminated),
        ]

        scrollwin = Gtk.ScrolledWindow()
        self.tv = Gtk.TreeView()
        self.tv.set_headers_visible(False)
        scrollwin.add(self.tv)
        scrollwin.show_all()

        self.store = Gtk.ListStore(str)
        self.tv.set_model(self.store)
        self.tv.get_selection().set_mode(Gtk.SelectionMode.BROWSE)
        uistuff.appendAutowrapColumn(self.tv, "Comment", text=0)
        self.tv_cid = self.tv.connect('cursor_changed', self.cursorChanged)

        self.boardview = gmwidg.board.view
        self.cid = self.boardview.connect("shownChanged", self.shownChanged)

        return scrollwin 
Example #28
Source File: InfoPanel.py    From pychess with GNU General Public License v3.0 5 votes vote down vote up
def onFingeringFinished(self, fm, finger, playername):
            if not isinstance(self.get_child(), Gtk.Label) or \
                    finger.getName().lower() != playername.lower():
                return
            self.fm.disconnect(self.handle_id)

            label = Gtk.Label()
            label.set_markup("<b>%s</b>" % playername)
            widget = Gtk.Frame()
            widget.set_label_widget(label)
            widget.set_shadow_type(Gtk.ShadowType.NONE)

            alignment = Gtk.Alignment.new(0, 0, 1, 1)
            alignment.set_padding(3, 0, 12, 0)
            widget.add(alignment)

            text_view = Gtk.TextView()
            text_view.set_editable(False)
            text_view.set_cursor_visible(False)
            text_view.props.wrap_mode = Gtk.WrapMode.WORD

            tb_iter = text_view.get_buffer().get_end_iter()
            for i, note in enumerate(finger.getNotes()):
                if note:
                    insert_formatted(text_view, tb_iter, "%s\n" % note)
            text_view.show_all()
            scroll_win = Gtk.ScrolledWindow()
            scroll_win.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
            scroll_win.add(text_view)
            alignment.add(scroll_win)

            self.remove(self.get_child())
            self.add(widget)
            widget.show_all() 
Example #29
Source File: editordialog.py    From syncthing-gtk with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, app, gladefile, title):
		GObject.GObject.__init__(self)
		self.app = app
		self.config = None
		self._loading = False
		self.values = None
		self.checks = {}
		# Stores original label  value while error message is displayed.
		self.original_labels={}
		# Used by get_widget_id
		self.widget_to_id = {}
		self.setup_widgets(gladefile, title)
		# Move entire dialog content to ScrolledWindow if screen height
		# is too small
		if Gdk.Screen.get_default().height() < 900:
			if not self["editor-content"] is None:
				parent = self["editor-content"].get_parent()
				if isinstance(parent, Gtk.Notebook):
					order, labels = [], {}
					for c in [] + parent.get_children():
						labels[c] = parent.get_tab_label(c)
						order.append(c)
						parent.remove(c)
					for c in order:
						sw = Gtk.ScrolledWindow()
						sw.add_with_viewport(c)
						parent.append_page(sw, labels[c])
				else:
					sw = Gtk.ScrolledWindow()
					parent.remove(self["editor-content"])
					sw.add_with_viewport(self["editor-content"])
					parent.pack_start(sw, True, True, 0)
				self["editor"].resize(self["editor"].get_size()[0], Gdk.Screen.get_default().height() * 2 / 3) 
Example #30
Source File: gameinfoDialog.py    From pychess with GNU General Public License v3.0 5 votes vote down vote up
def on_pick_date(button, date_entry):
    # Parse the existing date
    date = date_entry.get_text()
    year, month, day = parseDateTag(date)

    # Prepare the date of the picker
    calendar = Gtk.Calendar()
    curyear, curmonth, curday = calendar.get_date()
    year = curyear if year is None else year
    month = curmonth if month is None else month - 1
    day = curday if day is None else day
    calendar.select_month(month, year)
    calendar.select_day(day)

    # Show the dialog
    dialog = Gtk.Dialog(_("Pick a date"),
                        None,
                        Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
                        (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT))

    sw = Gtk.ScrolledWindow()
    sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
    sw.add(calendar)

    dialog.get_content_area().pack_start(sw, True, True, 0)
    dialog.resize(300, 200)
    dialog.show_all()

    response = dialog.run()
    dialog.destroy()

    if response == Gtk.ResponseType.ACCEPT:
        year, month, day = calendar.get_date()
        date_entry.set_text("%04d.%02d.%02d" % (year, month + 1, day))