← Back to team overview

gtg team mailing list archive

[Merge] lp:~gtg-contributors/gtg/code-layout into lp:gtg

 

Paul Kishimoto has proposed merging lp:~gtg-contributors/gtg/code-layout into lp:gtg.

Requested reviews:
  Gtg developers (gtg)


Partially implement the code layout change described in the discussion at: https://lists.launchpad.net/gtg-contributors/msg00174.html

It does not move the plugins directory, or the CLI. Those will happen in separate merges.
-- 
https://code.launchpad.net/~gtg-contributors/gtg/code-layout/+merge/27279
Your team Gtg developers is requested to review the proposed merge of lp:~gtg-contributors/gtg/code-layout into lp:gtg.
=== modified file 'GTG/gtg.py'
--- GTG/gtg.py	2010-05-26 09:54:42 +0000
+++ GTG/gtg.py	2010-06-10 14:49:27 +0000
@@ -46,22 +46,20 @@
 
 #=== IMPORT ===================================================================
 from __future__ import with_statement
-
-import sys
+from contextlib import contextmanager
 import os
-import dbus
 import logging
 import signal
-from contextlib import contextmanager
+
+import dbus
 
 #our own imports
-from GTG                     import _
-from GTG.viewmanager.manager import Manager
-from GTG.core.datastore      import DataStore
-from GTG.core                import CoreConfig
-from GTG.tools.logger        import Log
-from GTG.tools               import gtkcrashhandler
-from GTG                     import info
+from GTG                import _, info
+from GTG.core           import CoreConfig
+from GTG.core.datastore import DataStore
+from GTG.gtk            import crashhandler
+from GTG.gtk.manager    import Manager
+from GTG.tools.logger   import Log
 
 #=== OBJECTS ==================================================================
 
@@ -87,7 +85,7 @@
             d=dbus.SessionBus().get_object(CoreConfig.BUSNAME,\
                                            CoreConfig.BUSINTERFACE)
             d.show_task_browser()
-            sys.exit(0)
+            raise SystemExit
             
     #write the pid file
     with open(pidfile, "w") as f:
@@ -106,11 +104,10 @@
     backends_list = config.get_backends_list()
 
     #initialize Apport hook for crash handling
-    gtkcrashhandler.initialize(app_name = "Getting Things GNOME!", message  =  \
-          "GTG" + info.VERSION + _(" has crashed. Please report the bug on <a "\
-          "href=\"http://bugs.edge.launchpad.net/gtg\";>our Launchpad page</a>."\
-          " If you have Apport installed, it will be started for you."),       \
-          use_apport = True)
+    crashhandler.initialize(app_name = "Getting Things GNOME!", message="GTG"
+      + info.VERSION + _(" has crashed. Please report the bug on <a href=\""
+      "http://bugs.edge.launchpad.net/gtg\";>our Launchpad page</a>. If you "
+      "have Apport installed, it will be started for you."), use_apport = True)
     
     # Load data store
     ds = DataStore()

=== added directory 'GTG/gtk'
=== renamed file 'GTG/viewmanager/__init__.py' => 'GTG/gtk/__init__.py'
--- GTG/viewmanager/__init__.py	2010-03-02 14:31:47 +0000
+++ GTG/gtk/__init__.py	2010-06-10 14:49:27 +0000
@@ -22,12 +22,13 @@
 
 There should be no horizontal communication at all between views.
 """
-
 import os
 
-from GTG import _
+from GTG     import _
+
 
 class ViewConfig:
     current_rep = os.path.dirname(os.path.abspath(__file__))
     DELETE_GLADE_FILE  = os.path.join(current_rep, "deletion.glade")
     PREFERENCES_GLADE_FILE = os.path.join(current_rep, "preferences.glade")
+

=== renamed directory 'GTG/taskbrowser' => 'GTG/gtk/browser'
=== modified file 'GTG/gtk/browser/CellRendererTags.py'
--- GTG/taskbrowser/CellRendererTags.py	2009-09-24 13:15:17 +0000
+++ GTG/gtk/browser/CellRendererTags.py	2010-06-10 14:49:27 +0000
@@ -183,3 +183,4 @@
             return (self.xpad, self.ypad, self.xpad*2, self.ypad*2)
 
 gobject.type_register(CellRendererTags)
+

=== modified file 'GTG/gtk/browser/__init__.py'
--- GTG/taskbrowser/__init__.py	2010-03-01 03:11:53 +0000
+++ GTG/gtk/browser/__init__.py	2010-06-10 14:49:27 +0000
@@ -16,8 +16,6 @@
 # You should have received a copy of the GNU General Public License along with
 # this program.  If not, see <http://www.gnu.org/licenses/>.
 # -----------------------------------------------------------------------------
-
-
 """
 The GTK frontend for browsing collections of tasks.
 
