Title: [commits] (heikki) [16108] Bug 11574, tip of the day dialog pops up on startup, r=bkirsch.

Diff

Modified: trunk/chandler/application/Application.py (16107 => 16108)

--- trunk/chandler/application/Application.py	2007-12-11 21:10:55 UTC (rev 16107)
+++ trunk/chandler/application/Application.py	2007-12-11 22:33:27 UTC (rev 16108)
@@ -557,6 +557,18 @@
             sharing.getAutoSyncInterval(self.UIRepositoryView) is not None):
             sharing.scheduleNow(self.UIRepositoryView)
 
+        # Show "tip of the day"
+        if Globals.options.catch not in ('tests', 'never'):
+            def showTip():
+                prefs = schema.ns("osaf.app",
+                                  self.UIRepositoryView).prefs
+                if prefs.showTip:
+                    tp = wx.CreateFileTipProvider('application/tips.txt',
+                                                  prefs.tipIndex)
+                    prefs.showTip = wx.ShowTip(self.mainFrame, tp)
+                    prefs.tipIndex = tp.GetCurrentTip()
+            wx.CallAfter(showTip)
+
         util.timing.end("wxApplication OnInit") #@@@Temporary testing tool written by Morgen -- DJA
 
         self.initialized = True

Modified: trunk/chandler/application/Utility.py (16107 => 16108)

--- trunk/chandler/application/Utility.py	2007-12-11 21:10:55 UTC (rev 16107)
+++ trunk/chandler/application/Utility.py	2007-12-11 22:33:27 UTC (rev 16108)
@@ -34,7 +34,7 @@
 # with your name (and some helpful text). The comment's really there just to
 # cause Subversion to warn you of a conflict when you update, in case someone 
 # else changes it at the same time you do (that's why it's on the same line).
-SCHEMA_VERSION = "466" # heikki: subscribe user list menu
+SCHEMA_VERSION = "467" # heikki: tip of the day
 
 logger = None # initialized in initLogging()
 

Added: trunk/chandler/application/tips.txt (16107 => 16108)

--- trunk/chandler/application/tips.txt	2007-12-11 21:10:55 UTC (rev 16107)
+++ trunk/chandler/application/tips.txt	2007-12-11 22:33:27 UTC (rev 16108)
@@ -0,0 +1,18 @@
+#   Copyright (c) 2007 Open Source Applications Foundation
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+
+# The tip of the day strings, to be shown at startup
+_("The Getting Started with Chandler is a great tutorial that helps you to learn Chandler: http://chandlerproject.org/getstarted")
+_("Do you learn best by watching someone show how it is done? Then watch some Chandler movies: http://chandlerproject.org/Projects/PreviewDemos")
+_("There is a web version of Chandler, and it is free too! Sign up here: https://hub.chandlerproject.org/")
\ No newline at end of file
Property changes on: trunk/chandler/application/tips.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/chandler/parcels/osaf/app/__init__.py (16107 => 16108)

--- trunk/chandler/parcels/osaf/app/__init__.py	2007-12-11 21:10:55 UTC (rev 16107)
+++ trunk/chandler/parcels/osaf/app/__init__.py	2007-12-11 22:33:27 UTC (rev 16108)
@@ -30,7 +30,19 @@
         doc = 'Should we backup (export collections and settings) on quit to automate migration?'
     )
 
+    showTip = schema.One(
+        schema.Boolean,
+        initialValue=True,
+        doc = 'Should we show tip of the day on launch?'
+    )
 
+    tipIndex = schema.One(
+        schema.Integer,
+        initialValue=0,
+        doc = 'Index of tip of the day to show.'
+    )
+
+
 def installParcel(parcel, oldVersion=None):
 
     import scripts as Scripts

Modified: trunk/chandler/parcels/osaf/sharing/model.py (16107 => 16108)

--- trunk/chandler/parcels/osaf/sharing/model.py	2007-12-11 21:10:55 UTC (rev 16107)
+++ trunk/chandler/parcels/osaf/sharing/model.py	2007-12-11 22:33:27 UTC (rev 16108)
@@ -556,3 +556,6 @@
     isOnline = eim.field(eim.IntType, default=1) # 1 = online, 0 = offline
 
     backupOnQuit = eim.field(eim.IntType, default=0) # 0 = None, 1 = True, 2 = False
+    
+    showTip = eim.field(eim.IntType, default=1) # 0 = False, 1 = True    
+    tipIndex = eim.field(eim.IntType, default=0)

