本文整理汇总了Python中gi.repository.Gio.Settings.get_int方法的典型用法代码示例。如果您正苦于以下问题:Python Settings.get_int方法的具体用法?Python Settings.get_int怎么用?Python Settings.get_int使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Gio.Settings
的用法示例。
在下文中一共展示了Settings.get_int方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from gi.repository.Gio import Settings [as 别名]
# 或者: from gi.repository.Gio.Settings import get_int [as 别名]
def __init__(self, view_name):
'''
Initialize a new plugin view window.
@param view_name: The name of the view.
@type view_name: string
'''
gtk.Window.__init__(self)
self.plugin_view = PluginView(view_name)
self.add(self.plugin_view)
gspath = NEWPLUGVIEWS_PATH + view_name.lower().replace(' ', '-') + '/'
gsettings = GSettings(schema=NEWPLUGVIEWS_GSCHEMA, path=gspath)
width = gsettings.get_int('width')
height = gsettings.get_int('height')
self.set_default_size(width, height)
self.connect('key_press_event', self._onKeyPress)
self.plugin_view.connect_after('page_removed', self._onPluginRemoved)
self.set_title(view_name)
self.set_position(gtk.WindowPosition.MOUSE)
self.show_all()
self.connect('size-allocate', self._onResize)
示例2: AccerciserMainWindow
# 需要导入模块: from gi.repository.Gio import Settings [as 别名]
# 或者: from gi.repository.Gio.Settings import get_int [as 别名]
class AccerciserMainWindow(gtk.Window):
'''
Main window class.
@ivar statusbar: Main window's status bar.
@type statusbar: gtk.Statusbar
@ivar treeview: Main accessible tree view.
@type treeview: L{AccessibleTreeView}
@ivar pluginview1: Top plugin area.
@type pluginview1: L{PluginView}
@ivar pluginview2: Bottom plugin area
@type pluginview2: L{PluginView}
@ivar main_actions: Main action group.
@type main_actions: gtk.ActionGroup
@ivar _vpaned: Vertical paned.
@type _vpaned: gtk.VPaned
@ivar _hpaned: Horizontal paned.
@type _hpaned: gtk.HPaned
'''
def __init__(self, node):
'''
Initialize the window.
@param node: Main application's node.
@type node: L{Node}
'''
gtk.Window.__init__(self)
self.set_icon_name('accerciser')
self.set_title(_('Accerciser Accessibility Explorer'))
self.connect('key-press-event', self._onKeyPress)
node.connect('blink-done', self._onBlinkDone)
self.gsettings = GSettings(schema=GSCHEMA)
width = self.gsettings.get_int('window-width') or 640
height = self.gsettings.get_int('window-height') or 640
self.set_default_size(width, height)
self.add_accel_group(ui_manager.uimanager.get_accel_group())
# Populate window
self._populateUI(node)
selection = self.treeview.get_selection()
selection.connect('changed', self._onSelectionChanged)
def _populateUI(self, node):
'''
Populate the top level window widget.
@param node: Main application's node.
@type node: L{Node}
'''
main_vbox = gtk.VBox()
menu_bar = ui_manager.uimanager.get_widget(ui_manager.MAIN_MENU_PATH)
main_vbox.pack_start(menu_bar, False, True, 0)
self._vpaned = gtk.VPaned()
self._vpaned.set_position(350)
self._vpaned.set_name('vpaned')
main_vbox.pack_start(self._vpaned, True, True, 0)
self.statusbar = gtk.Statusbar()
main_vbox.pack_start(self.statusbar, False, True, 0)
self._hpaned = gtk.HPaned()
self._hpaned.set_position(250)
self._hpaned.set_name('hpaned')
self._vpaned.add1(self._hpaned)
self.pluginview1 = PluginView(N_('Top panel'))
self.pluginview2 = PluginView(N_('Bottom panel'))
self.pluginview2.connect('page_added',
self._onBottomPanelChange, 'added')
self.pluginview2.connect('page_removed',
self._onBottomPanelChange, 'removed')
self.pluginview2.connect_after('realize', self._onBottomPanelRealize)
self._vpaned.add2(self.pluginview2)
self._hpaned.add2(self.pluginview1)
sw = gtk.ScrolledWindow()
sw.set_policy(gtk.PolicyType.AUTOMATIC, gtk.PolicyType.AUTOMATIC)
sw.set_shadow_type(gtk.ShadowType.IN)
self.treeview = AccessibleTreeView(node)
ui_manager.uimanager.insert_action_group(self.treeview.action_group, 0)
for action in self.treeview.action_group.list_actions():
merge_id = ui_manager.uimanager.new_merge_id()
action_name = action.get_name()
ui_manager.uimanager.add_ui(merge_id, ui_manager.TREE_ACTIONS_PATH,
action_name, action_name,
gtk.UIManagerItemType.MENUITEM, False)
merge_id = ui_manager.uimanager.new_merge_id()
action_name = self.treeview.refresh_current_action.get_name()
ui_manager.uimanager.add_ui(merge_id, ui_manager.POPUP_MENU_PATH,
action_name, action_name,
gtk.UIManagerItemType.MENUITEM, False)
sw.add(self.treeview)
self._hpaned.add1(sw)
for paned in (self._vpaned, self._hpaned):
if not self.gsettings.get_int(paned.get_name()): continue
paned_position = self.gsettings.get_int(paned.get_name())
paned.set_position(paned_position)
setattr(paned, 'last_position', paned.get_position())
self.add(main_vbox)
#.........这里部分代码省略.........