@@ -26,7 +24,7 @@
 """
 import os
 
-from GTG import _
+from GTG     import _
 
 
 class GnomeConfig:
@@ -46,3 +44,4 @@
     NEW_TASK_TOOLTIP        = _("Create a new task")
     NEW_SUBTASK_TOOLTIP     = _("Create a new subtask")
     WORKVIEW_TOGGLE_TOOLTIP = _("Display only the currently actionable tasks")
+

=== modified file 'GTG/gtk/browser/browser.py'
--- GTG/taskbrowser/browser.py	2010-06-10 13:02:31 +0000
+++ GTG/gtk/browser/browser.py	2010-06-10 14:49:27 +0000
@@ -22,38 +22,36 @@
 
 #=== IMPORT ===================================================================
 #system imports
+import locale
+import os
+import re
+import time
+import webbrowser
+
 import pygtk
 pygtk.require('2.0')
 import gobject
-import os
 import gtk
-import locale
-import re
-import time
-import webbrowser
 
 #our own imports
 import GTG
-from GTG import info
-from GTG import _
-from GTG import ngettext
-from GTG.tools.logger                 import Log
-from GTG.core.task                    import Task
-#from GTG.core.tagstore                import Tag
-from GTG.taskbrowser                  import GnomeConfig
-from GTG.taskbrowser                  import tasktree
-#from GTG.taskbrowser.preferences      import PreferencesDialog
-from GTG.taskbrowser.tasktree         import TaskTreeModel,\
-                                             ActiveTaskTreeView,\
-                                             ClosedTaskTreeView
-from GTG.taskbrowser                  import tagtree
-from GTG.taskbrowser.tagtree          import TagTree
-from GTG.tools                        import openurl
-from GTG.tools.dates                  import strtodate,\
-                                             no_date,\
-                                             FuzzyDate, \
-                                             get_canonical_date
-#from GTG.tools                        import clipboard
+from GTG                         import _, info, ngettext
+from GTG.core.task               import Task
+#from GTG.core.tagstore           import Tag
+from GTG.gtk.browser             import GnomeConfig, tasktree, tagtree
+#from GTG.taskbrowser.preferences import PreferencesDialog
+from GTG.gtk.browser.tasktree    import TaskTreeModel,\
+                                        ActiveTaskTreeView,\
+                                        ClosedTaskTreeView
+from GTG.gtk.browser.tagtree     import TagTree
+from GTG.tools                   import openurl
+from GTG.tools.dates             import strtodate,\
+                                        no_date,\
+                                        FuzzyDate, \
+                                        get_canonical_date
+from GTG.tools.logger            import Log
+#from GTG.tools                   import clipboard
+
 
 #=== MAIN CLASS ===============================================================
 
@@ -70,6 +68,7 @@
 CONTENTS_PREVIEW = True
 TIME             = 0
 
+
 class Timer:
     def __init__(self,st):
         self.st = st
@@ -77,6 +76,7 @@
     def __exit__(self, *args): 
         print "%s : %s" %(self.st,time.time() - self.start)
 
+
 class TaskBrowser:
     """ The UI for browsing open and closed tasks, and listing tags in a tree """
 

=== modified file 'GTG/gtk/browser/tagtree.py'
--- GTG/taskbrowser/tagtree.py	2010-06-07 11:26:31 +0000
+++ GTG/gtk/browser/tagtree.py	2010-06-10 14:49:27 +0000
@@ -16,17 +16,19 @@
 # You should have received a copy of the GNU General Public License along with
 # this program.  If not, see <http://www.gnu.org/licenses/>.
 # -----------------------------------------------------------------------------
+import locale
+#import time
+import xml.sax.saxutils as saxutils
+
 import gtk
 import gobject
-import xml.sax.saxutils as saxutils
-import locale
-import time
 
 from GTG                              import _
-from GTG.taskbrowser.CellRendererTags import CellRendererTags
-from GTG.taskbrowser.tasktree         import COL_OBJ as TASKTREE_COL_OBJ
+from GTG.gtk.browser.CellRendererTags import CellRendererTags
+from GTG.gtk.browser.tasktree         import COL_OBJ as TASKTREE_COL_OBJ
 from GTG.tools.logger                 import Log
-    
+
+
 COL_ID    = 0
 COL_NAME  = 1
 COL_LABEL = 2
@@ -195,7 +197,6 @@
 
 
 class TagTreeModel(gtk.GenericTreeModel):
-
     column_types = (str,\
                     str,\
                     str,\
@@ -607,3 +608,4 @@
                         task.sync()
 
         self.emit_stop_by_name('drag_data_received')
+

=== modified file 'GTG/gtk/browser/tasktree.py'
--- GTG/taskbrowser/tasktree.py	2010-06-10 12:21:49 +0000
+++ GTG/gtk/browser/tasktree.py	2010-06-10 14:49:27 +0000
@@ -16,19 +16,20 @@
 # You should have received a copy of the GNU General Public License along with
 # this program.  If not, see <http://www.gnu.org/licenses/>.
 # -----------------------------------------------------------------------------
+import xml.sax.saxutils as saxutils
 
 import gtk
 import gobject
 import pango
-import xml.sax.saxutils as saxutils
 
 from GTG                              import _
 from GTG.core.tree                    import Tree, TreeNode
-from GTG.tools                        import colors
 from GTG.core.task                    import Task
-from GTG.taskbrowser.CellRendererTags import CellRendererTags
+from GTG.gtk                          import colors
+from GTG.gtk.browser.CellRendererTags import CellRendererTags
 from GTG.tools.logger                 import Log
 
+
 COL_TID       = 0
 COL_OBJ       = 1
 COL_TITLE     = 2
@@ -41,6 +42,7 @@
 COL_SDATE     = 10
 COL_DUE       = 11
 
+
 #A task can have multiple parent (thus multiple paths)
 #We thus define an iter which is a tuple [node,path], defining one
 #and only one position in the tree
@@ -124,8 +126,8 @@
 
 
 
+
 class TaskTreeModel(gtk.GenericTreeModel):
-
     column_types = (\
         str,\
         gobject.TYPE_PYOBJECT,\

=== renamed file 'GTG/tools/colors.py' => 'GTG/gtk/colors.py'
--- GTG/tools/colors.py	2009-12-06 22:33:19 +0000
+++ GTG/gtk/colors.py	2010-06-10 14:49:27 +0000
@@ -51,3 +51,4 @@
         
         my_color = gtk.gdk.Color(red, green, blue).to_string()
     return my_color
+

=== renamed file 'GTG/tools/gtkcrashhandler.py' => 'GTG/gtk/crashhandler.py'
=== renamed file 'GTG/viewmanager/dbuswrapper.py' => 'GTG/gtk/dbuswrapper.py'
--- GTG/viewmanager/dbuswrapper.py	2010-05-24 07:38:39 +0000
+++ GTG/gtk/dbuswrapper.py	2010-06-10 14:49:27 +0000
@@ -1,11 +1,32 @@
+# -*- coding: utf-8 -*-
+# pylint: disable-msg=W0201
+# -----------------------------------------------------------------------------
+# Getting Things Gnome! - a personal organizer for the GNOME desktop
+# Copyright (c) 2008-2009 - Lionel Dricot & Bertrand Rousseau
+#
+# This program is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later
+# version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program.  If not, see <http://www.gnu.org/licenses/>.
+# -----------------------------------------------------------------------------
+import unicodedata
+
 import dbus
 import dbus.glib
 import dbus.service
-import unicodedata
 
-from GTG.core import CoreConfig
+from GTG.core  import CoreConfig
 from GTG.tools import dates
 
+
 BUSNAME = CoreConfig.BUSNAME
 BUSFACE = CoreConfig.BUSINTERFACE
 

=== renamed file 'GTG/viewmanager/delete_dialog.py' => 'GTG/gtk/delete_dialog.py'
--- GTG/viewmanager/delete_dialog.py	2010-06-07 18:44:12 +0000
+++ GTG/gtk/delete_dialog.py	2010-06-10 14:49:27 +0000
@@ -17,11 +17,11 @@
 # You should have received a copy of the GNU General Public License along with
 # this program.  If not, see <http://www.gnu.org/licenses/>.
 # -----------------------------------------------------------------------------
-
 import gtk
 
-from GTG import _
-from GTG.viewmanager import ViewConfig
+from GTG     import _
+from GTG.gtk import ViewConfig
+
 
 class DeletionUI():
     def __init__(self,req):
@@ -34,7 +34,6 @@
                     "on_delete_cancel": lambda x: x.hide,}
         self.builder.connect_signals(signals)
 
-
     def on_delete_confirm(self, widget):
         """if we pass a tid as a parameter, we delete directly
         otherwise, we will look which tid is selected"""

=== renamed file 'GTG/viewmanager/deletion.glade' => 'GTG/gtk/deletion.glade'
=== renamed directory 'GTG/taskeditor' => 'GTG/gtk/editor'
=== modified file 'GTG/gtk/editor/__init__.py'
--- GTG/taskeditor/__init__.py	2010-03-01 01:56:43 +0000
+++ GTG/gtk/editor/__init__.py	2010-06-10 14:49:27 +0000
@@ -19,10 +19,10 @@
 """
 The task editing GUI
 """
-
 import os
 
-from GTG import _
+from GTG    import _
+
 
 class GnomeConfig:
     current_rep = os.path.dirname(os.path.abspath(__file__))

=== modified file 'GTG/gtk/editor/editor.py'
--- GTG/taskeditor/editor.py	2010-04-26 20:34:14 +0000
+++ GTG/gtk/editor/editor.py	2010-06-10 14:49:27 +0000
@@ -16,39 +16,42 @@
 # You should have received a copy of the GNU General Public License along with
 # this program.  If not, see <http://www.gnu.org/licenses/>.
 # -----------------------------------------------------------------------------
+"""
+This is the TaskEditor
 
