本文整理汇总了Python中gi.repository.Gio.Settings.set_int方法的典型用法代码示例。如果您正苦于以下问题:Python Settings.set_int方法的具体用法?Python Settings.set_int怎么用?Python Settings.set_int使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Gio.Settings
的用法示例。
在下文中一共展示了Settings.set_int方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _onResize
# 需要导入模块: from gi.repository.Gio import Settings [as 别名]
# 或者: from gi.repository.Gio.Settings import set_int [as 别名]
def _onResize(self, widget, allocation):
'''
Callback for window resizing. Used for persisting view sizes across
sessions.
@param widget: Window widget.
@type widget: gtk.Widget
@param allocation: The new allocation.
@type allocation: gtk.gdk.Rectangle
'''
view_name = self.plugin_view.view_name
gspath = NEWPLUGVIEWS_PATH + view_name.lower().replace(' ', '-') + '/'
gsettings = GSettings(schema=NEWPLUGVIEWS_GSCHEMA, path=gspath)
gsettings.set_int('width', self.get_allocated_width())
gsettings.set_int('height', self.get_allocated_height())
示例2: AccerciserMainWindow
# 需要导入模块: from gi.repository.Gio import Settings [as 别名]
# 或者: from gi.repository.Gio.Settings import set_int [as 别名]
#.........这里部分代码省略.........
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)
def _onBottomPanelChange(self, pluginview, page, page_num, action):
'''
Callback for changes to the bottom L{PluginView}'s children. If there are no
tabs, shrink the paned.
@param pluginview: The L{PluginView} that emitted the signal.
@type pluginview: L{PluginView}
@param page: The child widget affected.
@type page: L{gtk.Widget}
@param page_num: the new page number for page.
@type page_num: integer
@param action: The type of event that accured, either "removed" or "added"
@type action: string
'''
if pluginview.get_n_pages() == 1 and action == 'added':
last_pos = getattr(self._vpaned, 'last_position')
self._vpaned.set_position(last_pos or 350)
elif pluginview.get_n_pages() == 0:
setattr(self._vpaned, 'last_position', self._vpaned.get_position())
self._vpaned.set_position(self._vpaned.get_allocated_height() - 30)
def _onBottomPanelRealize(self, pluginview):
if pluginview.get_n_pages() == 0:
self._vpaned.set_position(self._vpaned.get_allocated_height() - 30)
def _onKeyPress(self, widget, event):
'''
Callback for a keypress event in the main window.
Used for navigating plugin tabs (<alt>+num).
@param widget: The widget that emitted the event.
@type widget: L{gtk.Widget}
@param event: The event that accured.
@type event: L{gtk.gdk.Event}
'''
if event.state & gdk.ModifierType.MOD1_MASK and \
event.keyval in range(gdk.keyval_from_name('0'),
gdk.keyval_from_name('9')):
tab_num = event.keyval - gdk.keyval_from_name('0') or 10
pages_count1 = self.pluginview1.getNVisiblePages()
pages_count2 = self.pluginview2.getNVisiblePages()
if pages_count1 + pages_count2 < tab_num:
return
elif pages_count1 >= tab_num:
self.pluginview1.focusTab(tab_num - 1)
else:
self.pluginview2.focusTab(tab_num - pages_count1 - 1)
def saveState(self):
'''
Save the dimensions of the main window, and the position of the panes.
'''
self.gsettings.set_int('window-width', self.get_allocated_width())
self.gsettings.set_int('window-height', self.get_allocated_height())
self.gsettings.set_int('hpaned', self._hpaned.get_position())
if self.pluginview2.get_n_pages():
position = self._vpaned.get_position()
else:
position = getattr(self._vpaned, 'last_position')
if position is not None:
self.gsettings.set_int('vpaned', position)
def _onBlinkDone(self, node):
'''
Redraw main window after node stops blinking widget. Gets rid of artifacts.
@param node:
@type node:
'''
self.queue_draw()
def _onSelectionChanged(self, selection):
'''
Callback for selection "changed" of the main treeview selection.
Updates the status bar with the path to the selected accessible.
@param selection: The main tree view's selection object.
@type node: gtk.TreeSelection
'''
model, iter = selection.get_selected()
context_id = self.statusbar.get_context_id('lineage')
if not iter:
return
tree_path = model.get_path(iter)
path_tuple = tuple(tree_path.get_indices())
path = list(map(str, path_tuple))
self.statusbar.pop(context_id)
if len(path) > 1:
self.statusbar.push(context_id, 'Path: '+' '.join(path[1:]))