Modified: trunk/chandler/parcels/osaf/sharing/translator.py (16107 => 16108)

--- trunk/chandler/parcels/osaf/sharing/translator.py	2007-12-11 21:10:55 UTC (rev 16107)
+++ trunk/chandler/parcels/osaf/sharing/translator.py	2007-12-11 22:33:27 UTC (rev 16108)
@@ -2848,6 +2848,9 @@
         elif backup == 2:
             prefs.backupOnQuit = False
 
+        prefs.showTip = bool(record.showTip)
+        prefs.tipIndex = record.tipIndex
+
     # Called from finishExport()
     def export_application_prefs(self):
         prefs = schema.ns("osaf.app", self.rv).prefs
@@ -2861,7 +2864,9 @@
             backup = 2
 
         yield model.ApplicationPrefsRecord(1 if prefs.isOnline else 0,
-                                           backup)
+                                           backup,
+                                           1 if prefs.showTip else 0,
+                                           prefs.tipIndex)
 
     @model.SharePrefsRecord.importer
     def import_share_prefs(self, record):

Modified: trunk/chandler/parcels/osaf/tests/TestDumpReload.py (16107 => 16108)

--- trunk/chandler/parcels/osaf/tests/TestDumpReload.py	2007-12-11 21:10:55 UTC (rev 16107)
+++ trunk/chandler/parcels/osaf/tests/TestDumpReload.py	2007-12-11 22:33:27 UTC (rev 16108)
@@ -317,6 +317,11 @@
         self.assertFalse(hasattr(backupPrefs, 'backupOnQuit'))
         backupPrefs.backupOnQuit = True
 
+        # tip of the day prefs
+        self.assertTrue(backupPrefs.showTip)
+        self.assertEqual(backupPrefs.tipIndex, 0)
+        backupPrefs.tipIndex = 1
+
         # Ensure sidebar is loaded in view1
         sidebar1 = schema.ns("osaf.app", view1).sidebarCollection
 
@@ -541,6 +546,10 @@
                                      view1).prefs
             self.assertTrue(backupPrefs1.backupOnQuit)
             
+            # tip of the day prefs
+            self.assertTrue(backupPrefs1.showTip)
+            self.assertEqual(backupPrefs1.tipIndex, 1)
+            
         finally:
             os.remove(filename)
 

Modified: trunk/chandler/tools/createPot.py (16107 => 16108)

--- trunk/chandler/tools/createPot.py	2007-12-11 21:10:55 UTC (rev 16107)
+++ trunk/chandler/tools/createPot.py	2007-12-11 22:33:27 UTC (rev 16108)
@@ -32,6 +32,7 @@
     XRC_FILES = []
     XRC_PYTHON = None
     CONFIG = ["."]
+    MISC_FILES = ["application/tips.txt"]
 
     def __init__(self):
         super(TranslationTool, self).__init__()
@@ -114,10 +115,10 @@
     def setLibraryPath(self):
         platform = self.getPlatform()
         if platform == "Mac":
-             os.environ["DYLD_LIBRARY_PATH"] = os.path.join(self.BINROOT, "lib")
+            os.environ["DYLD_LIBRARY_PATH"] = os.path.join(self.BINROOT, "lib")
 
         elif platform == "Linux":
-             os.environ["LD_LIBRARY_PATH"] = os.path.join(self.BINROOT, "lib")
+            os.environ["LD_LIBRARY_PATH"] = os.path.join(self.BINROOT, "lib")
 
 
     def setWXRC(self):
@@ -154,14 +155,14 @@
     def getText(self):
         dirs = " ".join(self.CONFIG)
 
-        files = " ".join(self.getPythonFiles())
+        files = self.getPythonFiles()
 
         if dirs != ".":
-            files = "Chandler.py setup.py %s %s" % (self.XRC_PYTHON, files)
+            files = ["Chandler.py", "setup.py", self.XRC_PYTHON] + files + \
+                    self.MISC_FILES
+        
+        exp = "%s [EMAIL PROTECTED] --from-code=utf-8 --no-wrap --add-comments=L10N: -L Python -o %s %s" % (self.GETTEXT, os.path.join(self.CWD, self.OUTPUTFILE), " ".join(files))
 
-        exp = "%s [EMAIL PROTECTED] --from-code=utf-8 --no-wrap --add-comments=L10N: -L Python -o %s %s" % (self.GETTEXT, os.path.join(self.CWD, self.OUTPUTFILE), files)
-
-
         return os.system(exp)
 
     def addHeader(self):




_______________________________________________
Commits mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/commits

Reply via email to