-#This is the TaskEditor
-#
-#It's the window you see when you double-click on a Task
-#The main text widget is a home-made TextView called TaskView (see taskview.py)
-#The rest is the logic of the widget : date changing widgets, buttons, ...
-import sys
+It's the window you see when you double-click on a Task
+The main text widget is a home-made TextView called TaskView (see taskview.py)
+The rest is the logic of the widget : date changing widgets, buttons, ...
+"""
 import time
 
-from GTG import _
-from GTG import ngettext
-from GTG import PLUGIN_DIR
-from GTG import DATA_DIR
-from GTG.taskeditor          import GnomeConfig
-from GTG.tools               import dates
-from GTG.taskeditor.taskview import TaskView
-from GTG.core.plugins.engine import PluginEngine
-from GTG.core.plugins.api    import PluginAPI
-from GTG.core.task           import Task
 try:
     import pygtk
     pygtk.require("2.0")
 except: # pylint: disable-msg=W0702
-    sys.exit(1)
+    raise SystemExit(1)
 try:
     import gtk
     from gtk import gdk
 except: # pylint: disable-msg=W0702
-    sys.exit(1)
-    
+    raise SystemExit(1)
+
+from GTG                     import _
+from GTG                     import ngettext
+from GTG                     import PLUGIN_DIR
+from GTG                     import DATA_DIR
+from GTG.gtk.editor          import GnomeConfig
+from GTG.gtk.editor.taskview import TaskView
+from GTG.core.plugins.engine import PluginEngine
+from GTG.core.plugins.api    import PluginAPI
+from GTG.core.task           import Task
+from GTG.tools               import dates
+
+
 date_separator = "-"
 
-class TaskEditor :
+
+class TaskEditor:
     #req is the requester
     #vmanager is the view manager
     #taskconfig is a ConfigObj dic to save infos about tasks
@@ -652,5 +655,3 @@
             self.cal_widget.disconnect(self.sigid_month)
             self.sigid_month = None
 
-    
-

=== modified file 'GTG/gtk/editor/taskview.py'
--- GTG/taskeditor/taskview.py	2010-04-27 03:19:16 +0000
+++ GTG/gtk/editor/taskview.py	2010-06-10 14:49:27 +0000
@@ -35,16 +35,19 @@
 import gobject
 import pango
 
-from GTG.taskeditor import taskviewserial
-from GTG.tools import openurl
+from GTG.gtk.editor import taskviewserial
+from GTG.tools      import openurl
+
 
 separators = [' ', '.', ',', '/', '\n', '\t', '!', '?', ';', '\0']
 url_separators = [' ', ',', '\n', '\t', '\0']
 
+
 bullet1_ltr = '→'
 bullet1_rtl = '←'
 bullet2 = '↳'
 
+
 class TaskView(gtk.TextView):
     __gtype_name__ = 'HyperTextView'
     __gsignals__ = {'anchor-clicked': (gobject.SIGNAL_RUN_LAST, \
@@ -1299,5 +1302,6 @@
         for key, val in prop.iteritems():
             tag.set_property(key, val)
 
+
 gobject.type_register(TaskView)
 

=== renamed file 'GTG/viewmanager/manager.py' => 'GTG/gtk/manager.py'
--- GTG/viewmanager/manager.py	2010-06-01 08:36:46 +0000
+++ GTG/gtk/manager.py	2010-06-10 14:49:27 +0000
@@ -17,29 +17,31 @@
 # You should have received a copy of the GNU General Public License along with
 # this program.  If not, see <http://www.gnu.org/licenses/>.
 # -----------------------------------------------------------------------------
-
-
 """
 Manager loads the prefs and launches the gtk main loop
 """
+try:
+    import pygtk
+    pygtk.require('2.0')
+except: # pylint: disable-msg=W0702
+    raise SystemExit(1)
+
 import gtk
 import gobject
 
 import GTG
-from GTG.viewmanager.delete_dialog import DeletionUI
-from GTG.taskbrowser.browser import TaskBrowser
-from GTG.taskeditor.editor            import TaskEditor
-from GTG.viewmanager.preferences      import PreferencesDialog
-from GTG.viewmanager.dbuswrapper import DBusTaskWrapper
-from GTG.tools                        import clipboard
-from GTG.core.plugins.engine          import PluginEngine
-from GTG.core.plugins.api             import PluginAPI
-from GTG.tools.logger                 import Log
-
-class Manager():
-
+from GTG.gtk.delete_dialog   import DeletionUI
+from GTG.gtk.browser.browser import TaskBrowser
+from GTG.gtk.editor.editor   import TaskEditor
+from GTG.gtk.preferences     import PreferencesDialog
+from GTG.gtk.dbuswrapper     import DBusTaskWrapper
+from GTG.tools               import clipboard
+from GTG.core.plugins.engine import PluginEngine
+from GTG.core.plugins.api    import PluginAPI
+from GTG.tools.logger        import Log
+
+class Manager:
     ############## init #####################################################
-
     def __init__(self, req, config):
         self.config_obj = config
         self.config = config.conf_dict
@@ -227,4 +229,3 @@
         # plugins are deactivated
         self.pengine.deactivate_plugins(self.p_apis)
 
-

=== renamed file 'GTG/viewmanager/preferences.glade' => 'GTG/gtk/preferences.glade'
=== renamed file 'GTG/viewmanager/preferences.py' => 'GTG/gtk/preferences.py'
--- GTG/viewmanager/preferences.py	2010-06-01 08:36:46 +0000
+++ GTG/gtk/preferences.py	2010-06-10 14:49:27 +0000
@@ -17,15 +17,15 @@
 # this program.  If not, see <http://www.gnu.org/licenses/>.
 # -----------------------------------------------------------------------------
 """ The Preferences Dialog for loading plugins and configuring GTG """
-
 import os
+import shutil
+
 import gtk
 import pango
-import shutil
 from xdg.BaseDirectory import xdg_config_home
 
 from GTG.core.plugins import GnomeConfig
-from GTG.viewmanager import ViewConfig
+from GTG.gtk          import ViewConfig
 
 
 __all__ = [

=== removed directory 'GTG/viewmanager'
=== modified file 'gtg'
--- gtg	2010-03-02 01:37:05 +0000
+++ gtg	2010-06-10 14:49:27 +0000
@@ -28,15 +28,16 @@
 """
 
 import sys
