本文整理汇总了Python中gi.repository.Gtk.ScrolledWindow方法的典型用法代码示例。如果您正苦于以下问题:Python Gtk.ScrolledWindow方法的具体用法?Python Gtk.ScrolledWindow怎么用?Python Gtk.ScrolledWindow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Gtk
的用法示例。
在下文中一共展示了Gtk.ScrolledWindow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import ScrolledWindow [as 别名]
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()
示例2: build_interface
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import ScrolledWindow [as 别名]
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)
示例3: create_tab
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import ScrolledWindow [as 别名]
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)
示例4: write_album
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import ScrolledWindow [as 别名]
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)
示例5: on_menuitem_custom_activate
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import ScrolledWindow [as 别名]
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)
示例6: get_log
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import ScrolledWindow [as 别名]
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
示例7: get_log
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import ScrolledWindow [as 别名]
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
示例8: get_log
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import ScrolledWindow [as 别名]
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
示例9: get_log
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import ScrolledWindow [as 别名]
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+cZwOFXhhFAHjPGgzIFCQu4BbQF6SBfgZyhRW7Bvox2ypwhvgR3SZasydAiG4EmQJUgQwEO7ujRKoIg7uDDhpYoiufwO+d8f54HKES0saNSlF6+H3n0iwC2ujg5/eTi5PQT9wRsd+QugGuDIyLi7Yj4vvuvHkTEi8Vq6c6BDXfcBfDm8OgGxZOIuN/958litVwPFsAGAjcOkY8i4u9X/us/LlbLf7h3wACBrdtHHMXdeBXfRcTi6v8cR/H7eBW/OMqC1xxhQWexWka8io+3DI+IiEW8io8ND7CBwLYN5DgiXt7yj91brJaX7i2wgUD88N6H65tf7fGPf3Xlz4ANBBrdOqJ7h9VZRHy95x97uFgtv9l4xxYYINDwIHkZEcd7/uOXi9XynnuN1jnCounto/v4rMfwiIg47v6Ma0OwgUDDQ+R3EfHPiLjb84/+EhF/WKyW/3IvYgOBNn0+YHhE92c+d/dhgECb28dfIuKjA/6Kj7q/A5rkCItWh8f9eP3LEt8+8K96EREPFqvlc/cqNhCoe3Csb36WYHhE93d8duXvBhsIVDpEziPii8R/7aPFavmlexcDBOrdPtadj/uJ//rnoRtCYxxh0czwuNL5SE03BBsIVDxEtnU+UtMNwQCBmraPHZ2P5P863RBa4QiL6t3S+Uj+r9MNwQYC9Wwg+3Q+UtMNwQYCper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IXcn+qbR+QAY36TdkEmOsHQ+AKZZwqfshkyy7ne/w/6lry0T+DEi3sr0c/s5It73JWIC9xar5eXY/5JRj7B+eO/D+OCnbyP8pl2m4wc0vP6Z+3DjZ3BZG8j6XVdd5+NrX0+AST1crJbfbLwDtpwBsjFIXoZf1Q4wtcvFanlvzH/BKC+i63wAzG70bsiYR1g6HwDzGrUbMubbeHU+AOY1ajdkrCMsnQ+APIzWDUl+hNX9bvrvw69qB8jFi4h4sFgtn2e5geh8AGRrlG5I0g2k63x84WsFkKVHi9Xyy6wGiM4HQBGSdkMOPsLS+QAoRtJuSKoNROcDoBxJuiEHDZCNzsd34Ve1A5TiIo7i4G7IQUdYOh8ARUrSDTl0A9H5ACjXQd2QQRvID+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
示例10: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import ScrolledWindow [as 别名]
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)
示例11: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import ScrolledWindow [as 别名]
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()
示例12: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import ScrolledWindow [as 别名]
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)
示例13: add_treeview
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import ScrolledWindow [as 别名]
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()
示例14: error_callback
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import ScrolledWindow [as 别名]
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)
示例15: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import ScrolledWindow [as 别名]
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)