Python gi.repository.Gtk.Viewport() Examples
The following are 6
code examples of gi.repository.Gtk.Viewport().
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: modeswitch_test.py From vimiv with MIT License | 6 votes |
def test_image_thumbnail(self): """Switch between image and thumbnail mode.""" self.assertTrue(self.vimiv["main_window"].is_focus()) self.assertTrue(self.vimiv["main_window"].is_visible()) self.assertEqual(type(self.vimiv["main_window"].get_child()), Gtk.Viewport) # We do not know the exact viewport self.vimiv["thumbnail"].toggle() self.assertTrue(self.vimiv["thumbnail"].is_focus()) self.assertEqual(self.vimiv["main_window"].get_child(), self.vimiv["thumbnail"]) self.assertEqual(self.vimiv["thumbnail"].last_focused, "im") # Quick insert of thumbnail <-> manipulate as it would be to expensive # to write an extra thumbnail class for this self.vimiv["manipulate"].toggle() self.assertTrue(self.vimiv["thumbnail"].is_focus()) self.assertFalse(self.vimiv["manipulate"].is_visible()) self.check_statusbar( "WARNING: Manipulate not supported in thumbnail mode") self.vimiv["thumbnail"].toggle() self.assertTrue(self.vimiv["main_window"].is_focus()) self.assertEqual(type(self.vimiv["main_window"].get_child()), Gtk.Viewport)
Example #2
Source File: workspace.py From badKarma with GNU General Public License v3.0 | 6 votes |
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 #3
Source File: gtk.py From kickoff-player with GNU General Public License v3.0 | 5 votes |
def set_scroll_position(widget, value, direction='vertical', window=None): viewport = widget.get_ancestor(Gtk.Viewport) if direction == 'vertical': viewport.get_vadjustment().set_value(value) if direction == 'horizontal': viewport.get_hadjustment().set_value(value) if window is not None: window.queue_resize_no_redraw()
Example #4
Source File: scorePanel.py From pychess with GNU General Public License v3.0 | 5 votes |
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 #5
Source File: widgets.py From badKarma with GNU General Public License v3.0 | 5 votes |
def __init__(self, database, host, *args, **kwargs): super(host_informations, self).__init__(*args, **kwargs) """ single host information widget """ builder = Gtk.Builder() # glade builder.add_from_file(os.path.dirname(os.path.abspath(__file__)) + "/../assets/ui/widgets.glade") self.info_viewport = builder.get_object("host-info-viewport") self.info_mac = builder.get_object("info-mac") self.info_os = builder.get_object("info-os") self.info_vendor = builder.get_object("info-vendor") self.info_status = builder.get_object("info-status") self.info_address = builder.get_object("info-address") self.info_hostnames = builder.get_object("info-hostnames") self.info_distance = builder.get_object("info-distance") self.info_tcpseq = builder.get_object("info-tcpseq") self.info_uptime = builder.get_object("info-uptime") self.info_latitude = builder.get_object("info-latitude") self.info_longitude = builder.get_object("info-longitude") self.info_isp = builder.get_object("info-isp") self.info_country_code = builder.get_object("info-country_code") self.info_country_name = builder.get_object("info-country_name") self.info_organization = builder.get_object("info-organization") viewport = Gtk.Viewport() viewport.add(self.info_viewport) viewport.set_vexpand(True) viewport.set_hexpand(True) self.add(viewport) self.set_property("height-request", 400) self.show_all() self.database = database self.host = host self.refresh(self.database, self.host)
Example #6
Source File: widgets.py From badKarma with GNU General Public License v3.0 | 4 votes |
def __init__(self, database, host, *args, **kwargs): super(Notesview, self).__init__(*args, **kwargs) """ notes view per host """ builder = Gtk.Builder() builder.add_from_file(os.path.dirname(os.path.abspath(__file__)) + "/../assets/ui/widgets.glade") self.notes_view = builder.get_object("notes-view") self.notes_treepl = builder.get_object("notes-treepl") self.add_button = builder.get_object("add-button") self.database = database self.host = host # notes self.notes_view = builder.get_object("notes-view") self.notes_liststore = Gtk.ListStore(str, int) self.notestree = Gtk.TreeView(model=self.notes_liststore) for i, column_title in enumerate(["title"]): renderer = Gtk.CellRendererText() column = Gtk.TreeViewColumn(column_title, renderer, text=i) self.notestree.append_column(column) self.notes_treepl.add(self.notestree) self.notestree.show() #self.refresh(self.database) self.notestree.connect("row-activated", self.on_row_activated) self.add_button.connect("clicked", self.add_note) self.notestree.connect("button_press_event", self.mouse_click) self.notestree.props.activate_on_single_click = True # multi selection selection = self.notestree.get_selection() selection.set_mode(Gtk.SelectionMode.MULTIPLE) viewport = Gtk.Viewport() viewport.add(self.notes_view) self.set_property("height-request", 400) self.add(viewport) self.show_all() self.refresh(self.database, self.host)