-
 from optparse import OptionParser
 
+
 def X_is_running():
     from subprocess import Popen, PIPE
     p = Popen(["xset", "-q"], stdout=PIPE, stderr=PIPE)
     p.communicate()
     return p.returncode == 0
 
+
 try:
     parser = OptionParser()
     parser.add_option('-d', '--debug', action='store_true', dest='debug',

=== modified file 'setup.py'
--- setup.py	2010-04-30 16:20:32 +0000
+++ setup.py	2010-06-10 14:49:27 +0000
@@ -121,9 +121,9 @@
     'GTG.backends',
     'GTG.core',
     'GTG.core.plugins',
-    'GTG.taskbrowser',
-    'GTG.viewmanager',
-    'GTG.taskeditor',
+    'GTG.gtk',
+    'GTG.gtk.editor',
+    'GTG.gtk.browser',
     'GTG.tools',
     'GTG.plugins',
     'GTG.plugins.bugzilla',
@@ -140,10 +140,10 @@
     'GTG.plugins.import_json',
     ],
   package_data = {
-    'GTG.taskbrowser': ['taskbrowser.glade'],
-    'GTG.taskeditor': ['taskeditor.glade'],
-    'GTG.viewmanager': ['preferences.glade', 'deletion.glade'],
     'GTG.core.plugins': ['pluginmanager.glade'],
+    'GTG.gtk': ['preferences.glade', 'deletion.glade'],
+    'GTG.gtk.browser': ['taskbrowser.glade'],
+    'GTG.gtk.editor': ['taskeditor.glade'],
     'GTG.plugins': [
         'bugzilla.gtg-plugin',
         'export.gtg-plugin',


Follow ups