[pitivi] tabsmanager: Add initial code for creating/saving default settings for each tab
- From: Jean-FranÃois Fortin Tam <jfft src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] tabsmanager: Add initial code for creating/saving default settings for each tab
- Date: Thu, 8 Nov 2012 21:57:29 +0000 (UTC)
commit 3a8f91082508aef3696951b6e8d7c5c633f18d40
Author: Jean-FranÃois Fortin Tam <nekohayo gmail com>
Date: Tue Nov 6 11:54:17 2012 -0500
tabsmanager: Add initial code for creating/saving default settings for each tab
pitivi/tabsmanager.py | 34 ++++++++++++++++++++++++++++++++++
1 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/pitivi/tabsmanager.py b/pitivi/tabsmanager.py
index d3e119f..99ba229 100644
--- a/pitivi/tabsmanager.py
+++ b/pitivi/tabsmanager.py
@@ -22,6 +22,7 @@
from gi.repository import Gtk
from gi.repository import Gdk
from pitivi.utils.ui import SPACING
+from pitivi.settings import GlobalSettings
class BaseTabs(Gtk.Notebook):
@@ -39,6 +40,12 @@ class BaseTabs(Gtk.Notebook):
child.show()
label.show()
+ try:
+ docked = getattr(self.settings, child_name + "Docked")
+ except AttributeError:
+ # Create the default config ONLY if keys don't already exist
+ self._createDefaultConfig(child_name)
+
def _set_child_properties(self, child, label):
self.child_set_property(child, "detachable", True)
self.child_set_property(child, "tab-expand", False)
@@ -68,3 +75,30 @@ class BaseTabs(Gtk.Notebook):
window.show_all()
window.move(x, y)
return notebook
+
+ def _createDefaultConfig(self, child_name):
+ """
+ If they do not exist already, create default settings
+ to save the state of a detachable widget.
+ """
+ GlobalSettings.addConfigSection("tabs - " + child_name)
+ GlobalSettings.addConfigOption(child_name + "Docked",
+ section="tabs - " + child_name,
+ key="docked",
+ default=True)
+ GlobalSettings.addConfigOption(child_name + "Width",
+ section="tabs - " + child_name,
+ key="width",
+ default=320)
+ GlobalSettings.addConfigOption(child_name + "Height",
+ section="tabs - " + child_name,
+ key="height",
+ default=400)
+ GlobalSettings.addConfigOption(child_name + "X",
+ section="tabs - " + child_name,
+ key="x-pos",
+ default=0)
+ GlobalSettings.addConfigOption(child_name + "Y",
+ section="tabs - " + child_name,
+ key="y-pos",
+ default=0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]