gtg team mailing list archive
-
gtg team
-
Mailing list archive
-
Message #03560
[Merge] lp:~nimit-svnit/gtg/cleanup into lp:gtg
Nimit Shah has proposed merging lp:~nimit-svnit/gtg/cleanup into lp:gtg.
Requested reviews:
Gtg developers (gtg)
For more details, see:
https://code.launchpad.net/~nimit-svnit/gtg/cleanup/+merge/111709
Following files have been made to comply with lint and pep8 standards
setup.py
GTG/gtk/colors.py
GTG/gtk/browser/simple_color_selector.py
GTG/gtk/browser/cellRendereTags.py
GTG/gtk/browser/custominfobar.py
GTG/gtk/browser/treeview_factory.py
GTG/gtk/browser/tag_context_menu.py
gtg
init.py
GTG/gtk/editor/editor.py
GTG/gtk/editor/taskview.py
GTG/gtk/editor/taskviewserial.py
GTG/gtk/editor/init.py
GTG/gtk/backends_dialog/parameters_ui/pathui.py
GTG/gtk/backends_dialog/parameters_ui/textui.py
GTG/gtk/backends_dialog/parameters_ui/__init__.py
GTG/gtk/backends_dialog/parameters_ui/checkboxui.py
GTG/gtk/backends_dialog/parameters_ui/periodui.py
GTG/gtk/backends_dialog/parameters_ui/passwordui.py
GTG/gtk/manager.py
GTG/gtk/crashhandler.py
GTG/__init__.py
GTG/tools/twokeydict.py
GTG/tools/clipboard.py
GTG/gtk/backends_dialog/backendscombo.py
GTG/gtk/backends_dialog/backendstree.py
GTG/gtk/backends_dialog/configurepanel.py
GTG/gtk/backends_dialog/__init__.py
GTG/gtk/backends_dialog/addpanel.py
GTG/tools/cleanxml.py
GTG/tools/keyring.py
GTG/tools/logger.py
GTG/tools/urlregex.py
GTG/tools/watchdog.py
--
https://code.launchpad.net/~nimit-svnit/gtg/cleanup/+merge/111709
Your team Gtg developers is requested to review the proposed merge of lp:~nimit-svnit/gtg/cleanup into lp:gtg.
=== modified file 'CHANGELOG'
--- CHANGELOG 2012-06-09 12:25:03 +0000
+++ CHANGELOG 2012-06-23 11:09:19 +0000
@@ -26,6 +26,7 @@
* Improved Export plugin, export to PDF works now, by Izidor Matušov
* Added -t option to distinguish between multiple instances of GTG
* Fix for bug #826916 by Nimit Shah
+ * making setup.py colors.py simple_color_selector.py cellRendererTags.py custominfobar.py treeview_factor.py tag_context_menu.py gtg pass lint by Nimit Shah
2012-02-13 Getting Things GNOME! 0.2.9
* Big refractorization of code, now using liblarch
=== modified file 'GTG/__init__.py'
--- GTG/__init__.py 2012-03-22 12:24:50 +0000
+++ GTG/__init__.py 2012-06-23 11:09:19 +0000
@@ -72,7 +72,8 @@
if os.path.isdir(user_plugins):
PLUGIN_DIR.append(user_plugins)
-# FIXME Register GTG URI (temporary, it should be created by a schema upon installing)
+# FIXME Register GTG URI (temporary, it should be created by a schema
+# upon installing)
# FIXME Uncomment it or even better - install it properly - it breaks build
"""
try:
=== modified file 'GTG/gtk/backends_dialog/__init__.py'
--- GTG/gtk/backends_dialog/__init__.py 2012-06-07 15:25:05 +0000
+++ GTG/gtk/backends_dialog/__init__.py 2012-06-23 11:09:19 +0000
@@ -42,7 +42,8 @@
class BackendsDialog(object):
'''
- BackendsDialog manages a window that lets you manage and configure synchronization service.
+ BackendsDialog manages a window that lets you manage and
+ configure synchronization service.
It can display two "views", or "panels":
- the backend configuration view
- the backend adding view
@@ -55,7 +56,7 @@
'''
self.req = req
self._configure_icon_theme()
- builder = gtk.Builder()
+ builder = gtk.Builder()
self._load_widgets_from_glade(builder)
self.dialog.set_title(_("Synchronization Services - %s" % info.NAME))
self._create_widgets_for_add_panel()
@@ -66,7 +67,6 @@
########################################
### INTERFACE WITH THE VIEWMANAGER #####
########################################
-
def activate(self):
'''Shows this window, refreshing the current view'''
self.dialog.show_all()
@@ -77,7 +77,7 @@
def on_close(self, widget, data = None):
'''
Hides this window, saving the backends configuration.
-
+
@param widget: not used, here only for using this as signal callback
@param data: same as widget, disregard the content
'''
@@ -88,7 +88,6 @@
########################################
### HELPER FUNCTIONS ###################
########################################
-
def get_requester(self):
'''
Helper function: returns the requester.
@@ -109,20 +108,20 @@
@returns gtk.gdk.Pixbuf: a pixbuf containing the wanted icon, or None
(if the icon is not present)
'''
- #NOTE: loading icons directly from the theme and scaling them results in
- # blurry icons. So, instead of doing that, I'm loading them
- # directly from file.
+ #NOTE: loading icons directly from the theme and scaling them results
+ # in blurry icons. So, instead of doing that, I'm loading them
+ # directly from file.
icon_info = self.icon_theme.lookup_icon(name, gtk.ICON_SIZE_MENU, 0)
if icon_info == None:
return None
- pixbuf = gtk.gdk.pixbuf_new_from_file(icon_info.get_filename())
+ pixbuf = gtk.gdk.pixbuf_new_from_file(icon_info.get_filename())
return pixbuf.scale_simple(width, height, gtk.gdk.INTERP_BILINEAR)
def _show_panel(self, panel_name):
'''
Helper function to switch between panels.
- @param panel_name: the name of the wanted panel. Choose between
+ @param panel_name: the name of the wanted panel. Choose between
"configuration" or "add"
'''
if panel_name == "configuration":
@@ -157,7 +156,6 @@
########################################
### WIDGETS AND SIGNALS ################
########################################
-
def _load_widgets_from_glade(self, builder):
'''
Loads widgets from the glade file
@@ -166,11 +164,11 @@
'''
builder.add_from_file(ViewConfig.BACKENDS_GLADE_FILE)
widgets = {
- 'dialog' : 'backends_dialog',
- 'treeview_window' : 'treeview_window',
- 'central_pane' : 'central_pane',
- 'add_button' : 'add_button',
- 'remove_button' : 'remove_button',
+ 'dialog': 'backends_dialog',
+ 'treeview_window': 'treeview_window',
+ 'central_pane': 'central_pane',
+ 'add_button': 'add_button',
+ 'remove_button': 'remove_button',
}
for attr, widget in widgets.iteritems():
setattr(self, attr, builder.get_object(widget))
@@ -200,7 +198,7 @@
def _create_widgets_for_backends_tree(self):
'''
- Creates the widgets for the lateral treeview displaying the
+ Creates the widgets for the lateral treeview displaying the
backends the user has added
'''
self.backends_tv = BackendsTree(self)
@@ -217,7 +215,6 @@
########################################
### EVENT HANDLING #####################
########################################
-
def on_backend_selected(self, backend_id):
'''
When a backend in the treeview gets selected, show
@@ -269,7 +266,7 @@
def on_remove_button(self, widget = None, data = None):
'''
- When the remove button is pressed, a confirmation dialog is shown,
+ When the remove button is pressed, a confirmation dialog is shown,
and if the answer is positive, the backend is deleted.
'''
backend_id = self.backends_tv.get_selected_backend_id()
@@ -283,9 +280,10 @@
type = gtk.MESSAGE_QUESTION,
buttons = gtk.BUTTONS_YES_NO,
message_format = \
- _("Do you really want to remove the '%s' synchronization service?") % \
+ _("Do you really want to remove the '%s' \
+ synchronization service?") % \
backend.get_human_name())
- response = dialog.run()
+ response = dialog.run()
dialog.destroy()
if response == gtk.RESPONSE_YES:
#delete the backend and remove it from the lateral treeview
=== modified file 'GTG/gtk/backends_dialog/addpanel.py'
--- GTG/gtk/backends_dialog/addpanel.py 2012-04-02 15:39:34 +0000
+++ GTG/gtk/backends_dialog/addpanel.py 2012-06-23 11:09:19 +0000
@@ -28,14 +28,11 @@
# leaving this here in case we change that decision (invernizzi).
#from GTG.tools.moduletopackage import ModuleToPackage
-
-
class AddPanel(gtk.VBox):
- '''
+ '''
A VBox filled with gtk widgets to let the user choose a new backend.
'''
-
def __init__(self, backends_dialog):
'''
Constructor, just initializes the gtk widgets
@@ -117,7 +114,7 @@
def _fill_bottom_hbox(self, hbox):
'''
- Helper function to fill and hbox with a buttonbox, featuring
+ Helper function to fill and hbox with a buttonbox, featuring
and ok and cancel buttons.
@param hbox: the gtk.HBox to fill
@@ -213,4 +210,3 @@
# text += reduce(lambda a, b: a + "\n - " + b, missing_modules)
# self.label_modules.set_markup(text)
# self.ok_button.set_sensitive(missing_modules == [])
-
=== modified file 'GTG/gtk/backends_dialog/backendscombo.py'
--- GTG/gtk/backends_dialog/backendscombo.py 2012-03-05 15:23:05 +0000
+++ GTG/gtk/backends_dialog/backendscombo.py 2012-06-23 11:09:19 +0000
@@ -22,18 +22,17 @@
from GTG.backends import BackendFactory
-
class BackendsCombo(gtk.ComboBoxEntry):
'''
A combobox listing all the available backends types
'''
-
+
COLUMN_NAME = 0 #unique name for the backend type. It's never
# displayed, it's used to find which backend has
# been selected
COLUMN_HUMAN_NAME = 1 #human friendly name (which is localized).
- COLUMN_ICON = 2
+ COLUMN_ICON = 2
def __init__(self, backends_dialog):
'''
=== modified file 'GTG/gtk/backends_dialog/backendstree.py'
--- GTG/gtk/backends_dialog/backendstree.py 2012-05-01 11:04:39 +0000
+++ GTG/gtk/backends_dialog/backendstree.py 2012-06-23 11:09:19 +0000
@@ -24,7 +24,6 @@
from GTG.backends.backendsignals import BackendSignals
-
class BackendsTree(gtk.TreeView):
'''
gtk.TreeView that shows the currently loaded backends.
@@ -43,7 +42,7 @@
@param backends_dialog: a reference to the dialog in which this is
loaded
'''
- super(BackendsTree,self).__init__()
+ super(BackendsTree, self).__init__()
self.dialog = backendsdialog
self.req = backendsdialog.get_requester()
self._init_liststore()
@@ -60,7 +59,8 @@
# 1, put default backend on top
# 2, sort backends by human name
backends = list(self.req.get_all_backends(disabled = True))
- backends = sorted(backends, key=lambda backend:(not backend.is_default(), backend.get_human_name()))
+ backends = sorted(backends, key=lambda backend: (
+ not backend.is_default(), backend.get_human_name()))
for backend in backends:
self.add_backend(backend)
@@ -101,7 +101,6 @@
])
self.backendid_to_iter[backend.get_id()] = backend_iter
-
def on_backend_state_changed(self, sender, backend_id):
'''
Signal callback executed when a backend is enabled/disabled.
@@ -129,8 +128,8 @@
self.liststore[b_path][self.COLUMN_TAGS] = new_tags
def _get_markup_for_tags(self, tag_names):
- '''Given a list of tags names, generates the pango markup to render that
- list with the tag colors used in GTG
+ '''Given a list of tags names, generates the pango markup to render
+ that list with the tag colors used in GTG
@param tag_names: the list of the tags (strings)
@return str: the pango markup string
@@ -141,7 +140,6 @@
tags_txt = get_colored_tags_markup(self.req, tag_names)
return "<small>" + tags_txt + "</small>"
-
def remove_backend(self, backend_id):
''' Removes a backend from the treeview, and selects the first (to show
something in the configuration panel
@@ -220,8 +218,8 @@
'''
Helper function to get the selected path
- @return gtk.TreePath : returns exactly one path for the selected object or
- None
+ @return gtk.TreePath : returns exactly one path for the selected
+ object or None
'''
selection = self.get_selection()
if selection:
=== modified file 'GTG/gtk/backends_dialog/configurepanel.py'
--- GTG/gtk/backends_dialog/configurepanel.py 2012-04-02 18:06:56 +0000
+++ GTG/gtk/backends_dialog/configurepanel.py 2012-06-23 11:09:19 +0000
@@ -27,11 +27,10 @@
class ConfigurePanel(gtk.VBox):
- '''
+ '''
A VBox that lets you configure a backend
'''
-
def __init__(self, backends_dialog):
'''
Constructor, creating all the gtk widgets
@@ -56,7 +55,7 @@
self.refresh_sync_status)
_signals.connect(_signals.BACKEND_SYNC_STARTED, self.on_sync_started)
_signals.connect(_signals.BACKEND_SYNC_ENDED, self.on_sync_ended)
-
+
def _create_widgets(self):
'''
This function fills this Vbox with widgets
@@ -77,7 +76,7 @@
def _fill_top_hbox(self, hbox):
'''
- Helper function to fill an hbox with an image, a spinner and
+ Helper function to fill an hbox with an image, a spinner and
three labels
@param hbox: the gtk.HBox to fill
@@ -126,7 +125,7 @@
def set_backend(self, backend_id):
'''Changes the backend to configure, refreshing this view.
-
+
@param backend_id: the id of the backend to configure
'''
self.backend = self.dialog.get_requester().get_backend(backend_id)
@@ -147,7 +146,7 @@
markup = "<big><big><big><b>%s</b></big></big></big>" % \
self.backend.get_human_name()
self.human_name_label.set_markup(markup)
-
+
def refresh_number_of_tasks(self):
'''refreshes the number of synced tasks by this backend'''
#FIXME: disabled for now. I'm not sure that this is nice because the
@@ -170,7 +169,7 @@
else:
markup = ngettext("Syncing a task tagged %s" % tags_txt, \
"Syncing %d tasks tagged %s" % (tasks_number, tags_txt), \
- tasks_number)
+ tasks_number)
self.sync_desc_label.set_markup(markup)
def refresh_sync_button(self):
@@ -207,7 +206,7 @@
self.refresh_number_of_tasks()
self.refresh_sync_button()
self.refresh_sync_status_label()
-
+
def on_sync_button_clicked(self, sender):
'''
Signal callback when a backend is enabled/disabled via the UI button
@@ -256,7 +255,7 @@
'''
Enables/disables the gtk.Spinner, while showing/hiding it at the same
time
-
+
@param active: True if the spinner should spin
'''
self.should_spinner_be_shown = active
@@ -268,4 +267,3 @@
self.spinner.hide()
if isinstance(self.spinner, gtk.Spinner):
self.spinner.stop()
-
=== modified file 'GTG/gtk/backends_dialog/parameters_ui/__init__.py'
--- GTG/gtk/backends_dialog/parameters_ui/__init__.py 2012-03-05 15:23:05 +0000
+++ GTG/gtk/backends_dialog/parameters_ui/__init__.py 2012-06-23 11:09:19 +0000
@@ -37,7 +37,6 @@
from GTG.gtk.backends_dialog.parameters_ui.pathui import PathUI
-
class ParametersUI(gtk.VBox):
'''
Given a bakcend, this gtk.VBox populates itself with all the necessary
@@ -63,59 +62,51 @@
{"title": _("Import tags"), \
"anybox_text": _("All tags"), \
"somebox_text": _("Just these tags:"), \
- "parameter_name": "import-tags"}) \
- ),\
+ "parameter_name": "import-tags"})),\
("attached-tags", self.UI_generator(ImportTagsUI, \
{"title": _("Tags to sync"), \
"anybox_text": _("All tasks"), \
"somebox_text": _("Tasks with these tags:"), \
- "parameter_name": "attached-tags"}) \
- ),\
+ "parameter_name": "attached-tags"})), \
("path", self.UI_generator(PathUI)), \
("username", self.UI_generator(TextUI, \
{"description": _("Username"),
- "parameter_name": "username"})
- ), \
- ("password" , self.UI_generator(PasswordUI)), \
- ("period" , self.UI_generator(PeriodUI)), \
+ "parameter_name": "username"})), \
+ ("password", self.UI_generator(PasswordUI)), \
+ ("period", self.UI_generator(PeriodUI)), \
("service-url", self.UI_generator(TextUI, \
{"description": _("Service URL"), \
- "parameter_name": "service-url"}) \
- ),\
+ "parameter_name": "service-url"})),\
("import-from-replies", self.UI_generator(CheckBoxUI, \
{"text": _("Import tasks from @ replies " + \
"directed to you"), \
- "parameter": "import-from-replies"}) \
- ),\
+ "parameter": "import-from-replies"})),\
("import-from-direct-messages", self.UI_generator(CheckBoxUI, \
{"text": _("Import tasks from direct messages"), \
- "parameter": "import-from-direct-messages"}) \
- ),\
+ "parameter": "import-from-direct-messages"})),\
("import-from-my-tweets", self.UI_generator(CheckBoxUI, \
{"text": _("Import tasks from your tweets"), \
- "parameter": "import-from-my-tweets"}) \
- ),\
+ "parameter": "import-from-my-tweets"})),\
("import-bug-tags", self.UI_generator(CheckBoxUI, \
- {"text": _("Tag your GTG tasks with the bug tags"), \
- "parameter": "import-bug-tags"}) \
- ),\
+ {"text": _("Tag your GTG tasks with the bug tags"), \
+ "parameter": "import-bug-tags"})),\
("tag-with-project-name", self.UI_generator(CheckBoxUI, \
{"text": _("Tag your GTG tasks with the project "
"targeted by the bug"), \
- "parameter": "tag-with-project-name"}) \
- ),\
- )
+ "parameter": "tag-with-project-name"})),\
+ )
+
def UI_generator(self, param_type, special_arguments = {}):
'''A helper function to build a widget type from a template.
- It passes to the created widget generator a series of common parameters,
- plus the ones needed to specialize the given template
+ It passes to the created widget generator a series of common
+ parameters, plus the ones needed to specialize the given template
@param param_type: the template to specialize
@param special_arguments: the arguments used for this particular widget
generator.
- @return function: return a widget generator, not a widget. the widget can
- be obtained by calling widget_generator(backend)
+ @return function: return a widget generator, not a widget. the widget
+ can be obtained by calling widget_generator(backend)
'''
return lambda backend: param_type(req = self.req, \
backend = backend, \
@@ -147,6 +138,7 @@
Saves all the parameters at their current state (the user may have
modified them)
'''
+
def _commit_changes(child):
child.commit_changes()
self.foreach(_commit_changes)
=== modified file 'GTG/gtk/backends_dialog/parameters_ui/checkboxui.py'
--- GTG/gtk/backends_dialog/parameters_ui/checkboxui.py 2012-03-05 15:23:05 +0000
+++ GTG/gtk/backends_dialog/parameters_ui/checkboxui.py 2012-06-23 11:09:19 +0000
@@ -20,13 +20,11 @@
import gtk
-
class CheckBoxUI(gtk.HBox):
'''
It's a widget displaying a simple checkbox, with some text to explain its
meaning
'''
-
def __init__(self, req, backend, width, text, parameter):
'''
@@ -35,8 +33,8 @@
@param req: a Requester
@param backend: a backend object
@param width: the width of the gtk.Label object
- @param parameter: the backend parameter this checkbox should display and
- modify
+ @param parameter: the backend parameter this checkbox should display
+ and modify
'''
super(CheckBoxUI, self).__init__()
self.backend = backend
@@ -47,11 +45,12 @@
def _populate_gtk(self, width):
'''Creates the checkbox and the related label
-
+
@param width: the width of the gtk.Label object
'''
self.checkbutton =gtk.CheckButton(label = self.text)
- self.checkbutton.set_active(self.backend.get_parameters()[self.parameter])
+ self.checkbutton.set_active(
+ self.backend.get_parameters()[self.parameter])
self.checkbutton.connect("toggled", self.on_modified)
self.pack_start(self.checkbutton, False)
=== modified file 'GTG/gtk/backends_dialog/parameters_ui/importtagsui.py'
--- GTG/gtk/backends_dialog/parameters_ui/importtagsui.py 2012-03-05 15:23:05 +0000
+++ GTG/gtk/backends_dialog/parameters_ui/importtagsui.py 2012-06-23 11:09:19 +0000
@@ -22,13 +22,11 @@
from GTG.backends.genericbackend import GenericBackend
-
class ImportTagsUI(gtk.VBox):
'''
It's a widget displaying a couple of radio buttons, a label and a textbox
to let the user change the attached tags (or imported)
'''
-
def __init__(self, req, backend, width, title, anybox_text, somebox_text, \
parameter_name):
@@ -132,4 +130,3 @@
self.some_tags_radio.connect("toggled", self.on_changed)
self.all_tags_radio.connect("toggled", self.on_changed)
self.tags_entry.connect("changed", self.on_changed)
-
=== modified file 'GTG/gtk/backends_dialog/parameters_ui/passwordui.py'
--- GTG/gtk/backends_dialog/parameters_ui/passwordui.py 2012-03-05 15:23:05 +0000
+++ GTG/gtk/backends_dialog/parameters_ui/passwordui.py 2012-06-23 11:09:19 +0000
@@ -22,10 +22,8 @@
from GTG import _
-
class PasswordUI(gtk.HBox):
'''Widget displaying a gtk.Label and a textbox to input a password'''
-
def __init__(self, req, backend, width):
'''Creates the gtk widgets and loads the current password in the text
@@ -44,7 +42,7 @@
def _populate_gtk(self, width):
'''Creates the text box and the related label
-
+
@param width: the width of the gtk.Label object
'''
password_label = gtk.Label(_("Password:"))
@@ -70,7 +68,8 @@
def commit_changes(self):
'''Saves the changes to the backend parameter ('password')'''
- self.backend.set_parameter('password', self.password_textbox.get_text())
+ self.backend.set_parameter('password',
+ self.password_textbox.get_text())
def on_password_modified(self, sender):
''' Signal callback, executed when the user edits the password.
@@ -81,4 +80,3 @@
'''
if self.backend.is_enabled() and not self.backend.is_default():
self.req.set_backend_enabled(self.backend.get_id(), False)
-
=== modified file 'GTG/gtk/backends_dialog/parameters_ui/pathui.py'
--- GTG/gtk/backends_dialog/parameters_ui/pathui.py 2012-03-05 15:23:05 +0000
+++ GTG/gtk/backends_dialog/parameters_ui/pathui.py 2012-06-23 11:09:19 +0000
@@ -23,13 +23,10 @@
from GTG import _
-
-
class PathUI(gtk.HBox):
'''Gtk widgets to show a path in a textbox, and a button to bring up a
filesystem explorer to modify that path (also, a label to describe those)
'''
-
def __init__(self, req, backend, width):
'''
@@ -46,7 +43,7 @@
def _populate_gtk(self, width):
'''Creates the gtk.Label, the textbox and the button
-
+
@param width: the width of the gtk.Label object
'''
label = gtk.Label(_("Filename:"))
@@ -78,7 +75,7 @@
'''
if self.backend.is_enabled() and not self.backend.is_default():
self.req.set_backend_enabled(self.backend.get_id(), False)
-
+
def on_button_clicked(self, sender):
'''Shows the filesystem explorer to choose a new file
@@ -93,9 +90,10 @@
gtk.RESPONSE_OK))
self.chooser.set_default_response(gtk.RESPONSE_OK)
#set default file as the current self.path
- self.chooser.set_current_name(os.path.basename(self.textbox.get_text()))
- self.chooser.set_current_folder(os.path.dirname(self.textbox.get_text()))
-
+ textbox_text=self.textbox.get_text()
+ self.chooser.set_current_name(os.path.basename(textbox_text))
+ self.chooser.set_current_folder(os.path.dirname(textbox_text))
+
#filter files
afilter = gtk.FileFilter()
afilter.set_name("All files")
=== modified file 'GTG/gtk/backends_dialog/parameters_ui/periodui.py'
--- GTG/gtk/backends_dialog/parameters_ui/periodui.py 2012-03-05 15:23:05 +0000
+++ GTG/gtk/backends_dialog/parameters_ui/periodui.py 2012-06-23 11:09:19 +0000
@@ -22,11 +22,9 @@
from GTG import _, ngettext
-
class PeriodUI(gtk.HBox):
'''A widget to change the frequency of a backend synchronization
'''
-
def __init__(self, req, backend, width):
'''
@@ -45,7 +43,7 @@
def _populate_gtk(self, width):
'''Creates the gtk widgets
-
+
@param width: the width of the gtk.Label object
'''
period_label = gtk.Label(_("Check for new tasks every"))
=== modified file 'GTG/gtk/backends_dialog/parameters_ui/textui.py'
--- GTG/gtk/backends_dialog/parameters_ui/textui.py 2012-03-05 15:23:05 +0000
+++ GTG/gtk/backends_dialog/parameters_ui/textui.py 2012-06-23 11:09:19 +0000
@@ -20,11 +20,9 @@
import gtk
-
class TextUI(gtk.HBox):
'''A widget to display a simple textbox and a label to describe its content
'''
-
def __init__(self, req, backend, width, description, parameter_name):
'''
@@ -44,7 +42,7 @@
def _populate_gtk(self, width):
'''Creates the gtk widgets
-
+
@param width: the width of the gtk.Label object
'''
label = gtk.Label("%s:" % self.description)
=== modified file 'GTG/gtk/browser/CellRendererTags.py'
--- GTG/gtk/browser/CellRendererTags.py 2012-03-22 12:24:50 +0000
+++ GTG/gtk/browser/CellRendererTags.py 2012-06-23 11:09:19 +0000
@@ -66,7 +66,7 @@
if self.tag_list != None:
for my_tag in self.tag_list:
my_tag_color = my_tag.get_attribute("color")
- my_tag_icon = my_tag.get_attribute("icon")
+ my_tag_icon = my_tag.get_attribute("icon")
if my_tag_color or my_tag_icon:
count = count + 1
elif self.tag != None:
@@ -80,10 +80,10 @@
def __init__(self): #pylint: disable-msg=W0231
self.__gobject_init__()
self.tag_list = None
- self.tag = None
- self.xpad = 1
- self.ypad = 1
- self.PADDING = 1
+ self.tag = None
+ self.xpad = 1
+ self.ypad = 1
+ self.PADDING = 1
def do_set_property(self, pspec, value):
if pspec.name == "tag-list":
@@ -101,7 +101,7 @@
self, window, widget, background_area, cell_area, expose_area, flags):
vw_tags = self.__count_viewable_tags()
- count = 0
+ count = 0
# Select source
if self.tag_list != None:
@@ -112,25 +112,25 @@
return
# Drawing context
- cr = window.cairo_create()
+ cr = window.cairo_create()
gdkcontext = gtk.gdk.CairoContext(cr)
gdkcontext.set_antialias(cairo.ANTIALIAS_NONE)
# Coordinates of the origin point
x_align = self.get_property("xalign")
y_align = self.get_property("yalign")
- orig_x = cell_area.x + int((cell_area.width - 16*vw_tags -\
+ orig_x = cell_area.x + int((cell_area.width - 16*vw_tags -\
self.PADDING*2*(vw_tags-1)) * x_align)
- orig_y = cell_area.y + int((cell_area.height - 16) * y_align)
+ orig_y = cell_area.y + int((cell_area.height - 16) * y_align)
# We draw the icons & squares
for my_tag in tags:
- my_tag_icon = my_tag.get_attribute("icon")
+ my_tag_icon = my_tag.get_attribute("icon")
my_tag_color = my_tag.get_attribute("color")
- rect_x = orig_x + self.PADDING*2*count + 16*count
- rect_y = orig_y
+ rect_x = orig_x + self.PADDING*2*count + 16*count
+ rect_y = orig_y
if my_tag_icon:
try:
@@ -162,10 +162,10 @@
if self.tag and my_tag: #pylint: disable-msg=W0631
- my_tag_icon = my_tag.get_attribute("icon")
+ my_tag_icon = my_tag.get_attribute("icon")
my_tag_color = my_tag.get_attribute("color")
- if not my_tag_icon and not my_tag_color:
+ if not my_tag_icon and not my_tag_color:
# Draw rounded rectangle
gdkcontext.set_source_rgba(0.95, 0.95, 0.95, 1)
=== modified file 'GTG/gtk/browser/__init__.py'
--- GTG/gtk/browser/__init__.py 2012-04-21 15:55:54 +0000
+++ GTG/gtk/browser/__init__.py 2012-06-23 11:09:19 +0000
@@ -29,24 +29,25 @@
class GnomeConfig:
current_rep = os.path.dirname(os.path.abspath(__file__))
- GLADE_FILE = os.path.join(current_rep, "taskbrowser.glade")
- MODIFYTAGS_GLADE_FILE = os.path.join(current_rep, "modifytags_dialog.glade")
- TAGEDITOR_GLADE_FILE = os.path.join(current_rep, "tageditor.glade")
+ GLADE_FILE = os.path.join(current_rep, "taskbrowser.glade")
+ MODIFYTAGS_GLADE_FILE= os.path.join(current_rep, "modifytags_dialog.glade")
+ TAGEDITOR_GLADE_FILE = os.path.join(current_rep, "tageditor.glade")
- MARK_DONE = _("Mark as Done")
- MARK_DONE_TOOLTIP = _("Mark the selected task as done")
- MARK_UNDONE = _("Mark as not Done")
- MARK_UNDONE_TOOLTIP = _("Mark the selected task as to be done")
- MARK_DISMISS = _("Dismiss")
- MARK_DISMISS_TOOLTIP = _("Mark the task as not to be done anymore")
- MARK_UNDISMISS = _("Undismiss")
- MARK_UNDISMISS_TOOLTIP = _("Mark the selected task as to be done")
- DELETE_TOOLTIP = _("Permanently remove the selected task")
- EDIT_TOOLTIP = _("Edit the selected task")
- NEW_TASK_TOOLTIP = _("Create a new task")
- NEW_SUBTASK_TOOLTIP = _("Create a new subtask")
+ MARK_DONE = _("Mark as Done")
+ MARK_DONE_TOOLTIP = _("Mark the selected task as done")
+ MARK_UNDONE = _("Mark as not Done")
+ MARK_UNDONE_TOOLTIP = _("Mark the selected task as to be done")
+ MARK_DISMISS = _("Dismiss")
+ MARK_DISMISS_TOOLTIP = _("Mark the task as not to be done anymore")
+ MARK_UNDISMISS = _("Undismiss")
+ MARK_UNDISMISS_TOOLTIP = _("Mark the selected task as to be done")
+ DELETE_TOOLTIP = _("Permanently remove the selected task")
+ EDIT_TOOLTIP = _("Edit the selected task")
+ NEW_TASK_TOOLTIP = _("Create a new task")
+ NEW_SUBTASK_TOOLTIP = _("Create a new subtask")
WORKVIEW_TOGGLE_TOOLTIP = _("Display only the currently actionable tasks")
- TAG_IN_WORKVIEW_TOGG = _("Hide this tag from the workview")
+ TAG_IN_WORKVIEW_TOGG = _("Hide this tag from the workview")
TAG_NOTIN_WORKVIEW_TOGG = _("Show this tag in the workview")
- QUICKADD_ENTRY_TOOLTIP = _("You can create, open or filter your tasks here")
- QUICKADD_ICON_TOOLTIP = _("Clear")
+ QUICKADD_ENTRY_TOOLTIP = _(
+ "You can create, open or filter your tasks here")
+ QUICKADD_ICON_TOOLTIP = _("Clear")
=== modified file 'GTG/gtk/browser/browser.py'
--- GTG/gtk/browser/browser.py 2012-06-21 09:51:32 +0000
+++ GTG/gtk/browser/browser.py 2012-06-23 11:09:19 +0000
@@ -48,8 +48,6 @@
#=== MAIN CLASS ===============================================================
-
-
class Timer:
def __init__(self, name):
@@ -405,7 +403,7 @@
### HELPER FUNCTIONS ########################################################
def open_preferences(self, widget):
self.vmanager.open_preferences(self.config)
-
+
def open_plugins(self, widget):
self.vmanager.configure_plugins()
=== modified file 'GTG/gtk/browser/custominfobar.py'
--- GTG/gtk/browser/custominfobar.py 2012-04-02 18:06:56 +0000
+++ GTG/gtk/browser/custominfobar.py 2012-06-23 11:09:19 +0000
@@ -25,7 +25,6 @@
from GTG.tools.networkmanager import is_connection_up
-
class CustomInfoBar(gtk.InfoBar):
'''
A gtk.InfoBar specialized for displaying errors and requests for
@@ -33,9 +32,9 @@
'''
- AUTHENTICATION_MESSAGE = _("The <b>%s</b> synchronization service cannot login with the "
- "supplied authentication data and has been"
- " disabled. To retry the login, re-enable the service.")
+ AUTHENTICATION_MESSAGE = _("The <b>%s</b> synchronization service cannot"
+ "supplied authentication data and has been disabled"
+ ". To retry the login, re-enable the service.")
NETWORK_MESSAGE = _("Due to a network problem, I cannot contact "
"the <b>%s</b> synchronization service.")
@@ -92,8 +91,8 @@
'''
Sets this infobar to show an error to the user
- @param error_code: the code of the error to show. Error codes are listed
- in BackendSignals
+ @param error_code: the code of the error to show. Error codes are
+ listed in BackendSignals
'''
self._populate()
self.connect("response", self._on_error_response)
@@ -102,7 +101,8 @@
if error_code == BackendSignals.ERRNO_AUTHENTICATION:
self.set_message_type(gtk.MESSAGE_ERROR)
self.label.set_markup(self.AUTHENTICATION_MESSAGE % backend_name)
- self.add_button(_('Configure synchronization service'), gtk.RESPONSE_ACCEPT)
+ self.add_button(_('Configure synchronization service'),
+ gtk.RESPONSE_ACCEPT)
self.add_button(_('Ignore'), gtk.RESPONSE_CLOSE)
elif error_code == BackendSignals.ERRNO_NETWORK:
@@ -112,7 +112,7 @@
self.label.set_markup(self.NETWORK_MESSAGE % backend_name)
#FIXME: use gtk stock button instead
self.add_button(_('Ok'), gtk.RESPONSE_CLOSE)
-
+
elif error_code == BackendSignals.ERRNO_DBUS:
self.set_message_type(gtk.MESSAGE_WARNING)
self.label.set_markup(self.DBUS_MESSAGE % backend_name)
@@ -206,5 +206,5 @@
'''
text = self.text_box.get_text()
self.dialog.destroy()
- threading.Thread(target = getattr(self.backend, self.callback),
+ threading.Thread(target = getattr(self.backend, self.callback),
args = ("set_text", text)).start()
=== modified file 'GTG/gtk/browser/simple_color_selector.py'
--- GTG/gtk/browser/simple_color_selector.py 2012-05-04 19:45:19 +0000
+++ GTG/gtk/browser/simple_color_selector.py 2012-06-23 11:09:19 +0000
@@ -40,10 +40,12 @@
"#CE5C00", "#C4A000", "#BABDB6", "#2E3436",
]
-BUTTON_WIDTH = 36
+BUTTON_WIDTH = 36
BUTTON_HEIGHT = 24
-class SimpleColorSelectorPaletteItem(gtk.DrawingArea): # pylint: disable-msg=R0904,C0301
+
+class SimpleColorSelectorPaletteItem(gtk.DrawingArea):
+ # pylint: disable-msg=R0904,C0301
"""An item of the color selecctor palette"""
def __init__(self, color=None):
@@ -61,7 +63,7 @@
alloc = self.get_allocation()
alloc_w, alloc_h = alloc[2], alloc[3]
# Drawing context
- cr_ctxt = self.window.cairo_create() # pylint: disable-msg=E1101
+ cr_ctxt = self.window.cairo_create() # pylint: disable-msg=E1101
gdkcontext = gtk.gdk.CairoContext(cr_ctxt)
# Draw rectangle
@@ -93,13 +95,12 @@
gdkcontext.stroke()
gdkcontext.set_source_rgba(0, 0, 0, 0.50)
gdkcontext.set_line_width(3.0)
- gdkcontext.move_to(pos_x , pos_y+size/2)
+ gdkcontext.move_to(pos_x, pos_y+size/2)
gdkcontext.line_to(pos_x+size/2, pos_y+size)
- gdkcontext.line_to(pos_x+size , pos_y)
+ gdkcontext.line_to(pos_x+size, pos_y)
gdkcontext.stroke()
### callbacks ###
-
def on_expose(self, widget, params): # pylint: disable-msg=W0613
"""Callback: redraws the widget when it is exposed"""
self.__draw()
@@ -109,7 +110,6 @@
self.__draw()
### PUBLIC IF ###
-
def set_color(self, color):
"""Defines the widget color"""
self.color = color
@@ -125,8 +125,8 @@
class SimpleColorSelector(gtk.VBox): # pylint: disable-msg=R0904,C0301
- """Widget displaying a palette of colors, possibly with a button allowing to
- define new colors."""
+ """Widget displaying a palette of colors, possibly with a button allowing
+ to define new colors."""
def __init__(self, width=9, colors=None, custom_colors=None):
gtk.VBox.__init__(self)
@@ -281,7 +281,6 @@
color_dialog.destroy()
# public IF
-
def has_color(self, col):
"""Returns True if the color is already present"""
return col in self.colors or col in self.custom_colors
=== modified file 'GTG/gtk/browser/tag_context_menu.py'
--- GTG/gtk/browser/tag_context_menu.py 2012-05-04 20:49:39 +0000
+++ GTG/gtk/browser/tag_context_menu.py 2012-06-23 11:09:19 +0000
@@ -21,7 +21,7 @@
"""
tag_context_menu:
Implements a context (pop-up) menu for the tag item in the sidebar.
-Right now it is just a void shell It is supposed to become a more generic
+Right now it is just a void shell It is supposed to become a more generic
sidebar context for all kind of item displayed there.
Also, it is supposed to handle more complex menus (with non-std widgets,
like a color picker)
@@ -33,6 +33,7 @@
from GTG import _
+
class TagContextMenu(gtk.Menu): # pylint: disable-msg=R0904
"""Context menu fo the tag i the sidebar"""
@@ -67,14 +68,12 @@
self.show_all()
### PUBLIC API ###
-
def set_tag(self, tag):
"""Update the context menu items using the tag attributes."""
self.tag = tag
self.__build_menu()
### CALLBACKS ###
-
def on_mi_cc_activate(self, widget): # pylint: disable-msg=W0613
"""Callback: show the tag editor upon request"""
self.vmanager.open_tag_editor(self.tag)
=== modified file 'GTG/gtk/browser/treeview_factory.py'
--- GTG/gtk/browser/treeview_factory.py 2012-06-12 03:58:56 +0000
+++ GTG/gtk/browser/treeview_factory.py 2012-06-23 11:09:19 +0000
@@ -38,7 +38,8 @@
def __init__(self, tree, desc):
TreeView.__init__(self, tree, desc)
self.show_expander = False
- self.treemodel.connect("row-has-child-toggled", self.__show_expander_col)
+ self.treemodel.connect("row-has-child-toggled",
+ self.__show_expander_col)
self.__show_expander_col(self.treemodel, None, None)
def __has_child(self, model, path, iter):
@@ -51,16 +52,17 @@
treemodel.foreach(self.__has_child)
self.set_show_expanders(self.show_expander)
+
class TreeviewFactory():
- def __init__(self,requester,config):
+ def __init__(self, requester, config):
self.req = requester
self.mainview = self.req.get_tasks_tree()
self.config = config
-
+
#Initial unactive color
- #This is a crude hack. As we don't have a reference to the
- #treeview to retrieve the style, we save that color when we
+ #This is a crude hack. As we don't have a reference to the
+ #treeview to retrieve the style, we save that color when we
#build the treeview.
self.unactive_color = "#888a85"
@@ -69,12 +71,11 @@
# Cache tags treeview for on_rename_tag callback
self.tags_view = None
-
+
#############################
#Functions for tasks columns
################################
-
- def _has_hidden_subtask(self,task):
+ def _has_hidden_subtask(self, task):
#not recursive
display_count = self.mainview.node_n_children(task.get_id())
real_count = 0
@@ -84,35 +85,36 @@
if sub_task and sub_task.get_status() == Task.STA_ACTIVE:
real_count = real_count + 1
return display_count < real_count
-
+
def task_bg_color(self, node, default_color):
if self.config.get('bg_color_enable'):
return colors.background_color(node.get_tags(), default_color)
else:
return None
-
+
#return an ordered list of tags of a task
- def task_tags_column(self,node):
+ def task_tags_column(self, node):
tags = node.get_tags()
search_parent = self.req.get_tag(CoreConfig.SEARCH_TAG)
for search_tag in search_parent.get_children():
tag = self.req.get_tag(search_tag)
- match = search_filter(node, parse_search_query(tag.get_attribute('query')))
+ match = search_filter(node,
+ parse_search_query(tag.get_attribute('query')))
if match and search_tag not in tags:
tags.append(tag)
tags.sort(key = lambda x: x.get_name())
return tags
-
+
#task title
def task_title_column(self, node):
return saxutils.escape(node.get_title())
-
+
#task title/label
def task_label_column(self, node):
str_format = "%s"
-
+
if node.get_status() == Task.STA_ACTIVE:
# we mark in bold tasks which are due today or as Now
days_left = node.get_days_left()
@@ -120,11 +122,12 @@
str_format = "<b>%s</b>"
if self._has_hidden_subtask(node):
str_format = "<span color='%s'>%s</span>"\
- % (self.unactive_color, str_format)
+ % (self.unactive_color, str_format)
title = str_format % saxutils.escape(node.get_title())
if node.get_status() == Task.STA_ACTIVE:
- count = self.mainview.node_n_children(node.get_id(), recursive=True)
+ count = self.mainview.node_n_children(node.get_id(),
+ recursive=True)
if count != 0:
title += " (%s)" % count
elif node.get_status() == Task.STA_DISMISSED:
@@ -134,35 +137,35 @@
excerpt = saxutils.escape(node.get_excerpt(lines=1,
strip_tags=True, strip_subtasks=True))
title += " <span size='small' color='%s'>%s</span>" \
- % (self.unactive_color, excerpt)
+ % (self.unactive_color, excerpt)
return title
-
+
#task start date
- def task_sdate_column(self,node):
+ def task_sdate_column(self, node):
return node.get_start_date().to_readable_string()
-
- def task_duedate_column(self,node):
+
+ def task_duedate_column(self, node):
return node.get_due_date().to_readable_string()
-
- def task_cdate_column(self,node):
+
+ def task_cdate_column(self, node):
return node.get_closed_date().to_readable_string()
-
- def start_date_sorting(self,task1,task2,order):
- sort = self.__date_comp(task1,task2,'start',order)
- return sort
-
- def due_date_sorting(self,task1,task2,order):
- sort = self.__date_comp(task1,task2,'due',order)
- return sort
-
- def closed_date_sorting(self,task1,task2,order):
- sort = self.__date_comp(task1,task2,'closed',order)
- return sort
-
- def title_sorting(self,task1,task2,order):
- return cmp(task1.get_title(),task2.get_title())
-
- def __date_comp(self,task1,task2,para,order):
+
+ def start_date_sorting(self, task1, task2, order):
+ sort = self.__date_comp(task1, task2, 'start', order)
+ return sort
+
+ def due_date_sorting(self, task1, task2, order):
+ sort = self.__date_comp(task1, task2, 'due', order)
+ return sort
+
+ def closed_date_sorting(self, task1, task2, order):
+ sort = self.__date_comp(task1, task2, 'closed', order)
+ return sort
+
+ def title_sorting(self, task1, task2, order):
+ return cmp(task1.get_title(), task2.get_title())
+
+ def __date_comp(self, task1, task2, para, order):
'''This is a quite complex method to sort tasks by date,
handling fuzzy date and complex situation.
Return -1 if nid1 is before nid2, return 1 otherwise
@@ -179,39 +182,40 @@
t2 = task2.get_closed_date()
else:
raise ValueError('invalid date comparison parameter: %s')%para
- sort = cmp(t2,t1)
+ sort = cmp(t2, t1)
else:
sort = 0
-
+
#local function
def reverse_if_descending(s):
- """Make a cmp() result relative to the top instead of following
- user-specified sort direction"""
+ """Make a cmp() result relative to the top instead of following
+ user-specified sort direction"""
if order == gtk.SORT_ASCENDING:
return s
else:
return -1*s
- if sort == 0: # Group tasks with the same tag together for visual cleanness
+ if sort == 0:
+ # Group tasks with the same tag together for visual cleanness
t1_tags = task1.get_tags_name()
t1_tags.sort()
t2_tags = task2.get_tags_name()
t2_tags.sort()
sort = reverse_if_descending(cmp(t1_tags, t2_tags))
-
+
if sort == 0: # Break ties by sorting by title
t1_title = task1.get_title()
t2_title = task2.get_title()
t1_title = locale.strxfrm(t1_title)
t2_title = locale.strxfrm(t2_title)
sort = reverse_if_descending(cmp(t1_title, t2_title))
-
+
return sort
-
+
#############################
#Functions for tags columns
#############################
- def tag_name(self,node):
+ def tag_name(self, node):
label = node.get_attribute("label")
if label.startswith('@'):
label = label[1:]
@@ -220,18 +224,18 @@
return "<span color='%s'>%s</span>" %(self.unactive_color, label)
else:
return label
-
- def get_tag_count(self,node):
+
+ def get_tag_count(self, node):
if node.get_id() == 'search':
return ""
else:
toreturn = node.get_active_tasks_count()
- return "<span color='%s'>%s</span>" %(self.unactive_color,toreturn)
-
- def is_tag_separator_filter(self,tag):
+ return "<span color='%s'>%s</span>"%(self.unactive_color, toreturn)
+
+ def is_tag_separator_filter(self, tag):
return tag.get_attribute('special') == 'sep'
-
- def tag_sorting(self,t1,t2,order):
+
+ def tag_sorting(self, t1, t2, order):
t1_sp = t1.get_attribute("special")
t2_sp = t2.get_attribute("special")
t1_name = locale.strxfrm(t1.get_name())
@@ -246,8 +250,8 @@
t1_order = t1.get_attribute("order")
t2_order = t2.get_attribute("order")
return cmp(t1_order, t2_order)
-
- def ontag_task_dnd(self,source,target):
+
+ def ontag_task_dnd(self, source, target):
task = self.req.get_task(source)
if target.startswith('@'):
task.add_tag(target)
@@ -259,7 +263,7 @@
############################################
######## The Factory #######################
############################################
- def tags_treeview(self,tree):
+ def tags_treeview(self, tree):
desc = {}
#Tag id
@@ -271,32 +275,32 @@
col['order'] = 0
col['sorting_func'] = self.tag_sorting
desc[col_name] = col
-
+
#Tags color
col_name = 'color'
col = {}
render_tags = CellRendererTags()
render_tags.set_property('ypad', 3)
col['title'] = _("Tags")
- col['renderer'] = ['tag',render_tags]
- col['value'] = [gobject.TYPE_PYOBJECT,lambda node: node]
+ col['renderer'] = ['tag', render_tags]
+ col['value'] = [gobject.TYPE_PYOBJECT, lambda node: node]
col['expandable'] = False
col['resizable'] = False
col['order'] = 1
desc[col_name] = col
-
+
#Tag names
col_name = 'tagname'
col = {}
render_text = gtk.CellRendererText()
render_text.set_property('ypad', 3)
- col['renderer'] = ['markup',render_text]
- col['value'] = [str,self.tag_name]
+ col['renderer'] = ['markup', render_text]
+ col['value'] = [str, self.tag_name]
col['expandable'] = True
col['new_column'] = False
col['order'] = 2
desc[col_name] = col
-
+
#Tag count
col_name = 'tagcount'
col = {}
@@ -304,8 +308,8 @@
render_text.set_property('xpad', 3)
render_text.set_property('ypad', 3)
render_text.set_property('xalign', 1.0)
- col['renderer'] = ['markup',render_text]
- col['value'] = [str,self.get_tag_count]
+ col['renderer'] = ['markup', render_text]
+ col['value'] = [str, self.get_tag_count]
col['expandable'] = False
col['new_column'] = False
col['order'] = 3
@@ -313,13 +317,14 @@
self.enable_update_tags()
- return self.build_tag_treeview(tree,desc)
+ return self.build_tag_treeview(tree, desc)
def enable_update_tags(self):
self.tag_cllbcks = []
tasks = self.req.get_tasks_tree()
- for event in 'node-added-inview', 'node-modified-inview', 'node-deleted-inview':
+ l =['node-added-inview', 'node-modified-inview', 'node-deleted-inview']
+ for event in l:
handle = tasks.register_cllbck(event, self._update_tags)
self.tag_cllbcks.append((event, handle))
@@ -342,18 +347,18 @@
if task:
for t in self.req.get_task(node_id).get_tags():
tree.refresh_node(t.get_name())
-
- def active_tasks_treeview(self,tree):
+
+ def active_tasks_treeview(self, tree):
#Build the title/label/tags columns
desc = self.common_desc_for_tasks(tree)
-
+
# "startdate" column
col_name = 'startdate'
col = {}
col['title'] = _("Start date")
col['expandable'] = False
col['resizable'] = False
- col['value'] = [str,self.task_sdate_column]
+ col['value'] = [str, self.task_sdate_column]
col['order'] = 3
col['sorting_func'] = self.start_date_sorting
desc[col_name] = col
@@ -364,40 +369,40 @@
col['title'] = _("Due")
col['expandable'] = False
col['resizable'] = False
- col['value'] = [str,self.task_duedate_column]
+ col['value'] = [str, self.task_duedate_column]
col['order'] = 4
col['sorting_func'] = self.due_date_sorting
desc[col_name] = col
#Returning the treeview
- treeview = self.build_task_treeview(tree,desc)
+ treeview = self.build_task_treeview(tree, desc)
treeview.set_sort_column('duedate')
return treeview
-
- def closed_tasks_treeview(self,tree):
+
+ def closed_tasks_treeview(self, tree):
#Build the title/label/tags columns
desc = self.common_desc_for_tasks(tree)
-
+
# "startdate" column
col_name = 'closeddate'
col = {}
col['title'] = _("Closed date")
col['expandable'] = False
col['resizable'] = False
- col['value'] = [str,self.task_cdate_column]
+ col['value'] = [str, self.task_cdate_column]
col['order'] = 3
col['sorting_func'] = self.closed_date_sorting
desc[col_name] = col
#Returning the treeview
- treeview = self.build_task_treeview(tree,desc)
+ treeview = self.build_task_treeview(tree, desc)
treeview.set_sort_column('closeddate')
return treeview
-
-
+
+
#This build the first tag/title columns, common
#to both active and closed tasks treeview
- def common_desc_for_tasks(self,tree):
+ def common_desc_for_tasks(self, tree):
desc = {}
#invisible 'task_id' column
@@ -421,20 +426,20 @@
col = {}
render_text = gtk.CellRendererText()
render_text.set_property("ellipsize", pango.ELLIPSIZE_END)
- col['renderer'] = ['markup',render_text]
- col['value'] = [str,self.task_title_column]
+ col['renderer'] = ['markup', render_text]
+ col['value'] = [str, self.task_title_column]
col['visible'] = False
col['order'] = 0
col['sorting_func'] = self.title_sorting
desc[col_name] = col
-
+
# "tags" column (no title)
col_name = 'tags'
col = {}
render_tags = CellRendererTags()
render_tags.set_property('xalign', 0.0)
- col['renderer'] = ['tag_list',render_tags]
- col['value'] = [gobject.TYPE_PYOBJECT,self.task_tags_column]
+ col['renderer'] = ['tag_list', render_tags]
+ col['value'] = [gobject.TYPE_PYOBJECT, self.task_tags_column]
col['expandable'] = False
col['resizable'] = False
col['order'] = 1
@@ -446,18 +451,17 @@
col['title'] = _("Title")
render_text = gtk.CellRendererText()
render_text.set_property("ellipsize", pango.ELLIPSIZE_END)
- col['renderer'] = ['markup',render_text]
- col['value'] = [str,self.task_label_column]
+ col['renderer'] = ['markup', render_text]
+ col['value'] = [str, self.task_label_column]
col['expandable'] = True
col['resizable'] = True
col['sorting'] = 'title'
col['order'] = 2
desc[col_name] = col
return desc
-
-
- def build_task_treeview(self,tree,desc):
- treeview = AutoExpandTreeView(tree,desc)
+
+ def build_task_treeview(self, tree, desc):
+ treeview = AutoExpandTreeView(tree, desc)
#Now that the treeview is done, we can polish
treeview.set_main_search_column('label')
treeview.set_expander_column('label')
@@ -472,19 +476,19 @@
self.unactive_color = \
treeview.style.text[gtk.STATE_INSENSITIVE].to_string()
return treeview
-
- def build_tag_treeview(self,tree,desc):
- treeview = AutoExpandTreeView(tree,desc)
+
+ def build_tag_treeview(self, tree, desc):
+ treeview = AutoExpandTreeView(tree, desc)
# Global treeview properties
treeview.set_property("enable-tree-lines", False)
treeview.set_rules_hint(False)
treeview.set_row_separator_func(self.is_tag_separator_filter)
treeview.set_headers_visible(False)
treeview.set_dnd_name('gtg/tag-iter-str')
- treeview.set_dnd_external('gtg/task-iter-str',self.ontag_task_dnd)
+ treeview.set_dnd_external('gtg/task-iter-str', self.ontag_task_dnd)
#Updating the unactive color (same for everyone)
self.unactive_color = \
treeview.style.text[gtk.STATE_INSENSITIVE].to_string()
treeview.set_sort_column('tag_id')
self.tags_view = treeview
- return treeview
+ return treeview
=== modified file 'GTG/gtk/colors.py'
--- GTG/gtk/colors.py 2012-03-05 15:23:05 +0000
+++ GTG/gtk/colors.py 2012-06-23 11:09:19 +0000
@@ -20,6 +20,7 @@
#Take list of Tags and give the background color that should be applied
#The returned color might be None (in which case, the default is used)
+
def background_color(tags, bgcolor = None):
if not bgcolor:
bgcolor = gtk.gdk.color_parse("#FFFFFF")
@@ -31,27 +32,28 @@
blue = 0
for my_tag in tags:
my_color_str = my_tag.get_attribute("color")
- if my_color_str :
+ if my_color_str:
my_color = gtk.gdk.color_parse(my_color_str)
color_count = color_count + 1
- red = red + my_color.red
+ red = red + my_color.red
green = green + my_color.green
- blue = blue + my_color.blue
+ blue = blue + my_color.blue
if color_count != 0:
- red = int(red / color_count)
- green = int(green / color_count)
- blue = int(blue / color_count)
+ red = int(red / color_count)
+ green = int(green / color_count)
+ blue = int(blue / color_count)
brightness = (red+green+blue) / 3.0
target_brightness = (bgcolor.red+bgcolor.green+bgcolor.blue)/3.0
-
+
alpha = (1-abs(brightness-target_brightness)/65535.0)/2.0
red = int(red*alpha + bgcolor.red*(1-alpha))
green = int(green*alpha + bgcolor.green*(1-alpha))
blue = int(blue*alpha + bgcolor.blue*(1-alpha))
-
+
my_color = gtk.gdk.Color(red, green, blue).to_string()
return my_color
+
def get_colored_tag_markup(req, tag_name, html = False):
'''
Given a tag name, returns a string containing the markup to color the
@@ -73,6 +75,7 @@
else:
return tag_name
+
def get_colored_tags_markup(req, tag_names):
'''
Calls get_colored_tag_markup for each tag_name in tag_names
=== modified file 'GTG/gtk/crashhandler.py'
--- GTG/gtk/crashhandler.py 2012-05-20 19:05:20 +0000
+++ GTG/gtk/crashhandler.py 2012-06-23 11:09:19 +0000
@@ -332,7 +332,7 @@
yield
initialize(app_name = "Getting Things GNOME!",
- message = "GTG" + info.VERSION +
+ 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."),
=== modified file 'GTG/gtk/delete_dialog.py'
--- GTG/gtk/delete_dialog.py 2012-03-26 15:38:57 +0000
+++ GTG/gtk/delete_dialog.py 2012-06-23 11:09:19 +0000
@@ -24,18 +24,19 @@
class DeletionUI():
-
+
MAXIMUM_TIDS_TO_SHOW = 5
+
def __init__(self, req):
self.req = req
self.tids_todelete = []
# Tags which must be updated
self.update_tags = []
# Load window tree
- self.builder = gtk.Builder()
+ self.builder = gtk.Builder()
self.builder.add_from_file(ViewConfig.DELETE_GLADE_FILE)
- signals = { "on_delete_confirm": self.on_delete_confirm,
- "on_delete_cancel": lambda x: x.hide,}
+ signals = {"on_delete_confirm": self.on_delete_confirm,
+ "on_delete_cancel": lambda x: x.hide, }
self.builder.connect_signals(signals)
def on_delete_confirm(self, widget):
@@ -43,7 +44,7 @@
otherwise, we will look which tid is selected"""
for tid in self.tids_todelete:
if self.req.has_task(tid):
- self.req.delete_task(tid,recursive=True)
+ self.req.delete_task(tid, recursive=True)
self.tids_todelete = []
# Update tags
@@ -60,10 +61,11 @@
tasklist=[]
self.update_tags = []
for tid in self.tids_todelete:
+
def recursive_list_tasks(task_list, root):
- """Populate a list of all the subtasks and
+ """Populate a list of all the subtasks and
their children, recursively.
-
+
Also collect the list of affected tags
which should be refreshed"""
if root not in task_list:
@@ -78,7 +80,7 @@
task = self.req.get_task(tid)
recursive_list_tasks(tasklist, task)
- # We fill the text and the buttons' labels according to the number
+ # We fill the text and the buttons' labels according to the number
# of tasks to delete
label = self.builder.get_object("label1")
label_text = label.get_text()
@@ -104,7 +106,7 @@
"Permanently remove tasks",
singular))
label_text = label_text[0:label_text.find(":") + 1]
-
+
#we don't want to end with just one task that doesn't fit the
# screen and a line saying "And one more task", so we go a
# little over our limit
@@ -123,7 +125,7 @@
cancel_button = self.builder.get_object("cancel")
cancel_button.grab_focus()
if delete_dialog.run() != 1:
- tasklist = []
+ tasklist = []
delete_dialog.hide()
return tasklist
else:
=== modified file 'GTG/gtk/editor/__init__.py'
--- GTG/gtk/editor/__init__.py 2012-03-26 22:14:55 +0000
+++ GTG/gtk/editor/__init__.py 2012-06-23 11:09:19 +0000
@@ -26,7 +26,7 @@
class GnomeConfig:
current_rep = os.path.dirname(os.path.abspath(__file__))
- GLADE_FILE = os.path.join(current_rep, "taskeditor.glade")
+ GLADE_FILE = os.path.join(current_rep, "taskeditor.glade")
MARK_DONE = _("Mark as Done")
MARK_UNDONE = _("Mark as not Done")
=== modified file 'GTG/gtk/editor/editor.py'
--- GTG/gtk/editor/editor.py 2012-05-20 18:14:23 +0000
+++ GTG/gtk/editor/editor.py 2012-06-23 11:09:19 +0000
@@ -28,7 +28,7 @@
import gtk
from GTG import _, ngettext
-from GTG.gtk.editor import GnomeConfig
+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
@@ -36,12 +36,13 @@
from GTG.tools.dates import Date
from GTG.gtk.editor.calendar import GTGCalendar
+
class TaskEditor:
- def __init__(self,
- requester,
- vmanager,
- task,
+ def __init__(self,
+ requester,
+ vmanager,
+ task,
taskconfig = None,
thisisnew = False,
clipboard = None):
@@ -89,13 +90,13 @@
"on_move": self.on_move,
}
self.builder.connect_signals(dic)
- self.window = self.builder.get_object("TaskEditor")
+ self.window = self.builder.get_object("TaskEditor")
#Removing the Normal textview to replace it by our own
#So don't try to change anything with glade, this is a home-made widget
textview = self.builder.get_object("textview")
scrolled = self.builder.get_object("scrolledtask")
scrolled.remove(textview)
- self.textview = TaskView(self.req, self.clipboard)
+ self.textview = TaskView(self.req, self.clipboard)
self.textview.show()
self.textview.set_subtask_callback(self.new_subtask)
self.textview.open_task_callback(self.vmanager.open_task)
@@ -103,11 +104,11 @@
self.textview.set_right_margin(5)
scrolled.add(self.textview)
#Voila! it's done
- self.calendar = GTGCalendar(self.builder)
+ self.calendar = GTGCalendar(self.builder)
self.duedate_widget = self.builder.get_object("duedate_entry")
self.startdate_widget = self.builder.get_object("startdate_entry")
self.closeddate_widget = self.builder.get_object("closeddate_entry")
- self.dayleft_label = self.builder.get_object("dayleft")
+ self.dayleft_label = self.builder.get_object("dayleft")
self.tasksidebar = self.builder.get_object("tasksidebar")
# Define accelerator keys
self.init_accelerators()
@@ -164,14 +165,15 @@
if tid in self.config:
if "position" in self.config[tid]:
pos = self.config[tid]["position"]
- self.move(pos[0],pos[1])
+ self.move(pos[0], pos[1])
#print "restoring position %s %s" %(pos[0],pos[1])
if "size" in self.config[tid]:
size = self.config[tid]["size"]
#print "size %s - %s" %(str(size[0]), str(size[1]))
- #this eval(str()) is a ugly (!) hack to accept both int and str
+ #this eval(str()) is a ugly (!) hack to accept both int and
+ # str
#FIXME: Fix this!
- self.window.resize(eval(str(size[0])),eval(str(size[1])))
+ self.window.resize(eval(str(size[0])), eval(str(size[1])))
self.textview.set_editable(True)
self.window.show()
@@ -196,18 +198,21 @@
# Ctrl-Shift-N creates a new subtask
insert_subtask = self.builder.get_object("insert_subtask")
- key, mod = gtk.accelerator_parse("<Control><Shift>n")
- insert_subtask.add_accelerator('clicked', agr, key, mod, gtk.ACCEL_VISIBLE)
+ key, mod = gtk.accelerator_parse("<Control><Shift>n")
+ insert_subtask.add_accelerator('clicked',
+ agr, key, mod, gtk.ACCEL_VISIBLE)
# Ctrl-D marks task as done
mark_as_done_editor = self.builder.get_object('mark_as_done_editor')
key, mod = gtk.accelerator_parse('<Control>d')
- mark_as_done_editor.add_accelerator('clicked', agr, key, mod, gtk.ACCEL_VISIBLE)
+ mark_as_done_editor.add_accelerator('clicked',
+ agr, key, mod, gtk.ACCEL_VISIBLE)
# Ctrl-I marks task as dismissed
dismiss_editor = self.builder.get_object('dismiss_editor')
key, mod = gtk.accelerator_parse('<Control>i')
- dismiss_editor.add_accelerator('clicked', agr, key, mod, gtk.ACCEL_VISIBLE)
+ dismiss_editor.add_accelerator('clicked', agr, key, mod,
+ gtk.ACCEL_VISIBLE)
#Can be called at any time to reflect the status of the Task
#Refresh should never interfere with the TaskView.
@@ -219,34 +224,37 @@
if self.window == None:
return
to_save = False
- #title of the window
+ #title of the window
if title:
self.window.set_title(title)
to_save = True
else:
self.window.set_title(self.task.get_title())
- status = self.task.get_status()
+ status = self.task.get_status()
if status == Task.STA_DISMISSED:
self.donebutton.set_label(GnomeConfig.MARK_DONE)
self.donebutton.set_tooltip_text(GnomeConfig.MARK_DONE_TOOLTIP)
self.donebutton.set_icon_name("gtg-task-done")
self.dismissbutton.set_label(GnomeConfig.MARK_UNDISMISS)
- self.dismissbutton.set_tooltip_text(GnomeConfig.MARK_UNDISMISS_TOOLTIP)
+ self.dismissbutton.set_tooltip_text(
+ GnomeConfig.MARK_UNDISMISS_TOOLTIP)
self.dismissbutton.set_icon_name("gtg-task-undismiss")
elif status == Task.STA_DONE:
self.donebutton.set_label(GnomeConfig.MARK_UNDONE)
self.donebutton.set_tooltip_text(GnomeConfig.MARK_UNDONE_TOOLTIP)
self.donebutton.set_icon_name("gtg-task-undone")
self.dismissbutton.set_label(GnomeConfig.MARK_DISMISS)
- self.dismissbutton.set_tooltip_text(GnomeConfig.MARK_DISMISS_TOOLTIP)
+ self.dismissbutton.set_tooltip_text(
+ GnomeConfig.MARK_DISMISS_TOOLTIP)
self.dismissbutton.set_icon_name("gtg-task-dismiss")
else:
self.donebutton.set_label(GnomeConfig.MARK_DONE)
self.donebutton.set_tooltip_text(GnomeConfig.MARK_DONE_TOOLTIP)
self.donebutton.set_icon_name("gtg-task-done")
self.dismissbutton.set_label(GnomeConfig.MARK_DISMISS)
- self.dismissbutton.set_tooltip_text(GnomeConfig.MARK_DISMISS_TOOLTIP)
+ self.dismissbutton.set_tooltip_text(
+ GnomeConfig.MARK_DISMISS_TOOLTIP)
self.dismissbutton.set_icon_name("gtg-task-dismiss")
self.donebutton.show()
self.tasksidebar.show()
@@ -260,14 +268,14 @@
else:
self.builder.get_object("label4").hide()
self.builder.get_object("hbox4").hide()
- self.builder.get_object("label2").show()
+ self.builder.get_object("label2").show()
self.builder.get_object("hbox1").show()
#refreshing the start date field
startdate = self.task.get_start_date()
prevdate = Date.parse(self.startdate_widget.get_text())
if startdate != prevdate:
- self.startdate_widget.set_text(str(startdate))
+ self.startdate_widget.set_text(str(startdate))
#refreshing the due date field
duedate = self.task.get_due_date()
@@ -282,8 +290,8 @@
self.closeddate_widget.set_text(str(closeddate))
#refreshing the day left label
- #If the task is marked as done, we display the delay between the
- #due date and the actual closing date. If the task isn't marked
+ #If the task is marked as done, we display the delay between the
+ #due date and the actual closing date. If the task isn't marked
#as done, we display the number of days left.
if status in [Task.STA_DISMISSED, Task.STA_DONE]:
delay = self.task.get_days_late()
@@ -292,22 +300,30 @@
elif delay == 0:
txt = "Completed on time"
elif delay >= 1:
- txt = ngettext("Completed %(days)d day late", "Completed %(days)d days late", delay) % {'days': delay}
+ txt = ngettext("Completed %(days)d day late",
+ "Completed %(days)d days late",
+ delay) % {'days': delay}
elif delay <= -1:
abs_delay = abs(delay)
- txt = ngettext("Completed %(days)d day early", "Completed %(days)d days early", abs_delay) % {'days': abs_delay}
+ txt = ngettext("Completed %(days)d day early",
+ "Completed %(days)d days early",
+ abs_delay) % {'days': abs_delay}
else:
due_date = self.task.get_due_date()
result = due_date.days_left()
if due_date.is_fuzzy():
txt = ""
elif result > 0:
- txt = ngettext("Due tomorrow!", "%(days)d days left", result) % {'days': result}
+ txt = ngettext("Due tomorrow!",
+ "%(days)d days left",
+ result) % {'days': result}
elif result == 0:
txt = _("Due today!")
elif result < 0:
abs_result = abs(result)
- txt = ngettext("Due yesterday!", "Was %(days)d days ago", abs_result) % {'days': abs_result}
+ txt = ngettext("Due yesterday!",
+ "Was %(days)d days ago",
+ abs_result) % {'days': abs_result}
window_style = self.window.get_style()
color = str(window_style.text[gtk.STATE_INSENSITIVE])
self.dayleft_label.set_markup("<span color='"+color+"'>"+txt+"</span>")
@@ -333,7 +349,7 @@
if to_save:
self.light_save()
- def date_changed(self,widget,data):
+ def date_changed(self, widget, data):
text = widget.get_text()
valid = True
if not text:
@@ -412,7 +428,7 @@
for task in all_subtasks:
self.vmanager.close_task(task.get_id())
- def dismiss(self,widget): #pylint: disable-msg=W0613
+ def dismiss(self, widget): #pylint: disable-msg=W0613
stat = self.task.get_status()
if stat == "Dismiss":
self.task.set_status("Active")
@@ -422,7 +438,7 @@
self.close_all_subtasks()
self.close(None)
- def change_status(self,widget): #pylint: disable-msg=W0613
+ def change_status(self, widget): #pylint: disable-msg=W0613
stat = self.task.get_status()
if stat == "Done":
self.task.set_status("Active")
@@ -441,7 +457,7 @@
self.vmanager.ask_delete_tasks([self.task.get_id()])
#Take the title as argument and return the subtask ID
- def new_subtask(self,title=None,tid=None):
+ def new_subtask(self, title=None, tid=None):
if tid:
self.task.add_child(tid)
elif title:
@@ -456,25 +472,25 @@
task_id = task.get_id()
self.vmanager.open_task(task_id)
- def insert_subtask(self,widget): #pylint: disable-msg=W0613
+ def insert_subtask(self, widget): #pylint: disable-msg=W0613
self.textview.insert_newtask()
self.textview.grab_focus()
- def inserttag_clicked(self,widget): #pylint: disable-msg=W0613
+ def inserttag_clicked(self, widget): #pylint: disable-msg=W0613
itera = self.textview.get_insert()
if itera.starts_line():
- self.textview.insert_text("@",itera)
+ self.textview.insert_text("@", itera)
else:
- self.textview.insert_text(" @",itera)
+ self.textview.insert_text(" @", itera)
self.textview.grab_focus()
- def inserttag(self,widget,tag): #pylint: disable-msg=W0613
+ def inserttag(self, widget, tag): #pylint: disable-msg=W0613
self.textview.insert_tags([tag])
self.textview.grab_focus()
def save(self):
self.task.set_title(self.textview.get_title())
- self.task.set_text(self.textview.get_text())
+ self.task.set_text(self.textview.get_text())
self.task.sync()
if self.config != None:
self.config.write()
@@ -493,22 +509,22 @@
if tosave:
self.save()
- #This will bring the Task Editor to front
+ #This will bring the Task Editor to front
def present(self):
self.window.present()
- def move(self,x,y):
+ def move(self, x, y):
try:
xx=int(x)
yy=int(y)
- self.window.move(xx,yy)
+ self.window.move(xx, yy)
except:
pass
def get_position(self):
return self.window.get_position()
- def on_move(self,widget,event):
+ def on_move(self, widget, event):
#saving the position
if self.config != None:
tid = self.task.get_id()
@@ -519,17 +535,18 @@
self.config[tid]["size"] = self.window.get_size()
#We define dummy variable for when close is called from a callback
- def close(self,window=None,a=None,b=None,c=None): #pylint: disable-msg=W0613
+ def close(self, window=None, a=None, b=None, c=None):
+ #pylint: disable-msg=W0613
#We should also destroy the whole taskeditor object.
if self.window:
self.window.destroy()
self.window = None
- #The destroy signal is linked to the "close" button. So if we call
- #destroy in the close function, this will cause the close to be called twice
+ #The destroy signal is linked to the "close" button. So if we call destroy
+ #in the close function, this will cause the close to be called twice
#To solve that, close will just call "destroy" and the destroy signal
#Will be linked to this destruction method that will save the task
- def destruction(self,a=None):
+ def destruction(self, a=None):
#Save should be also called when buffer is modified
self.pengine.onTaskClose(self.plugin_api)
self.pengine.remove_api(self.plugin_api)
=== modified file 'GTG/gtk/editor/taskview.py'
--- GTG/gtk/editor/taskview.py 2012-05-20 19:05:20 +0000
+++ GTG/gtk/editor/taskview.py 2012-06-23 11:09:19 +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/>.
# -----------------------------------------------------------------------------
-
-
"""
This class implements a gtk.TextView but with many other features
like hyperlink and other stuff special for GTG
@@ -40,10 +38,10 @@
from GTG.gtk.editor import taskviewserial
from GTG.tools import urlregex
-separators = [' ', ',', '\n', '\t', '!', '?', ';', '\0','(',')']
+separators = [' ', ',', '\n', '\t', '!', '?', ';', '\0', '(', ')']
#those separators are only separators if followed by a space. Else, they
#are part of the word
-specials_separators = ['.','/']
+specials_separators = ['.', '/']
bullet1_ltr = '→'
bullet1_rtl = '←'
@@ -83,7 +81,8 @@
raise AttributeError('unknown property %s' % prop.name)
#Yes, we want to redefine the buffer. Disabling pylint on that error.
- def __init__(self, requester, clipboard, buffer=None): #pylint: disable-msg=W0622
+ def __init__(self, requester, clipboard, buffer=None):
+ #pylint: disable-msg=W0622
gtk.TextView.__init__(self, buffer)
self.buff = self.get_buffer()
self.req = requester
@@ -94,11 +93,11 @@
self.failedlink = {'background': 'white', 'foreground': '#ff5454', \
'underline': pango.UNDERLINE_NONE, \
'strikethrough': False}
- self.done = {'background': 'white', 'foreground': 'gray',\
+ self.done = {'background': 'white', 'foreground': 'gray',\
'strikethrough': True}
self.active = {'background': 'light gray', 'foreground': '#ff1e00',\
'underline': pango.UNDERLINE_SINGLE}
- self.hover = {'background': 'light gray'}
+ self.hover = {'background': 'light gray'}
self.tag = {'background': "#FFea00", 'foreground': 'black'}
self.indent = {'scale': 1.4, 'editable': False, 'left-margin': 10,
"accumulative-margin": True}
@@ -108,7 +107,7 @@
# but set in self.modified)
self.table = self.buff.get_tag_table()
# Tag for title
- self.title_tag = self.buff.create_tag("title", foreground="#007bff", \
+ self.title_tag = self.buff.create_tag("title", foreground="#007bff",\
scale=1.6, underline=1)
self.title_tag.set_property("pixels-above-lines", 10)
self.title_tag.set_property("pixels-below-lines", 10)
@@ -129,9 +128,10 @@
e: self.table.foreach(self.__tag_reset, e.window))
self.insert_sigid = self.buff.connect('insert-text', \
self._insert_at_cursor)
- self.delete_sigid = self.buff.connect("delete-range", self._delete_range)
- self.connect('copy-clipboard', self.copy_clipboard,"copy")
- self.connect('cut-clipboard', self.copy_clipboard,"cut")
+ self.delete_sigid = self.buff.connect("delete-range",
+ self._delete_range)
+ self.connect('copy-clipboard', self.copy_clipboard, "copy")
+ self.connect('cut-clipboard', self.copy_clipboard, "cut")
self.connect('paste-clipboard', self.paste_clipboard)
self.connect('drag-data-received', self.drag_receive)
@@ -146,8 +146,10 @@
self.mime_type = 'application/x-gtg-task'
serializer = taskviewserial.Serializer()
unserializer = taskviewserial.Unserializer(self)
- self.buff.register_serialize_format(self.mime_type, serializer.serialize, None)
- self.buff.register_deserialize_format(self.mime_type, unserializer.unserialize, None)
+ self.buff.register_serialize_format(self.mime_type,
+ serializer.serialize, None)
+ self.buff.register_deserialize_format(self.mime_type,
+ unserializer.unserialize, None)
#The list of callbacks we have to set
self.remove_tag_callback = None
@@ -156,7 +158,7 @@
self.get_subtasks = None
self.remove_subtask =None
self.__refresh_cb = None # refresh the editor window
- self.open_task = None # open another task
+ self.open_task = None # open another task
self.new_subtask_callback = None # create a subtask
self.save_task = None #This will save the task without refreshing all
@@ -185,7 +187,8 @@
#editable means that the user can edit the taskview
#this is initially set at False and then to True once the editor window
#is displayed.
- #this is used to avoid saving the task when the window is still not displayed
+ #this is used to avoid saving the task when the window is still
+ #not displayed
def set_editable(self, boule):
self.editable = boule
@@ -270,7 +273,8 @@
#reconnect
if reconnect_insert:
- self.insert_sigid = self.buff.connect('insert-text', self._insert_at_cursor)
+ self.insert_sigid = self.buff.connect('insert-text',
+ self._insert_at_cursor)
if reconnect_modified:
self.modified_sigid = self.buff.connect("changed", self.modified)
@@ -308,7 +312,6 @@
else:
return True
-
def create_anchor_tag(self, b, anchor, text=None, typ=None):
#We cannot have two tags with the same name
#That's why the link tag has no name
@@ -326,7 +329,8 @@
if linktype == 'link' and not self.check_link(anchor):
linktype = 'failedlink'
- tag = b.create_tag(None, **self.get_property(linktype)) #pylint: disable-msg=W0142
+ tag = b.create_tag(None, **self.get_property(linktype))
+ #pylint: disable-msg=W0142
tag.set_data('is_anchor', True)
tag.set_data('link', anchor)
if typ:
@@ -349,7 +353,8 @@
if ss.begins_tag(t) and ee.ends_tag(t):
already = True
if not texttag:
- texttag = buff.create_tag(None,**self.get_property('tag'))#pylint: disable-msg=W0142
+ texttag = buff.create_tag(None, **self.get_property('tag'))
+ #pylint: disable-msg=W0142
texttag.set_data('is_tag', True)
texttag.set_data('tagname', tag)
#This one is for marks
@@ -371,7 +376,8 @@
tex = buff.get_text(i_s, i_e)
if len(tex) > 0:
self.req.get_task(subtask).set_title(tex)
- texttag = self.create_anchor_tag(buff, subtask, text=tex, typ="subtask")
+ texttag = self.create_anchor_tag(buff, subtask, text=tex,
+ typ="subtask")
texttag.set_data('is_subtask', True)
texttag.set_data('child', subtask)
#This one is for marks
@@ -382,7 +388,8 @@
buff.delete_mark(e)
def create_indent_tag(self, buff, level):
- tag = buff.create_tag(None, **self.get_property('indent'))#pylint: disable-msg=W0142
+ tag = buff.create_tag(None, **self.get_property('indent'))
+ #pylint: disable-msg=W0142
tag.set_data('is_indent', True)
tag.set_data('indent_level', level)
return tag
@@ -409,10 +416,12 @@
if tt.get_data('is_tag'):
newline = False
firstline.forward_to_line_end()
- #Now we should check if the current char is a separator or not
+ #Now we should check if the current char
+ #is a separator or not
#Currently, we insert a space
self.insert_text(" ", firstline)
- #Now we check if this newline is empty (it contains only " " and ",")
+ #Now we check if this newline is empty
+ #(it contains only " " and ",")
# if newline:
# endline = firstline.copy()
# if not endline.ends_line():
@@ -434,7 +443,7 @@
ntags = ntags - 1
self.insert_at_mark(self.buff, line_mark, t)
if ntags != 0:
- self.insert_at_mark(self.buff, line_mark,",")
+ self.insert_at_mark(self.buff, line_mark, ",")
self.buff.delete_mark(line_mark)
self.modified(full=True)
@@ -490,7 +499,7 @@
stripped = title.strip(' \n\t')
return stripped
-### PRIVATE FUNCTIONS ##########################################################
+### PRIVATE FUNCTIONS #######################################################
#This function is called so frequently that we should optimize it more.
@@ -538,7 +547,9 @@
#subt_list = self.get_subtasks()
#First, we remove the olds tags
tag_list = []
- def subfunc(texttag, data=None): #pylint: disable-msg=W0613
+
+ def subfunc(texttag, data=None):
+ #pylint: disable-msg=W0613
if texttag.get_data('is_subtask'):
tag_list.append(texttag)
table.foreach(subfunc)
@@ -581,8 +592,10 @@
def _detect_url(self, buff, start, end):
#subt_list = self.get_subtasks()
#First, we remove the olds tags
+
tag_list = []
table = buff.get_tag_table()
+
def subfunc(texttag, data=None):
if texttag.get_data('is_anchor'):
tag_list.append(texttag)
@@ -592,7 +605,7 @@
#Now we add the tag URL
it = start.copy()
prev = start.copy()
- while (it.get_offset() < end.get_offset()) and (it.get_char() != '\0'):
+ while(it.get_offset() < end.get_offset()) and (it.get_char() != '\0'):
it.forward_word_end()
prev = it.copy()
prev.backward_word_start()
@@ -606,7 +619,8 @@
# For short URL we must add http:// prefix
if text == "www":
url = "http://" + url
- texttag = self.create_anchor_tag(buff, url, text=None, typ="http")
+ texttag = self.create_anchor_tag(buff, url,
+ text=None, typ="http")
it = prev.copy()
it.forward_chars(m.end())
buff.apply_tag(texttag, prev, it)
@@ -624,11 +638,14 @@
if url.startswith("bug #") or url.startswith("lp #"):
topoint = "https://launchpad.net/bugs/%s" %nbr
elif url.startswith("bgo #"):
- topoint = "http://bugzilla.gnome.org/show_bug.cgi?id=%s" %nbr
+ topoint = "http://bugzilla.gnome.org/show_bug.cgi?\
+ id=%s" %nbr
elif url.startswith("bko #"):
- topoint = "https://bugs.kde.org/show_bug.cgi?id=%s" %nbr
+ topoint = "https://bugs.kde.org/show_bug.cgi?id=%s"\
+ %nbr
elif url.startswith("fdo #"):
- topoint = "http://bugs.freedesktop.org/show_bug.cgi?id=%s" %nbr
+ topoint = "http://bugs.freedesktop.org/show_bug.cgi?\
+ id=%s" %nbr
if topoint:
texttag = self.create_anchor_tag(buff,\
topoint, text=None, typ="http")
@@ -645,7 +662,7 @@
new_tags = []
#We must be strictly < than the end_offset. If not, we might
#find the beginning of a tag on the nextline
- while (it.get_offset() < end.get_offset()) and (it.get_char() != '\0'):
+ while(it.get_offset() < end.get_offset()) and (it.get_char() != '\0'):
if it.begins_tag():
tags = it.get_toggled_tags(True)
for ta in tags:
@@ -658,30 +675,34 @@
#Removing the marks if they exist
mark1 = buff.get_mark(tagname)
if mark1:
- offset1 = buff.get_iter_at_mark(mark1).get_offset()
- if start.get_offset() <= offset1 <= end.get_offset():
+ iterator = buff.get_iter_at_mark(mark1)
+ offset1 = iterator.get_offset()
+ if start.get_offset() <= offset1 <= \
+ end.get_offset():
buff.delete_mark_by_name(tagname)
mark2 = buff.get_mark("/%s"%tagname)
if mark2:
- offset2 = buff.get_iter_at_mark(mark2).get_offset()
- if start.get_offset() <= offset2 <= end.get_offset():
+ iterator = buff.get_iter_at_mark(mark2)
+ offset2 = iterator.get_offset()
+ if start.get_offset() <= offset2 <= \
+ end.get_offset():
buff.delete_mark_by_name("/%s"%tagname)
it.forward_char()
# Set iterators for word
word_start = start.copy()
- word_end = start.copy()
+ word_end = start.copy()
# Set iterators for char
char_start = start.copy()
- char_end = start.copy()
+ char_end = start.copy()
char_end.forward_char()
last_char = None
# Iterate over characters of the line to get words
while char_end.compare(end) <= 0:
do_word_check = False
- my_char = buff.get_text(char_start, char_end)
+ my_char = buff.get_text(char_start, char_end)
if my_char not in separators:
last_char = my_char
word_end = char_end.copy()
@@ -707,7 +728,8 @@
#and it shouldn't start with @@ (bug 531553)
if len(my_word) > 1 and my_word[0] == '@' \
and not my_word[1] == '@':
- #self.apply_tag_tag(buff, my_word, word_start, word_end)
+ #self.apply_tag_tag(buff, my_word,
+ # word_start, word_end)
#We will add mark where tag should be applied
buff.create_mark(my_word, word_start, True)
buff.create_mark("/%s"%my_word, word_end, False)
@@ -718,7 +740,7 @@
# We set new word boundaries
word_start = char_end.copy()
- word_end = char_end.copy()
+ word_end = char_end.copy()
# Stop loop if we are at the end
if char_end.compare(end) == 0:
@@ -768,7 +790,7 @@
# buff.remove_tag(ta, start, endindent)
#Now we delete all, char after char
it = start.copy()
- while (it.get_offset() <= end.get_offset()) and (it.get_char() != '\0'):
+ while(it.get_offset() <= end.get_offset()) and (it.get_char() != '\0'):
if it.begins_tag():
tags = it.get_tags()
for ta in tags:
@@ -798,7 +820,8 @@
#now we really delete the selected stuffs
selec = self.buff.get_selection_bounds()
# if selec:
-# print "deleted text is ##%s##" %self.buff.get_text(selec[0], selec[1])#(start, end)
+# print "deleted text is ##%s##"
+# %self.buff.get_text(selec[0], selec[1])#(start, end)
# self.buff.disconnect(self.delete_sigid)
# self.disconnect(self.backspace_sigid)
# self.buff.stop_emission("delete-range")
@@ -807,16 +830,18 @@
# else:
# end.forward_char()
# self.buff.backspace(end, False, True)
-# self.delete_sigid = self.buff.connect("delete-range", self._delete_range)
+# self.delete_sigid = self.buff.connect("delete-range",
+# self._delete_range)
# self.backspace_sigid = self.connect("backspace", self.backspace)
#We return false so the parent still get the signal
return False
- #Apply the title and return an iterator after that title.buff.get_iter_at_mar
+ #Apply the title and return an iterator after that
+ #title.buff.get_iter_at_mar
def _apply_title(self, buff, refresheditor=True):
- start = buff.get_start_iter()
- end = buff.get_end_iter()
- line_nbr = 1
+ start = buff.get_start_iter()
+ end = buff.get_end_iter()
+ line_nbr = 1
linecount = buff.get_line_count()
# Apply the title tag on the first line
@@ -828,14 +853,14 @@
# Applying title on the first line
title_end = buff.get_iter_at_line(line_nbr-1)
title_end.forward_to_line_end()
- stripped = buff.get_text(title_start, title_end).strip('\n\t ')
+ stripped = buff.get_text(title_start, title_end).strip('\n\t ')
# Here we ignore lines that are blank
# Title is the first written line
while line_nbr <= linecount and not stripped:
- line_nbr += 1
- title_end = buff.get_iter_at_line(line_nbr-1)
+ line_nbr += 1
+ title_end = buff.get_iter_at_line(line_nbr-1)
title_end.forward_to_line_end()
- stripped = buff.get_text(title_start, title_end).strip('\n\t ')
+ stripped = buff.get_text(title_start, title_end).strip('\n\t ')
# Or to all the buffer if there is only one line
else:
title_end = end.copy()
@@ -846,8 +871,6 @@
self.refresh(buff.get_text(title_start, title_end).strip('\n\t'))
return title_end
-
-
def __newsubtask(self, buff, title, line_nbr, level=1):
anchor = self.new_subtask_callback(title)
end_i = self.write_subtask(buff, line_nbr, anchor, level=level)
@@ -875,10 +898,10 @@
#be in the subtask title
start_i = buff.get_iter_at_line(line_nbr)
start_i.forward_to_line_end()
- buff.insert(start_i,"\n")
+ buff.insert(start_i, "\n")
#Ok, now we can start working
start_i = buff.get_iter_at_line(line_nbr)
- end_i = start_i.copy()
+ end_i = start_i.copy()
#We go back at the end of the previous line
# start_i.backward_char()
# #But only if this is not the title.
@@ -886,9 +909,9 @@
# if start_i.has_tag(self.title_tag):
# start_i.forward_char()
# insert_enter = False
- start = buff.create_mark("start", start_i, True)
+ start = buff.create_mark("start", start_i, True)
end_i.forward_line()
- end = buff.create_mark("end", end_i, False)
+ end = buff.create_mark("end", end_i, False)
buff.delete(start_i, end_i)
start_i = buff.get_iter_at_mark(start)
self.insert_indent(buff, start_i, level, enter=insert_enter)
@@ -905,7 +928,8 @@
#buff.delete_mark(end)
if reconnect_insert:
- self.insert_sigid = self.buff.connect('insert-text', self._insert_at_cursor)
+ self.insert_sigid = self.buff.connect('insert-text',
+ self._insert_at_cursor)
if reconnect_modified:
self.modified_sigid = self.buff.connect("changed", self.modified)
return end_i
@@ -936,7 +960,7 @@
if line == self.buff.get_line_count():
itera.forward_to_line_end()
mark = self.buff.create_mark(None, itera, True)
- self.buff.insert(itera,"\n")
+ self.buff.insert(itera, "\n")
itera = self.buff.get_iter_at_mark(mark)
self.buff.delete_mark(mark)
@@ -946,7 +970,7 @@
enter = True
if itera.starts_line():
mark = self.buff.create_mark(None, itera, True)
- self.buff.insert(itera,"\n")
+ self.buff.insert(itera, "\n")
itera = self.buff.get_iter_at_mark(mark)
self.buff.delete_mark(mark)
enter = False
@@ -977,9 +1001,9 @@
#It will be later replaced by the good one with right gravity
temp_mark = self.buff.create_mark("temp", start_i, True)
- end = buff.create_mark("end", start_i, False)
+ end = buff.create_mark("end", start_i, False)
if enter:
- buff.insert(start_i,"\n")
+ buff.insert(start_i, "\n")
#Moving the end of subtask mark to the position of the temp mark
if stag:
@@ -994,7 +1018,7 @@
#This is normally not needed and purely defensive
if itera.get_line() <= 0:
itera = buff.get_iter_at_line(1)
- start = buff.create_mark("start", itera, True)
+ start = buff.create_mark("start", itera, True)
indentation = ""
#adding two spaces by level
spaces = " "
@@ -1007,7 +1031,6 @@
self.__apply_tag_to_mark(start, end, tag=indenttag)
return end
-
def __apply_tag_to_mark(self, start, end, tag=None, name=None):
start_i = self.buff.get_iter_at_mark(start)
end_i = self.buff.get_iter_at_mark(end)
@@ -1027,9 +1050,8 @@
else:
buff.insert(ite, text)
-
def _get_indent_level(self, itera):
- line_nbr = itera.get_line()
+ line_nbr = itera.get_line()
start_line = itera.copy()
start_line.set_line(line_nbr)
tags = start_line.get_tags()
@@ -1046,10 +1068,10 @@
#First, we analyse the selection to put in our own
#GTG clipboard a selection with description of subtasks
- bounds = self.buff.get_selection_bounds()
+ bounds = self.buff.get_selection_bounds()
if not bounds:
return
- start, stop = self.buff.get_selection_bounds()
+ start, stop = self.buff.get_selection_bounds()
self.clipboard.copy(start, stop, bullet=self.bullet1)
@@ -1105,10 +1127,10 @@
#First, we will get the actual indentation value
#The nbr just before the \n
- line_nbr = itera.get_line()
+ line_nbr = itera.get_line()
start_line = itera.copy()
start_line.set_line(line_nbr)
- end_line = itera.copy()
+ end_line = itera.copy()
tags = start_line.get_tags()
subtask_nbr = None
current_indent = self._get_indent_level(itera)
@@ -1157,24 +1179,28 @@
#the "-" might be after a space
#Python 2.5 should allow both tests in one
if current_indent == 0:
- if (line.startswith('-') or line.startswith(' -')) and line.lstrip(' -').strip() != "":
+ if (line.startswith('-') or line.startswith(' -')) \
+ and line.lstrip(' -').strip() != "":
line = line.lstrip(' -')
- end_i = self.__newsubtask(self.buff, line, line_nbr)
+ end_i = self.__newsubtask(self.buff,
+ line, line_nbr)
#Here, we should increment indent level
#If we inserted enter in the middle of a line
if restofline and restofline.strip() != "":
#it means we have two subtask to create
if self.buff.get_line_count() > line_nbr+1:
#but don't merge with the next line
- itera = self.buff.get_iter_at_line(line_nbr+1)
- self.buff.insert(itera,"\n\n")
+ buff = self.buff
+ itera = buff.get_iter_at_line(line_nbr+1)
+ self.buff.insert(itera, "\n\n")
self.__newsubtask(self.buff, restofline,\
line_nbr+1)
else:
- self.insert_indent(self.buff, end_i, 1, enter=True)
+ self.insert_indent(self.buff, end_i,
+ 1, enter=True)
tv.emit_stop_by_name('insert-text')
else:
- self.buff.insert(itera,"\n")
+ self.buff.insert(itera, "\n")
tv.emit_stop_by_name('insert-text')
#Then, if indent > 0, we increment it
@@ -1191,22 +1217,26 @@
else:
#we first put the subtask one line below
itera2 = self.buff.get_iter_at_line(line_nbr)
- self.buff.insert(itera2,"\n")
+ self.buff.insert(itera2, "\n")
#and increment the new white line
itera2 = self.buff.get_iter_at_line(line_nbr)
- self.insert_indent(self.buff, itera2, current_indent, enter=False)
+ self.insert_indent(self.buff, itera2,
+ current_indent, enter=False)
elif current_indent == 1:
- self.insert_indent(self.buff, itera, current_indent)
+ self.insert_indent(self.buff, itera,
+ current_indent)
#we stop the signal in all cases
tv.emit_stop_by_name('insert-text')
#Then we close the tag tag
if closed_tag:
insert_mark = self.buff.get_mark("insert_point")
insert_iter = self.buff.get_iter_at_mark(insert_mark)
- self.buff.move_mark_by_name("/%s"%closed_tag, insert_iter)
+ self.buff.move_mark_by_name("/%s"%closed_tag,
+ insert_iter)
self.buff.delete_mark(insert_mark)
if cutting_subtask:
- cursor = self.buff.get_iter_at_mark(self.buff.get_insert())
+ mark = self.buff.get_insert()
+ cursor = self.buff.get_iter_at_mark(mark)
endl = cursor.copy()
if not endl.ends_line():
endl.forward_to_line_end()
@@ -1222,7 +1252,7 @@
if itera.starts_line():
#we are at the start of an existing subtask
#we simply move that subtask down
- self.buff.insert(itera,"\n")
+ self.buff.insert(itera, "\n")
itera2 = self.buff.get_iter_at_line(line_nbr)
self.buff.insert(itera2, tex)
itera3 = self.buff.get_iter_at_line(line_nbr)
@@ -1230,25 +1260,28 @@
self.buff.place_cursor(itera3)
tv.emit_stop_by_name('insert-text')
else:
- #self.__newsubtask(self.buff, tex, line_nbr, level=current_indent)
+ #self.__newsubtask(self.buff, tex, line_nbr,
+ # level=current_indent)
anchor = self.new_subtask_callback(tex)
self.buff.create_mark(anchor, itera, True)
self.buff.create_mark("/%s"%anchor, itera, False)
- self.insert_sigid = self.buff.connect('insert-text', self._insert_at_cursor)
+ self.insert_sigid = self.buff.connect('insert-text',
+ self._insert_at_cursor)
self.connect('key_press_event', self._keypress)
self.modified_sigid = self.buff.connect("changed", self.modified)
def _keypress(self, widget, event):
# Check for Ctrl-Return/Enter
- if event.state & gtk.gdk.CONTROL_MASK and event.keyval in (gtk.keysyms.Return, gtk.keysyms.KP_Enter):
+ if event.state & gtk.gdk.CONTROL_MASK and event.keyval in \
+ (gtk.keysyms.Return, gtk.keysyms.KP_Enter):
buff = self.buff
cursor_mark = buff.get_insert()
cursor_iter = buff.get_iter_at_mark(cursor_mark)
local_start = cursor_iter.copy()
for tag in local_start.get_tags():
- anchor = tag.get_data('link')
- typ = tag.get_data('type')
+ anchor = tag.get_data('link')
+ typ = tag.get_data('type')
if(anchor):
if typ == "subtask":
self.open_task(anchor)
@@ -1284,7 +1317,6 @@
#newiter = self.buff.get_iter_at_mark(tempm)
#self.buff.delete_mark(tempm)
#self.insert_indent(self.buff, newiter, newlevel, enter=False)
-
def backspace(self, tv):
self.buff.disconnect(self.insert_sigid)
insert_mark = self.buff.get_insert()
@@ -1319,7 +1351,8 @@
tag_table.foreach(self.__tag_reset, window)
#We clicked on a link
- def _tag_event(self, tag, view, ev, _iter, text, anchor, typ): #pylint: disable-msg=W0613
+ def _tag_event(self, tag, view, ev, _iter, text, anchor, typ):
+ #pylint: disable-msg=W0613
_type = ev.type
if _type == gtk.gdk.MOTION_NOTIFY:
return
@@ -1330,14 +1363,17 @@
if typ == "subtask":
self.open_task(anchor)
elif typ == "http":
- if button == 1 and self.check_link(anchor) and self.buff.get_has_selection() == False:
+ if button == 1 and self.check_link(anchor) and\
+ self.buff.get_has_selection() == False:
openurl(anchor)
else:
print "Unknown link type for %s" %anchor
self.emit('anchor-clicked', text, anchor, button)
- self.__set_anchor(ev.window, tag, cursor, self.get_property('hover'))
+ self.__set_anchor(ev.window, tag, cursor,
+ self.get_property('hover'))
elif button in [1, 2]:
- self.__set_anchor(ev.window, tag, cursor, self.get_property('active'))
+ self.__set_anchor(ev.window, tag, cursor,
+ self.get_property('active'))
def __tag_reset(self, tag, window):
if tag.get_data('is_anchor'):
@@ -1351,7 +1387,8 @@
linktype = 'link'
else:
linktype = 'failedlink'
- self.__set_anchor(window, tag, editing_cursor, self.get_property(linktype))
+ self.__set_anchor(window, tag, editing_cursor,
+ self.get_property(linktype))
def __set_anchor(self, window, tag, cursor, prop):
window.set_cursor(cursor)
=== modified file 'GTG/gtk/editor/taskviewserial.py'
--- GTG/gtk/editor/taskviewserial.py 2012-05-01 11:04:39 +0000
+++ GTG/gtk/editor/taskviewserial.py 2012-06-23 11:09:19 +0000
@@ -107,8 +107,8 @@
elif ta.get_data('is_subtask'):
#The current gtkTextTag is a subtask
tagname = "subtask"
- subt = doc.createElement(tagname)
- target = ta.get_data('child')
+ subt = doc.createElement(tagname)
+ target = ta.get_data('child')
subt.appendChild(doc.createTextNode(target))
parent.appendChild(subt)
parent.appendChild(doc.createTextNode("\n"))
@@ -187,7 +187,7 @@
#parse the XML and put the content in the buffer
def parsexml(self, buf, ite, element):
start = buf.create_mark(None, ite, True)
- end = buf.create_mark(None, ite, False)
+ end = buf.create_mark(None, ite, False)
subtasks = self.tv.get_subtasks()
taglist2 = []
if element:
=== modified file 'GTG/gtk/manager.py'
--- GTG/gtk/manager.py 2012-05-31 23:56:54 +0000
+++ GTG/gtk/manager.py 2012-06-23 11:09:19 +0000
@@ -32,7 +32,7 @@
import GTG
from GTG.gtk.delete_dialog import DeletionUI
from GTG.gtk.browser.browser import TaskBrowser
-from GTG.gtk.editor.editor import TaskEditor
+from GTG.gtk.editor.editor import TaskEditor
from GTG.gtk.preferences import PreferencesDialog
from GTG.gtk.plugins import PluginsDialog
from GTG.gtk.dbuswrapper import DBusTaskWrapper
@@ -46,7 +46,7 @@
class Manager(object):
-
+
############## init #####################################################
def __init__(self, req):
@@ -54,12 +54,12 @@
self.config_obj = self.req.get_global_config()
self.config = self.config_obj.conf_dict
self.task_config = self.config_obj.task_conf_dict
-
+
# Editors
- self.opened_task = {} # This is the list of tasks that are already
+ self.opened_task = {} # This is the list of tasks that are already
# opened in an editor of course it's empty
# right now
-
+
self.browser = None
self.__start_browser_hidden = False
self.gtk_terminate = False #if true, the gtk main is not started
@@ -67,21 +67,21 @@
# if true, closing the last window doesn't quit GTG
# (GTG lives somewhere else without GUI, e.g. notification area)
self.daemon_mode = False
-
+
#Shared clipboard
self.clipboard = clipboard.TaskClipboard(self.req)
#Browser (still hidden)
self.browser = TaskBrowser(self.req, self)
-
+
self.__init_plugin_engine()
-
+
if not self.__start_browser_hidden:
self.show_browser()
-
+
#Deletion UI
self.delete_dialog = None
-
+
#Preferences and Backends windows
# Initialize dialogs
self.preferences = PreferencesDialog(self.req)
@@ -90,11 +90,11 @@
# Tag Editor
self.tag_editor_dialog = None
-
+
#DBus
DBusTaskWrapper(self.req, self)
Log.debug("Manager initialization finished")
-
+
def __init_plugin_engine(self):
self.pengine = PluginEngine(GTG.PLUGIN_DIR)
# initializes the plugin api class
@@ -109,9 +109,8 @@
plugin.enabled = plugin.module_name in plugins_enabled
# initializes and activates each plugin (that is enabled)
self.pengine.activate_plugins()
-
+
############## Browser #################################################
-
def open_browser(self):
if not self.browser:
self.browser = TaskBrowser(self.req, self)
@@ -120,24 +119,24 @@
#FIXME : the browser should not be the center of the universe.
# In fact, we should build a system where view can register themselves
# as "stay_alive" views. As long as at least one "stay_alive" view
- # is registered, gtg keeps running. It quit only when the last
+ # is registered, gtg keeps running. It quit only when the last
# "stay_alive view" is closed (and then unregistered).
# Currently, the browser is our only "stay_alive" view.
- def close_browser(self,sender=None):
+ def close_browser(self, sender=None):
self.hide_browser()
#may take a while to quit
self.quit()
- def hide_browser(self,sender=None):
+ def hide_browser(self, sender=None):
self.browser.hide()
- def iconify_browser(self,sender=None):
+ def iconify_browser(self, sender=None):
self.browser.iconify()
- def show_browser(self,sender=None):
+ def show_browser(self, sender=None):
self.browser.show()
-
- def is_browser_visible(self,sender=None):
+
+ def is_browser_visible(self, sender=None):
return self.browser.is_visible()
def get_browser(self):
@@ -153,7 +152,6 @@
self.daemon_mode = in_daemon_mode
################# Task Editor ############################################
-
def get_opened_editors(self):
'''
Returns a dict of task_uid -> TaskEditor, one for each opened editor
@@ -192,13 +190,13 @@
def close_task(self, tid):
# When an editor is closed, it should de-register itself.
if tid in self.opened_task:
- #the following line has the side effect of removing the
+ #the following line has the side effect of removing the
# tid key in the opened_task dictionary.
editor = self.opened_task[tid]
if editor:
del self.opened_task[tid]
#we have to remove the tid from opened_task first
- #else, it close_task would be called once again
+ #else, it close_task would be called once again
#by editor.close
editor.close()
if tid in self.config["browser"]["opened_tasks"]:
@@ -210,12 +208,12 @@
'''
checking if we need to shut down the whole GTG (if no window is open)
'''
- if not self.daemon_mode and not self.is_browser_visible() and not self.opened_task:
+ if not self.daemon_mode and not self.is_browser_visible() \
+ and not self.opened_task:
#no need to live"
self.quit()
-
+
################ Others dialog ############################################
-
def open_edit_backends(self, sender = None, backend_id = None):
if not self.edit_backends_dialog:
self.edit_backends_dialog = BackendsDialog(self.req)
@@ -231,7 +229,7 @@
def configure_plugins(self):
self.plugins.activate()
-
+
def ask_delete_tasks(self, tids):
if not self.delete_dialog:
self.delete_dialog = DeletionUI(self.req)
@@ -252,7 +250,6 @@
self.tag_editor_dialog.hide()
### URIS ###################################################################
-
def open_uri_list(self, unused, uri_list):
'''
Open the Editor windows of the tasks associated with the uris given.
@@ -264,9 +261,9 @@
#if no window was opened, we just quit
self.check_quit_condition()
-
+
### MAIN ###################################################################
- def main(self, once_thru = False, uri_list = []):
+ def main(self, once_thru = False, uri_list = []):
if uri_list:
#before opening the requested tasks, we make sure that all of them
#are loaded.
@@ -282,16 +279,16 @@
else:
gtk.main()
return 0
-
- def quit(self,sender=None):
+
+ def quit(self, sender=None):
gtk.main_quit()
#save opened tasks and their positions.
open_task = []
- for otid in self.opened_task.keys():
+ for otid in self.opened_task.keys():
open_task.append(otid)
self.opened_task[otid].close()
self.config["browser"]["opened_tasks"] = open_task
-
+
# adds the plugin settings to the conf
#FIXME: this code is replicated in the preference window.
if len(self.pengine.plugins) > 0:
@@ -302,4 +299,3 @@
[p.module_name for p in self.pengine.get_plugins("enabled")]
# plugins are deactivated
self.pengine.deactivate_plugins()
-
=== modified file 'GTG/tools/borg.py'
--- GTG/tools/borg.py 2012-03-05 15:23:05 +0000
+++ GTG/tools/borg.py 2012-06-23 11:09:19 +0000
@@ -17,7 +17,6 @@
# this program. If not, see <http://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------------
-
class Borg(object):
"""
This pattern ensures that all instances of a particular class share
@@ -25,6 +24,6 @@
"""
_borg_state = {}
-
+
def __init__(self):
self.__dict__ = self._borg_state
=== modified file 'GTG/tools/cleanxml.py'
--- GTG/tools/cleanxml.py 2012-05-01 15:53:24 +0000
+++ GTG/tools/cleanxml.py 2012-06-23 11:09:19 +0000
@@ -17,7 +17,8 @@
# this program. If not, see <http://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------------
-import os, xml.dom.minidom
+import os
+import xml.dom.minidom
import shutil
import sys
import time
@@ -32,17 +33,19 @@
BACKUP_NBR = 7
#Those two functions are there only to be able to read prettyXML
-#Source : http://yumenokaze.free.fr/?/Informatique/Snipplet/Python/cleandom
-def cleanDoc(document,indent="",newl=""):
+#Source : http://yumenokaze.free.fr/?/Informatique/Snipplet/Python/cleandom
+
+def cleanDoc(document, indent="", newl=""):
node = document.documentElement
- cleanNode(node,indent,newl)
-
-def cleanNode(currentNode,indent,newl):
+ cleanNode(node, indent, newl)
+
+
+def cleanNode(currentNode, indent, newl):
myfilter = indent+newl
if currentNode.hasChildNodes:
toremove = []
for node in currentNode.childNodes:
- if node.nodeType == 3 :
+ if node.nodeType == 3:
val = node.nodeValue.lstrip(myfilter).strip(myfilter)
if val == "":
toremove.append(node)
@@ -52,36 +55,39 @@
for n in toremove:
currentNode.removeChild(n)
for node in currentNode.childNodes:
- cleanNode(node,indent,newl)
-
-def cleanString(string,indent="",newl=""):
+ cleanNode(node, indent, newl)
+
+
+def cleanString(string, indent="", newl=""):
#we will remove the pretty XML stuffs.
#Firt, we remove the \n and tab in elements
e = re.compile('>\n\t*')
- toreturn = e.sub('>',string)
+ toreturn = e.sub('>', string)
#then we remove the \n tab before closing elements
f = re.compile('\n\t*</')
- toreturn = f.sub('</',toreturn)
+ toreturn = f.sub('</', toreturn)
return toreturn
#This add a text node to the node parent. We don't return anything
#Because the doc object itself is modified.
-def addTextNode(doc,parent,title,content) :
- if content :
+
+def addTextNode(doc, parent, title, content):
+ if content:
element = doc.createElement(title)
parent.appendChild(element)
element.appendChild(doc.createTextNode(content))
-
+
#This is a method to read the textnode of the XML
-def readTextNode(node,title) :
+
+def readTextNode(node, title):
n = node.getElementsByTagName(title)
- if n and n[0].hasChildNodes() :
+ if n and n[0].hasChildNodes():
content = n[0].childNodes[0].nodeValue
- if content :
+ if content:
return content
return None
-
+
def _try_openxmlfile(zefile, root):
""" Open an XML file and clean whitespaces in it """
f = open(zefile, "r")
@@ -115,7 +121,7 @@
return _try_openxmlfile(zefile, root)
else:
# Creating empty file
- doc,xmlproject = emptydoc(root)
+ doc, xmlproject = emptydoc(root)
newfile = savexml(zefile, doc)
if not newfile:
Log.error("Could not create a new file %s" % zefile)
@@ -125,7 +131,7 @@
except IOError, msg:
print msg
sys.exit(1)
-
+
except xml.parsers.expat.ExpatError, msg:
errormsg = "Error parsing XML file %s: %s" % (zefile, msg)
Log.error(errormsg)
@@ -153,14 +159,16 @@
#Return a doc element with only one root element of the name "root"
-def emptydoc(root) :
+
+def emptydoc(root):
doc = xml.dom.minidom.Document()
rootproject = doc.createElement(root)
doc.appendChild(rootproject)
return doc, rootproject
-
+
#write a XML doc to a file
-def savexml(zefile,doc,backup=False):
+
+def savexml(zefile, doc, backup=False):
# print "writing %s file" %(zefile)
tmpfile = zefile+'__'
try:
@@ -175,27 +183,28 @@
f.close()
return False
f.close()
-
+
if os.path.exists(tmpfile):
os.unlink(tmpfile)
-
- if backup :
+
+ if backup:
#We will now backup the file
backup_nbr = BACKUP_NBR
#We keep BACKUP_NBR versions of the file
#The 0 is the youngest one
- while backup_nbr > 0 :
- older = "%s.bak.%s" %(zefile,backup_nbr)
+ while backup_nbr > 0:
+ older = "%s.bak.%s" %(zefile, backup_nbr)
backup_nbr -= 1
- newer = "%s.bak.%s" %(zefile,backup_nbr)
- if os.path.exists(newer) :
- shutil.move(newer,older)
+ newer = "%s.bak.%s" %(zefile, backup_nbr)
+ if os.path.exists(newer):
+ shutil.move(newer, older)
#The bak.0 is always a fresh copy of the closed file
#So that it's not touched in case of bad opening next time
current = "%s.bak.0" %(zefile)
- shutil.copy(zefile,current)
+ shutil.copy(zefile, current)
- daily_backup = "%s.%s.bak" % (zefile, datetime.date.today().strftime("%Y-%m-%d"))
+ daily_backup = "%s.%s.bak" % (zefile,
+ datetime.date.today().strftime("%Y-%m-%d"))
if not os.path.exists(daily_backup):
shutil.copy(zefile, daily_backup)
return True
=== modified file 'GTG/tools/clipboard.py'
--- GTG/tools/clipboard.py 2012-03-05 15:23:05 +0000
+++ GTG/tools/clipboard.py 2012-06-23 11:09:19 +0000
@@ -21,15 +21,19 @@
TaskClipboard allows to cut/copy the content of a TaskView accross multiples
taskeditors, preserving subtasks
"""
+
+
class TaskClipboard():
- def __init__(self,req):
+
+ def __init__(self, req):
self.description = None
self.content = []
self.req = req
-
+
""""take two gtk.TextIter as parameter and copy the
"""
- def copy(self,start,stop,bullet=None):
+
+ def copy(self, start, stop, bullet=None):
self.clear()
#Now, we take care of the normal, cross application clipboard
text = start.get_text(stop)
@@ -39,7 +43,7 @@
self.description = newtext
elif text:
self.description = text
-
+
end_line = start.copy()
#we take line after line in the selection
nextline = True
@@ -49,7 +53,7 @@
#we want to detect subtasks in the selection
tags = end_line.get_tags()+end_line.get_toggled_tags(False)
is_subtask = False
- for ta in tags :
+ for ta in tags:
if (ta.get_data('is_subtask')):
is_subtask = True
tid = ta.get_data('child')
@@ -59,7 +63,8 @@
self.content.append(['subtask', tid])
if not is_subtask:
if end_line.get_line() < stop.get_line():
- self.content.append(['text', "%s\n" %start.get_text(end_line)])
+ self.content.append(['text', "%s\n" \
+ %start.get_text(end_line)])
else:
self.content.append(['text', start.get_text(stop)])
end_line.forward_char()
@@ -67,10 +72,10 @@
def paste_text(self):
return self.description
-
+
def paste(self):
return self.content
-
+
def clear(self):
self.descriptiion = None
self.content = []
=== modified file 'GTG/tools/import_liblarch.py'
--- GTG/tools/import_liblarch.py 2012-05-02 10:03:02 +0000
+++ GTG/tools/import_liblarch.py 2012-06-23 11:09:19 +0000
@@ -25,6 +25,7 @@
REQUIRED_LIBLARCH_API = "1.0"
GIT_CMD = "git clone https://github.com/liblarch/liblarch ../liblarch"
+
def import_liblarch(use_local=False):
""" Check if liblarch is installed and is compatible
=== modified file 'GTG/tools/keyring.py'
--- GTG/tools/keyring.py 2012-03-05 15:23:05 +0000
+++ GTG/tools/keyring.py 2012-06-23 11:09:19 +0000
@@ -17,7 +17,6 @@
# this program. If not, see <http://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------------
-
try:
import gnomekeyring
except ImportError:
@@ -26,7 +25,9 @@
from GTG.tools.borg import Borg
from GTG.tools.logger import Log
+
class GNOMEKeyring(Borg):
+
def __init__(self):
super(Keyring, self).__init__()
if not hasattr(self, "keyring"):
@@ -48,7 +49,9 @@
except (gnomekeyring.DeniedError, gnomekeyring.NoMatchError):
return ""
+
class FallbackKeyring(Borg):
+
def __init__(self):
super(Keyring, self).__init__()
if not hasattr(self, "keyring"):
@@ -70,7 +73,8 @@
return self.keyring.get(key, "")
if gnomekeyring is not None:
- Keyring = GNOMEKeyring
+ Keyring = GNOMEKeyring
else:
- Log.info("GNOME keyring was not found, passwords will be not stored after restart of GTG")
+ Log.info("GNOME keyring was not found, passwords will be not \
+ stored after restart of GTG")
Keyring = FallbackKeyring
=== modified file 'GTG/tools/logger.py'
--- GTG/tools/logger.py 2012-05-01 15:53:24 +0000
+++ GTG/tools/logger.py 2012-06-23 11:09:19 +0000
@@ -33,7 +33,7 @@
class Debug(object):
"""Singleton class that acts as interface for GTG's logger"""
- def __init__ (self):
+ def __init__(self):
""" Configure the GTG logger """
#If we already have a logger, we keep that
if not hasattr(Debug, "__logger"):
@@ -63,6 +63,7 @@
def set_debugging_mode(self, value):
self.debugging_mode = value
+
def is_debugging_mode(self):
return self.debugging_mode
=== modified file 'GTG/tools/networkmanager.py'
--- GTG/tools/networkmanager.py 2012-03-16 23:11:31 +0000
+++ GTG/tools/networkmanager.py 2012-06-23 11:09:19 +0000
@@ -25,13 +25,14 @@
import dbus
-# A network device is connected, with global network connectivity.
+# A network device is connected, with global network connectivity.
NM_STATE_CONNECTED_GLOBAL = 70
+
def is_connection_up():
""" Returns True if GTG can access the Internet """
bus = dbus.SystemBus()
- proxy = bus.get_object('org.freedesktop.NetworkManager',
+ proxy = bus.get_object('org.freedesktop.NetworkManager',
'/org/freedesktop/NetworkManager')
network_manager = dbus.Interface(proxy, 'org.freedesktop.NetworkManager')
=== modified file 'GTG/tools/taskxml.py'
--- GTG/tools/taskxml.py 2012-04-11 10:31:31 +0000
+++ GTG/tools/taskxml.py 2012-06-23 11:09:19 +0000
@@ -32,6 +32,7 @@
else:
return ""
+
def read_node(xmlnode, name):
node_list =xmlnode.getElementsByTagName(name)
if len(node_list) > 0:
@@ -41,7 +42,8 @@
#Take an empty task, an XML node and return a Task.
-def task_from_xml(task, xmlnode) :
+
+def task_from_xml(task, xmlnode):
#print "********************************"
#print xmlnode.toprettyxml()
@@ -55,7 +57,7 @@
duedate = Date(read_node(xmlnode, "duedate"))
task.set_due_date(duedate)
- startdate = Date(read_node(xmlnode,"startdate"))
+ startdate = Date(read_node(xmlnode, "startdate"))
task.set_start_date(startdate)
modified = read_node(xmlnode, "modified")
@@ -63,7 +65,7 @@
modified = datetime.strptime(modified, "%Y-%m-%dT%H:%M:%S")
task.set_modified(modified)
- tags = xmlnode.getAttribute("tags").replace(' ','')
+ tags = xmlnode.getAttribute("tags").replace(' ', '')
tags = (tag for tag in tags.split(',') if tag.strip() != "")
for tag in tags:
#FIXME why unescape????
@@ -89,7 +91,8 @@
task.set_attribute(key, value, namespace=namespace)
# FIXME do we need remote task ids? I don't think so
- # FIXME if so => rework them into a more usable structure!!! (like attributes)
+ # FIXME if so => rework them into a more usable structure!!!
+ #(like attributes)
#REMOTE TASK IDS
'''
remote_ids_list = xmlnode.getElementsByTagName("task-remote-ids")
@@ -105,25 +108,28 @@
#FIXME maybe pretty XML should be enough for this...
#Task as parameter the doc where to put the XML node
-def task_to_xml(doc,task) :
+
+def task_to_xml(doc, task):
t_xml = doc.createElement("task")
- t_xml.setAttribute("id",task.get_id())
- t_xml.setAttribute("status" , task.get_status())
- t_xml.setAttribute("uuid" , task.get_uuid())
+ t_xml.setAttribute("id", task.get_id())
+ t_xml.setAttribute("status", task.get_status())
+ t_xml.setAttribute("uuid", task.get_uuid())
tags_str = ""
- for tag in task.get_tags_name():
+ for tag in task.get_tags_name():
tags_str = tags_str + saxutils.escape(str(tag)) + ","
t_xml.setAttribute("tags", tags_str[:-1])
- cleanxml.addTextNode(doc,t_xml,"title",task.get_title())
- cleanxml.addTextNode(doc,t_xml,"duedate", task.get_due_date().xml_str())
- cleanxml.addTextNode(doc,t_xml,"modified",task.get_modified_string())
- cleanxml.addTextNode(doc,t_xml,"startdate", task.get_start_date().xml_str())
- cleanxml.addTextNode(doc,t_xml,"donedate", task.get_closed_date().xml_str())
+ cleanxml.addTextNode(doc, t_xml, "title", task.get_title())
+ cleanxml.addTextNode(doc, t_xml, "duedate", task.get_due_date().xml_str())
+ cleanxml.addTextNode(doc, t_xml, "modified", task.get_modified_string())
+ cleanxml.addTextNode(doc, t_xml, "startdate",
+ task.get_start_date().xml_str())
+ cleanxml.addTextNode(doc, t_xml, "donedate",
+ task.get_closed_date().xml_str())
childs = task.get_children()
- for c in childs :
- cleanxml.addTextNode(doc,t_xml,"subtask",c)
+ for c in childs:
+ cleanxml.addTextNode(doc, t_xml, "subtask", c)
for a in task.attributes:
- namespace,key=a
+ namespace, key=a
content=task.attributes[a]
element = doc.createElement('attribute')
element.setAttribute("namespace", namespace)
@@ -131,14 +137,15 @@
element.appendChild(doc.createTextNode(content))
t_xml.appendChild(element)
tex = task.get_text()
- if tex :
+ if tex:
#We take the xml text and convert it to a string
- #but without the "<content />"
+ #but without the "<content />"
element = minidom.parseString(tex)
- temp = element.firstChild.toxml().partition("<content>")[2] #pylint: disable-msg=E1103
+ temp = element.firstChild.toxml().partition("<content>")[2]
+ #pylint: disable-msg=E1103
desc = temp.partition("</content>")[0]
#t_xml.appendChild(element.firstChild)
- cleanxml.addTextNode(doc,t_xml,"content",desc)
+ cleanxml.addTextNode(doc, t_xml, "content", desc)
#self.__write_textnode(doc,t_xml,"content",t.get_text())
#REMOTE TASK IDS
=== modified file 'GTG/tools/twokeydict.py'
--- GTG/tools/twokeydict.py 2012-05-01 15:53:24 +0000
+++ GTG/tools/twokeydict.py 2012-06-23 11:09:19 +0000
@@ -24,7 +24,6 @@
from GTG.tools.bidict import BiDict
-
class TwoKeyDict(object):
'''
It's a standard Dictionary with a secondary key.
@@ -34,11 +33,10 @@
twokey['2'] ==> 'two'
twokey['II'] ==> 'two'
You can also request the other key, given one.
- Function calls start with _ because you'll probably want to rename them when
- you use this dictionary, for the sake of clarity.
+ Function calls start with _ because you'll probably want to rename them
+ when you use this dictionary, for the sake of clarity.
'''
-
def __init__(self, *triplets):
'''
Creates the TwoKeyDict and optionally populates it with some data
@@ -120,7 +118,7 @@
def _get_all_primary_keys(self):
'''
Returns all primary keys
-
+
@returns list: list of all primary keys
'''
return self._key_to_key_bidict._get_all_first()
@@ -128,8 +126,7 @@
def _get_all_secondary_keys(self):
'''
Returns all secondary keys
-
+
@returns list: list of all secondary keys
'''
return self._key_to_key_bidict._get_all_second()
-
=== modified file 'GTG/tools/urlregex.py'
--- GTG/tools/urlregex.py 2012-03-05 15:23:05 +0000
+++ GTG/tools/urlregex.py 2012-06-23 11:09:19 +0000
@@ -31,12 +31,12 @@
SUBST_DICT = {
"pre": ur'(?:[^/"\':!=]|^|\:)',
"domain": ur'([\.-]|[^\s_\!\.\/])+\.[a-z]{2,}(?::[0-9]+)?',
- "path":ur'(?:[\.,]?[%s!\*\'\(\);:=\+\$/%s#\[\]\-_,~@])' % (UTF_CHARS, '%'),
+ "path": ur'(?:[\.,]?[%s!\*\'\(\);:=\+\$/%s#\[\]\-_,~@])' % \
+ (UTF_CHARS, '%'),
"query": ur'[a-z0-9!\*\'\(\);:&=\+\$/%#\[\]\-_\.,~]',
# Valid end-of-path characters (so /foo. does not gobble the period).
"path_end": r'[%s\)=#/]' % UTF_CHARS,
- "query_end": '[a-z0-9_&=#]'
-}
+ "query_end": '[a-z0-9_&=#]'}
HTTP_URI= '((%(pre)s)((https?://|www\\.)(%(domain)s)(\/%(path)s*' \
'%(path_end)s?)?(\?%(query)s*%(query_end)s)?))' % SUBST_DICT
@@ -44,5 +44,6 @@
URL_REGEX = re.compile('%s|%s' % (HTTP_URI, FILE_URI), re.IGNORECASE)
+
def match(text):
return re.match(URL_REGEX, text)
=== modified file 'GTG/tools/watchdog.py'
--- GTG/tools/watchdog.py 2012-05-01 15:53:24 +0000
+++ GTG/tools/watchdog.py 2012-06-23 11:09:19 +0000
@@ -18,6 +18,7 @@
# -----------------------------------------------------------------------------
import threading
+
class Watchdog(object):
'''
a simple thread-safe watchdog.
=== modified file 'gtg'
--- gtg 2012-06-07 14:00:34 +0000
+++ gtg 2012-06-23 11:09:19 +0000
@@ -41,7 +41,7 @@
def main():
""" Parse arguments and run GTG
-
+
Importing GTG.gtg must be done after importing and setting up paths
for Liblarch """
=== modified file 'setup.py'
--- setup.py 2012-06-07 19:45:16 +0000
+++ setup.py 2012-06-23 11:09:19 +0000
@@ -29,14 +29,14 @@
### CONSTANTS ################################################################
-DATA_DIR = "share/gtg"
+DATA_DIR = "share/gtg"
GLOBAL_ICON_DIR = "share/icons/hicolor"
### TOOLS ####################################################################
def create_icon_list():
fileList = []
- rootdir = "data/icons"
+ rootdir = "data/icons"
for root, subFolders, files in os.walk(rootdir):
dirList = []
for file in files:
@@ -113,13 +113,13 @@
author = 'The GTG Team'
setup(
- name = 'gtg',
- version = info.VERSION,
- url = info.URL,
- author = author,
+ name = 'gtg',
+ version = info.VERSION,
+ url = info.URL,
+ author = author,
author_email = info.EMAIL,
- description = info.SHORT_DESCRIPTION,
- packages = [
+ description = info.SHORT_DESCRIPTION,
+ packages = [
'GTG',
'GTG.backends',
'GTG.backends.rtm',
Follow ups