GTG

Merge lp:~huxuan/gtg/port-to-gtk3-py3 into lp:~gtg/gtg/old-trunk

Proposed by Xuan (Sean) Hu
Status: Merged
Merged at revision: 1345
Proposed branch: lp:~huxuan/gtg/port-to-gtk3-py3
Merge into: lp:~gtg/gtg/old-trunk
Diff against target: 10663 lines (+1954/-1840)
114 files modified
AUTHORS (+1/-0)
GTG/__init__.py (+5/-11)
GTG/backends/__init__.py (+9/-10)
GTG/backends/backend_rtm.py (+6/-6)
GTG/backends/backendsignals.py (+9/-9)
GTG/backends/genericbackend.py (+4/-3)
GTG/backends/generictomboy.py (+8/-8)
GTG/backends/rtm/rtm.py (+10/-10)
GTG/core/__init__.py (+5/-5)
GTG/core/datastore.py (+6/-9)
GTG/core/plugins/__init__.py (+0/-5)
GTG/core/plugins/api.py (+10/-10)
GTG/core/plugins/engine.py (+12/-12)
GTG/core/requester.py (+4/-4)
GTG/core/tag.py (+4/-3)
GTG/core/task.py (+11/-13)
GTG/gtg.py (+3/-3)
GTG/gtk/__init__.py (+6/-6)
GTG/gtk/backends_dialog.ui (+9/-8)
GTG/gtk/backends_dialog/__init__.py (+18/-19)
GTG/gtk/backends_dialog/addpanel.py (+63/-61)
GTG/gtk/backends_dialog/backendscombo.py (+10/-9)
GTG/gtk/backends_dialog/backendstree.py (+21/-16)
GTG/gtk/backends_dialog/configurepanel.py (+43/-42)
GTG/gtk/backends_dialog/parameters_ui/__init__.py (+13/-10)
GTG/gtk/backends_dialog/parameters_ui/checkboxui.py (+7/-7)
GTG/gtk/backends_dialog/parameters_ui/importtagsui.py (+22/-20)
GTG/gtk/backends_dialog/parameters_ui/passwordui.py (+9/-9)
GTG/gtk/backends_dialog/parameters_ui/pathui.py (+22/-22)
GTG/gtk/backends_dialog/parameters_ui/periodui.py (+13/-13)
GTG/gtk/backends_dialog/parameters_ui/textui.py (+11/-11)
GTG/gtk/browser/CellRendererTags.py (+23/-26)
GTG/gtk/browser/__init__.py (+2/-0)
GTG/gtk/browser/browser.py (+73/-69)
GTG/gtk/browser/custominfobar.py (+34/-34)
GTG/gtk/browser/modifytags_dialog.py (+11/-6)
GTG/gtk/browser/modifytags_dialog.ui (+2/-1)
GTG/gtk/browser/simple_color_selector.py (+62/-56)
GTG/gtk/browser/tag_context_menu.py (+5/-8)
GTG/gtk/browser/tag_editor.py (+127/-90)
GTG/gtk/browser/taskbrowser.ui (+20/-83)
GTG/gtk/browser/treeview_factory.py (+32/-25)
GTG/gtk/colors.py (+8/-5)
GTG/gtk/crashhandler.py (+35/-37)
GTG/gtk/dbuswrapper.py (+1/-1)
GTG/gtk/delete_dialog.py (+3/-3)
GTG/gtk/deletion.ui (+6/-5)
GTG/gtk/editor/__init__.py (+1/-1)
GTG/gtk/editor/calendar.py (+38/-23)
GTG/gtk/editor/editor.py (+64/-57)
GTG/gtk/editor/taskeditor.ui (+78/-30)
GTG/gtk/editor/taskview.py (+130/-118)
GTG/gtk/editor/taskviewserial.py (+18/-17)
GTG/gtk/manager.py (+16/-22)
GTG/gtk/plugins.py (+25/-21)
GTG/gtk/plugins.ui (+10/-8)
GTG/gtk/preferences.py (+26/-22)
GTG/gtk/preferences.ui (+12/-47)
GTG/gtk/tag_completion.py (+5/-5)
GTG/info.py (+3/-0)
GTG/plugins/bugzilla/bugzilla.py (+11/-11)
GTG/plugins/bugzilla/notification.py (+6/-6)
GTG/plugins/bugzilla/services.py (+2/-2)
GTG/plugins/export/export.py (+21/-23)
GTG/plugins/export/export.ui (+18/-12)
GTG/plugins/export/templates.py (+2/-2)
GTG/plugins/geolocalized_tasks/geolocalized.ui (+145/-130)
GTG/plugins/geolocalized_tasks/geolocalized_tasks.py (+32/-27)
GTG/plugins/geolocalized_tasks/marker.py (+4/-4)
GTG/plugins/hamster/hamster.py (+29/-33)
GTG/plugins/hamster/prefs.ui (+4/-5)
GTG/plugins/not_today/not_today.py (+2/-2)
GTG/plugins/notification_area/notification_area.py (+17/-14)
GTG/plugins/notification_area/notification_area.ui (+7/-6)
GTG/plugins/send_email/sendEmail.py (+7/-7)
GTG/plugins/task_reaper/reaper.py (+3/-13)
GTG/plugins/task_reaper/reaper.ui (+5/-6)
GTG/plugins/tomboy/combobox_enhanced.py (+10/-10)
GTG/plugins/tomboy/tomboy.py (+58/-66)
GTG/plugins/tomboy/tomboy.ui (+4/-4)
GTG/plugins/untouched_tasks/untouchedTasks.py (+6/-8)
GTG/plugins/untouched_tasks/untouchedTasks.ui (+5/-20)
GTG/plugins/urgency_color/preferences.ui (+10/-8)
GTG/plugins/urgency_color/urgency_color.py (+13/-12)
GTG/tests/__init__.py (+1/-2)
GTG/tests/signals_testing.py (+5/-5)
GTG/tests/test_backend_tomboy.py (+5/-5)
GTG/tests/test_bidict.py (+1/-1)
GTG/tests/test_datastore.py (+10/-10)
GTG/tests/test_signal_testing.py (+7/-7)
GTG/tests/test_twokeydict.py (+3/-3)
GTG/tests/tree_testing.py (+8/-8)
GTG/tools/bidict.py (+2/-1)
GTG/tools/cleanxml.py (+12/-12)
GTG/tools/clipboard.py (+3/-3)
GTG/tools/dates.py (+86/-18)
GTG/tools/import_liblarch.py (+10/-8)
GTG/tools/keyring.py (+20/-11)
GTG/tools/networkmanager.py (+7/-17)
GTG/tools/shortcut.py (+1/-1)
GTG/tools/taskxml.py (+1/-1)
GTG/tools/urlregex.py (+5/-5)
gtcli (+37/-37)
gtg (+10/-9)
gtg_new_task (+1/-1)
profile.py (+1/-1)
run-tests (+15/-11)
scripts/anonymize_task_file.py (+15/-15)
scripts/build_integrity.py (+5/-5)
scripts/close_launchpad_bugs.py (+8/-8)
scripts/gtg_stress_test (+4/-4)
scripts/profile_interpret.sh (+1/-1)
scripts/tarball_integrity.py (+3/-3)
setup.py (+2/-2)
To merge this branch: bzr merge lp:~huxuan/gtg/port-to-gtk3-py3
Reviewer Review Type Date Requested Status
Izidor Matušov Needs Fixing
Review via email: mp+187552@code.launchpad.net

Description of the change

This is the Gtk3 and Python3 ported GTG.
You can get more information about the porting work here [1].
BTW, there is a shared evernote [2] with test actions and coverage [3] report listed.
If you find any bugs, feel free to tell me. :-)

[1] https://wiki.gnome.org/SummerOfCode2013/Projects/XuanHu_PortingGTG
[2] https://www.evernote.com/shard/s43/sh/8e6e0ce8-227e-4c7a-b1e4-1e4e13e2728a/3b9d652d1303c5418292963b9483155c
[3] http://nedbatchelder.com/code/coverage/

To post a comment you must log in.
Revision history for this message
Parin Porecha (parinporecha) wrote :

Hi Huxuan,

I found 2 bugs -

1) In the icon selection in tag editor, I noticed a difference in the window heights -
Trunk code - http://i.imgur.com/QkAMZzN.png
Your branch - http://i.imgur.com/Ae4jKyL.png
Only one row of icons are visible at a time.

2) I can't close the icon selection without selecting an icon. On clicking anywhere outside, or on clicking the 'Remove selection' button (i.e. - on trying to close the icon selection window), I get this traceback - http://pastebin.com/hurXQb0U

Another thing -
When I ran GTG through './gtg', the dark theme I've applied for all GTK3 windows works for GTG (http://i.imgur.com/76rhSaD.png).
But when I run the dev version './scripts/debug.sh', it does not work (http://i.imgur.com/Ae4jKyL.png). I don't know if it is a bug in your branch or some XDG variable fault (I'm just guessing).

Revision history for this message
Parin Porecha (parinporecha) wrote :

The no. 2 bug in the above comment also occurs in the task editor.

When the calendar is opened, it doesn't close if I don't select a date. Here's the traceback - http://pastebin.com/gt9Cgv7C

Here's a link which I think will help - http://docs.python.org/3.0/whatsnew/3.0.html#ordering-comparisons

Revision history for this message
Izidor Matušov (izidor) wrote :

I am not able to select a color for tag. It would be better to either stick with the old colorselector, or make it work with Gtk3 selector.

review: Needs Fixing
Revision history for this message
Xuan (Sean) Hu (huxuan) wrote :

Hi, thx for your guys' bug reporting!

I was a little busy before China's National Holiday. But the bug fixing work is already listed on my to do list in GTG. Suppose to have some update in two or three days.

If you find any other problems, feel free to note it down here.

lp:~huxuan/gtg/port-to-gtk3-py3 updated
1325. By Xuan (Sean) Hu

Merge Trunk

Revision history for this message
Parin Porecha (parinporecha) wrote :

Hi,

can you please patch the bugs mentioned above ?
GTG is participating in OPW round from November, and the student will work on your branch
So, it's better if we can make it as stable as possible :-)

Thanks !

Revision history for this message
Xuan (Sean) Hu (huxuan) wrote :

Sorry, Just too busy these days. I will try my best.

lp:~huxuan/gtg/port-to-gtk3-py3 updated
1326. By Xuan (Sean) Hu

Merge Trunk

1327. By Xuan (Sean) Hu

Bug fix for change gobject to GObject

Revision history for this message
Xuan (Sean) Hu (huxuan) wrote :

Hi, all

Need help for the IconView set_size_request bug.
It seems to be a bug of PyGObject/Gtk3, I have created a simple demo as following:
```python
from gi.repository import Gtk

win = Gtk.Window()
sw = Gtk.ScrolledWindow()
sw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.ALWAYS)
iv = Gtk.IconView()
iv.set_size_request(640, 640)
sw.add(iv)
win.add(sw)
win.connect("delete-event", Gtk.main_quit)
win.show_all()
Gtk.main()
```
The set_size_request() doesn't seem to work when vertical policy is set to ALWAYS, but when change the PolicyType to NEVER, the request size seems to work fine.
Just not sure whether this conclusion is true. Any suggestions are welcome. :-)

lp:~huxuan/gtg/port-to-gtk3-py3 updated
1328. By Xuan (Sean) Hu

use specific method rather than set_property

Revision history for this message
Izidor Matušov (izidor) wrote :

Where do we use IconView?

Revision history for this message
Xuan (Sean) Hu (huxuan) wrote :

The icon selector in Tag Editor.
The related code can be found here [1].

[1] http://bazaar.launchpad.net/~huxuan/gtg/port-to-gtk3-py3/view/head:/GTG/gtk/browser/tag_editor.py#L68

Revision history for this message
Izidor Matušov (izidor) wrote :

Try to report the bug with the demo and chase folks at GNOME IRC channels.
With such a simple demo, it should be pretty straightforward to get some
answer.

On Sun, Nov 10, 2013 at 7:18 PM, Xuan (Sean) Hu <email address hidden>wrote:

> The icon selector in Tag Editor.
> The related code can be found here [1].
>
> [1]
> http://bazaar.launchpad.net/~huxuan/gtg/port-to-gtk3-py3/view/head:/GTG/gtk/browser/tag_editor.py#L68
> --
> https://code.launchpad.net/~huxuan/gtg/port-to-gtk3-py3/+merge/187552
> You are reviewing the proposed merge of lp:~huxuan/gtg/port-to-gtk3-py3
> into lp:gtg.
>

Revision history for this message
Xuan (Sean) Hu (huxuan) wrote :

I have created the bug here [1]. If there is any problem about the reporting, feel free to tell me.

[1] https://bugzilla.gnome.org/show_bug.cgi?id=711793

lp:~huxuan/gtg/port-to-gtk3-py3 updated
1329. By Xuan (Sean) Hu

Merge Trunk

1330. By Xuan (Sean) Hu

Merge Trunk

Revision history for this message
Parin Porecha (parinporecha) wrote :

Hi,

we want to merge your branch to the trunk as soon as possible, but the tag editor is not working, thats where we're stuck.
Once it gets working, we'll merge it.

If you need help, I'll be happy to fix some problems :-)

lp:~huxuan/gtg/port-to-gtk3-py3 updated
1331. By Xuan (Sean) Hu

Merge Trunk

1332. By Xuan (Sean) Hu

Merge Trunk

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'AUTHORS'
--- AUTHORS 2013-10-27 00:28:23 +0000
+++ AUTHORS 2014-01-12 07:15:48 +0000
@@ -114,6 +114,7 @@
114114
115For 0.3.1:115For 0.3.1:
116----------116----------
117* Joe R. Nassimian <nassimian.joseph@gmail.com>
117* Antonio Roquentin <https://launchpad.net/~antonio-roquentin> (no email provided)118* Antonio Roquentin <https://launchpad.net/~antonio-roquentin> (no email provided)
118* Codee <kmhpfoss@gmail.com>119* Codee <kmhpfoss@gmail.com>
119* Sebastian Dyroff <sebastian@dyroff.org>120* Sebastian Dyroff <sebastian@dyroff.org>
120121
=== modified file 'GTG/__init__.py'
--- GTG/__init__.py 2013-11-23 14:40:23 +0000
+++ GTG/__init__.py 2014-01-12 07:15:48 +0000
@@ -29,13 +29,9 @@
29 locale.setlocale(locale.LC_ALL, 'C')29 locale.setlocale(locale.LC_ALL, 'C')
3030
31import gettext31import gettext
32try:
33 from gtk import glade
34 loaded_glade = glade
35except:
36 # that's not pretty but it looks functional.
37 loaded_glade = None
3832
33# FIXME is this construction needed?
34# There are many other places where this is used
39try:35try:
40 from xdg.BaseDirectory import xdg_config_home36 from xdg.BaseDirectory import xdg_config_home
41 config_home = xdg_config_home37 config_home = xdg_config_home
@@ -48,11 +44,9 @@
48GETTEXT_DOMAIN = 'gtg'44GETTEXT_DOMAIN = 'gtg'
49LOCALE_PATH = gettext.bindtextdomain(GETTEXT_DOMAIN)45LOCALE_PATH = gettext.bindtextdomain(GETTEXT_DOMAIN)
5046
51for module in gettext, loaded_glade:47gettext.bindtextdomain(GETTEXT_DOMAIN, LOCALE_PATH)
52 # check if glade is well loaded to avoid error in Fedora build farm48gettext.textdomain(GETTEXT_DOMAIN)
53 if module:49# FIXME set translation for Builder as well!
54 module.bindtextdomain(GETTEXT_DOMAIN, LOCALE_PATH)
55 module.textdomain(GETTEXT_DOMAIN)
5650
57translation = gettext.translation(GETTEXT_DOMAIN, LOCALE_PATH, fallback=True)51translation = gettext.translation(GETTEXT_DOMAIN, LOCALE_PATH, fallback=True)
5852
5953
=== modified file 'GTG/backends/__init__.py'
--- GTG/backends/__init__.py 2013-11-23 14:40:23 +0000
+++ GTG/backends/__init__.py 2014-01-12 07:15:48 +0000
@@ -50,30 +50,29 @@
50 """50 """
51 Creates a dictionary of the currently available backend modules51 Creates a dictionary of the currently available backend modules
52 """52 """
53 super(BackendFactory, self).__init__()53 Borg.__init__(self)
54 if hasattr(self, "backend_modules"):54 if hasattr(self, "backend_modules"):
55 # This object has already been constructed55 # This object has already been constructed
56 return56 return
57 self.backend_modules = {}57 self.backend_modules = {}
58 # Look for backends in the GTG/backends dir58 # Look for backends in the GTG/backends dir
59 this_dir = os.path.dirname(__file__)59 this_dir = os.path.dirname(__file__)
60 backend_files = filter(lambda f: f.endswith(".py") and60 backend_files = [f for f in os.listdir(this_dir) if f.endswith(".py") and
61 f.startswith(self.BACKEND_PREFIX),61 f.startswith(self.BACKEND_PREFIX)]
62 os.listdir(this_dir))
63 # Create module names62 # Create module names
64 module_names = map(lambda f: f.replace(".py", ""), backend_files)63 module_names = [f.replace(".py", "") for f in backend_files]
65 Log.debug("Backends found: " + str(module_names))64 Log.debug("Backends found: " + str(module_names))
66 # Load backend modules65 # Load backend modules
67 for module_name in module_names:66 for module_name in module_names:
68 extended_module_name = "GTG.backends." + module_name67 extended_module_name = "GTG.backends." + module_name
69 try:68 try:
70 __import__(extended_module_name)69 __import__(extended_module_name)
71 except ImportError, exception:70 except ImportError as exception:
72 # Something is wrong with this backend, skipping71 # Something is wrong with this backend, skipping
73 Log.warning("Backend %s could not be loaded: %s" %72 Log.warning("Backend %s could not be loaded: %s" %
74 (module_name, str(exception)))73 (module_name, str(exception)))
75 continue74 continue
76 except Exception, exception:75 except Exception as exception:
77 # Other exception log as errors76 # Other exception log as errors
78 Log.error("Malformated backend %s: %s" %77 Log.error("Malformated backend %s: %s" %
79 (module_name, str(exception)))78 (module_name, str(exception)))
@@ -113,11 +112,11 @@
113 # type112 # type
114 parameters = module.Backend.get_static_parameters()113 parameters = module.Backend.get_static_parameters()
115 # we all the parameters and their default values in dic114 # we all the parameters and their default values in dic
116 for param_name, param_dic in parameters.iteritems():115 for param_name, param_dic in parameters.items():
117 dic[param_name] = param_dic[GenericBackend.PARAM_DEFAULT_VALUE]116 dic[param_name] = param_dic[GenericBackend.PARAM_DEFAULT_VALUE]
118 dic["pid"] = str(uuid.uuid4())117 dic["pid"] = str(uuid.uuid4())
119 dic["module"] = module.Backend.get_name()118 dic["module"] = module.Backend.get_name()
120 for param_name, param_value in additional_parameters.iteritems():119 for param_name, param_value in additional_parameters.items():
121 dic[param_name] = param_value120 dic[param_name] = param_value
122 dic["backend"] = module.Backend(dic)121 dic["backend"] = module.Backend(dic)
123 return dic122 return dic
@@ -146,7 +145,7 @@
146 # Building the dictionary145 # Building the dictionary
147 parameters_specs = module.Backend.get_static_parameters()146 parameters_specs = module.Backend.get_static_parameters()
148 dic["pid"] = str(xp.getAttribute("pid"))147 dic["pid"] = str(xp.getAttribute("pid"))
149 for param_name, param_dic in parameters_specs.iteritems():148 for param_name, param_dic in parameters_specs.items():
150 if xp.hasAttribute(param_name):149 if xp.hasAttribute(param_name):
151 # we need to convert the parameter to the right format.150 # we need to convert the parameter to the right format.
152 # we fetch the format from the static_parameters151 # we fetch the format from the static_parameters
153152
=== modified file 'GTG/backends/backend_rtm.py'
--- GTG/backends/backend_rtm.py 2013-11-23 14:40:23 +0000
+++ GTG/backends/backend_rtm.py 2014-01-12 07:15:48 +0000
@@ -41,6 +41,7 @@
41from GTG.core.task import Task41from GTG.core.task import Task
42from GTG.tools.interruptible import interruptible42from GTG.tools.interruptible import interruptible
43from GTG.tools.logger import Log43from GTG.tools.logger import Log
44from functools import reduce
4445
4546
46class Backend(PeriodicImportBackend):47class Backend(PeriodicImportBackend):
@@ -140,7 +141,7 @@
140 # set141 # set
141 stored_rtm_task_ids = self.sync_engine.get_all_remote()142 stored_rtm_task_ids = self.sync_engine.get_all_remote()
142 current_rtm_task_ids = [tid for tid in143 current_rtm_task_ids = [tid for tid in
143 self.rtm_proxy.get_rtm_tasks_dict().iterkeys()]144 self.rtm_proxy.get_rtm_tasks_dict().keys()]
144145
145 if self._this_is_the_first_loop:146 if self._this_is_the_first_loop:
146 self._on_successful_authentication()147 self._on_successful_authentication()
@@ -424,7 +425,7 @@
424 # tags to add425 # tags to add
425 for tag in tags.difference(gtg_tags_lower):426 for tag in tags.difference(gtg_tags_lower):
426 gtg_all_tags = self.datastore.get_all_tags()427 gtg_all_tags = self.datastore.get_all_tags()
427 matching_tags = filter(lambda t: t.lower() == tag, gtg_all_tags)428 matching_tags = [t for t in gtg_all_tags if t.lower() == tag]
428 if len(matching_tags) != 0:429 if len(matching_tags) != 0:
429 tag = matching_tags[0]430 tag = matching_tags[0]
430 task.add_tag(tag)431 task.add_tag(tag)
@@ -471,7 +472,7 @@
471 three times before giving up.472 three times before giving up.
472 '''473 '''
473 MAX_ATTEMPTS = 3474 MAX_ATTEMPTS = 3
474 for i in xrange(MAX_ATTEMPTS):475 for i in range(MAX_ATTEMPTS):
475 try:476 try:
476 return fun(*args)477 return fun(*args)
477 except:478 except:
@@ -589,7 +590,7 @@
589 self.rtm = createRTM(self.PUBLIC_KEY, self.PRIVATE_KEY, self.token)590 self.rtm = createRTM(self.PUBLIC_KEY, self.PRIVATE_KEY, self.token)
590 self.timeline = self.rtm.timelines.create().timeline591 self.timeline = self.rtm.timelines.create().timeline
591 return True592 return True
592 except (RTMError, RTMAPIError), e:593 except (RTMError, RTMAPIError) as e:
593 Log.error("RTM ERROR" + str(e))594 Log.error("RTM ERROR" + str(e))
594 return False595 return False
595596
@@ -890,8 +891,7 @@
890 return ""891 return ""
891 else:892 else:
892 note_list = self.__getattr_the_rtm_way(notes, 'note')893 note_list = self.__getattr_the_rtm_way(notes, 'note')
893 return "".join(map(lambda note: "%s\n" % getattr(note, '$t'),894 return "".join(["%s\n" % getattr(note, '$t') for note in note_list])
894 note_list))
895895
896 def set_text(self, text, transaction_ids=[]):896 def set_text(self, text, transaction_ids=[]):
897 '''897 '''
898898
=== modified file 'GTG/backends/backendsignals.py'
--- GTG/backends/backendsignals.py 2013-11-23 14:40:23 +0000
+++ GTG/backends/backendsignals.py 2014-01-12 07:15:48 +0000
@@ -17,7 +17,7 @@
17# this program. If not, see <http://www.gnu.org/licenses/>.17# this program. If not, see <http://www.gnu.org/licenses/>.
18# -----------------------------------------------------------------------------18# -----------------------------------------------------------------------------
1919
20import gobject20from gi.repository import GObject
2121
22from GTG.tools.borg import Borg22from GTG.tools.borg import Borg
2323
@@ -59,10 +59,10 @@
5959
60 @returns: tuple60 @returns: tuple
61 '''61 '''
62 return (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, args)62 return (GObject.SignalFlags.RUN_FIRST, None, args)
6363
6464
65class _BackendSignalsGObject(gobject.GObject):65class _BackendSignalsGObject(GObject.GObject):
6666
67 # signal name constants67 # signal name constants
68 BACKEND_STATE_TOGGLED = 'backend-state-toggled' # emitted when a68 BACKEND_STATE_TOGGLED = 'backend-state-toggled' # emitted when a
@@ -103,7 +103,7 @@
103 # As a general rule, signals should only be emitted in the GenericBackend103 # As a general rule, signals should only be emitted in the GenericBackend
104 # class104 # class
105 def _emit_signal(self, signal, backend_id):105 def _emit_signal(self, signal, backend_id):
106 gobject.idle_add(self.emit, signal, backend_id)106 GObject.idle_add(self.emit, signal, backend_id)
107107
108 def backend_state_changed(self, backend_id):108 def backend_state_changed(self, backend_id):
109 self._emit_signal(self.BACKEND_STATE_TOGGLED, backend_id)109 self._emit_signal(self.BACKEND_STATE_TOGGLED, backend_id)
@@ -118,15 +118,15 @@
118 self._emit_signal(self.BACKEND_REMOVED, backend_id)118 self._emit_signal(self.BACKEND_REMOVED, backend_id)
119119
120 def default_backend_loaded(self):120 def default_backend_loaded(self):
121 gobject.idle_add(self.emit, self.DEFAULT_BACKEND_LOADED)121 GObject.idle_add(self.emit, self.DEFAULT_BACKEND_LOADED)
122122
123 def backend_failed(self, backend_id, error_code):123 def backend_failed(self, backend_id, error_code):
124 gobject.idle_add(self.emit, self.BACKEND_FAILED, backend_id,124 GObject.idle_add(self.emit, self.BACKEND_FAILED, backend_id,
125 error_code)125 error_code)
126126
127 def interaction_requested(self, backend_id, description,127 def interaction_requested(self, backend_id, description,
128 interaction_type, callback_str):128 interaction_type, callback_str):
129 gobject.idle_add(self.emit, self.INTERACTION_REQUESTED,129 GObject.idle_add(self.emit, self.INTERACTION_REQUESTED,
130 backend_id, description, interaction_type,130 backend_id, description, interaction_type,
131 callback_str)131 callback_str)
132132
133133
=== modified file 'GTG/backends/genericbackend.py'
--- GTG/backends/genericbackend.py 2013-11-23 14:40:23 +0000
+++ GTG/backends/genericbackend.py 2014-01-12 07:15:48 +0000
@@ -33,6 +33,7 @@
33from GTG.core import CoreConfig33from GTG.core import CoreConfig
34from GTG.tools.logger import Log34from GTG.tools.logger import Log
35from GTG.tools.interruptible import _cancellation_point35from GTG.tools.interruptible import _cancellation_point
36from functools import reduce
3637
37PICKLE_BACKUP_NBR = 238PICKLE_BACKUP_NBR = 2
3839
@@ -261,9 +262,9 @@
261 if cls._general_description[cls.BACKEND_TYPE] == \262 if cls._general_description[cls.BACKEND_TYPE] == \
262 cls.TYPE_READWRITE:263 cls.TYPE_READWRITE:
263 for key, value in \264 for key, value in \
264 cls._static_parameters_obligatory_for_rw.iteritems():265 cls._static_parameters_obligatory_for_rw.items():
265 temp_dic[key] = value266 temp_dic[key] = value
266 for key, value in cls._static_parameters.iteritems():267 for key, value in cls._static_parameters.items():
267 temp_dic[key] = value268 temp_dic[key] = value
268 return temp_dic269 return temp_dic
269270
@@ -537,7 +538,7 @@
537 # mkdir -p538 # mkdir -p
538 try:539 try:
539 os.makedirs(os.path.dirname(path))540 os.makedirs(os.path.dirname(path))
540 except OSError, exception:541 except OSError as exception:
541 if exception.errno != errno.EEXIST:542 if exception.errno != errno.EEXIST:
542 raise543 raise
543544
544545
=== modified file 'GTG/backends/generictomboy.py'
--- GTG/backends/generictomboy.py 2014-01-01 11:43:36 +0000
+++ GTG/backends/generictomboy.py 2014-01-12 07:15:48 +0000
@@ -126,7 +126,7 @@
126 while True:126 while True:
127 try:127 try:
128 [key, timer] = \128 [key, timer] = \
129 self._tomboy_setting_timers.iteritems().next()129 next(iter(self._tomboy_setting_timers.items()))
130 except StopIteration:130 except StopIteration:
131 break131 break
132 timer.cancel()132 timer.cancel()
@@ -416,12 +416,12 @@
416 try:416 try:
417 end_of_title = content.index('\n')417 end_of_title = content.index('\n')
418 except ValueError:418 except ValueError:
419 return content, unicode("")419 return content, str("")
420 title = content[: end_of_title]420 title = content[: end_of_title]
421 if len(content) > end_of_title:421 if len(content) > end_of_title:
422 return title, content[end_of_title + 1:]422 return title, content[end_of_title + 1:]
423 else:423 else:
424 return title, unicode("")424 return title, str("")
425425
426 def _populate_task(self, task, note):426 def _populate_task(self, task, note):
427 '''427 '''
@@ -438,10 +438,10 @@
438 # update the tags list438 # update the tags list
439 task.set_only_these_tags(extract_tags_from_text(content))439 task.set_only_these_tags(extract_tags_from_text(content))
440 # extract title and text440 # extract title and text
441 [title, text] = self._tomboy_split_title_and_text(unicode(content))441 [title, text] = self._tomboy_split_title_and_text(str(content))
442 # Tomboy speaks unicode, we don't442 # Tomboy speaks unicode, we don't
443 title = unicodedata.normalize('NFKD', title).encode('ascii', 'ignore')443 title = unicodedata.normalize('NFKD', title)
444 text = unicodedata.normalize('NFKD', text).encode('ascii', 'ignore')444 text = unicodedata.normalize('NFKD', text)
445 task.set_title(title)445 task.set_title(title)
446 task.set_text(text)446 task.set_text(text)
447 task.add_remote_id(self.get_id(), note)447 task.add_remote_id(self.get_id(), note)
@@ -467,7 +467,7 @@
467 # tomboy passes Dbus.String objects, which are not pickable. We convert467 # tomboy passes Dbus.String objects, which are not pickable. We convert
468 # those to unicode468 # those to unicode
469 if "remote_id" in kwargs:469 if "remote_id" in kwargs:
470 kwargs["remote_id"] = unicode(kwargs["remote_id"])470 kwargs["remote_id"] = str(kwargs["remote_id"])
471 try:471 try:
472 self.sync_engine.break_relationship(*args, **kwargs)472 self.sync_engine.break_relationship(*args, **kwargs)
473 # we try to save the state at each change in the sync_engine:473 # we try to save the state at each change in the sync_engine:
@@ -485,7 +485,7 @@
485 # tomboy passes Dbus.String objects, which are not pickable. We convert485 # tomboy passes Dbus.String objects, which are not pickable. We convert
486 # those to unicode486 # those to unicode
487 if "remote_id" in kwargs:487 if "remote_id" in kwargs:
488 kwargs["remote_id"] = unicode(kwargs["remote_id"])488 kwargs["remote_id"] = str(kwargs["remote_id"])
489489
490 self.sync_engine.record_relationship(*args, **kwargs)490 self.sync_engine.record_relationship(*args, **kwargs)
491 # we try to save the state at each change in the sync_engine:491 # we try to save the state at each change in the sync_engine:
492492
=== modified file 'GTG/backends/rtm/rtm.py'
--- GTG/backends/rtm/rtm.py 2013-02-25 08:12:02 +0000
+++ GTG/backends/rtm/rtm.py 2014-01-12 07:15:48 +0000
@@ -8,7 +8,7 @@
8)8)
99
1010
11import urllib11import urllib.request, urllib.parse, urllib.error
12from hashlib import md512from hashlib import md5
1313
14from GTG import _14from GTG import _
@@ -80,7 +80,7 @@
80 self.authInfo = AuthStateMachine(['frob', 'token'])80 self.authInfo = AuthStateMachine(['frob', 'token'])
8181
82 # this enables one to do 'rtm.tasks.getList()', for example82 # this enables one to do 'rtm.tasks.getList()', for example
83 for prefix, methods in API.items():83 for prefix, methods in list(API.items()):
84 setattr(self, prefix,84 setattr(self, prefix,
85 RTMAPICategory(self, prefix, methods))85 RTMAPICategory(self, prefix, methods))
8686
@@ -130,7 +130,7 @@
130 'frob': frob130 'frob': frob
131 }131 }
132 params['api_sig'] = self._sign(params)132 params['api_sig'] = self._sign(params)
133 return AUTH_SERVICE_URL + '?' + urllib.urlencode(params)133 return AUTH_SERVICE_URL + '?' + urllib.parse.urlencode(params)
134134
135 def getToken(self):135 def getToken(self):
136 frob = self.authInfo.get('frob')136 frob = self.authInfo.get('frob')
@@ -178,7 +178,7 @@
178# Utility functions178# Utility functions
179def sortedItems(dictionary):179def sortedItems(dictionary):
180 "Return a list of (key, value) sorted based on keys"180 "Return a list of (key, value) sorted based on keys"
181 keys = dictionary.keys()181 keys = list(dictionary.keys())
182 keys.sort()182 keys.sort()
183 for key in keys:183 for key in keys:
184 yield key, dictionary[key]184 yield key, dictionary[key]
@@ -186,9 +186,9 @@
186186
187def openURL(url, queryArgs=None):187def openURL(url, queryArgs=None):
188 if queryArgs:188 if queryArgs:
189 url = url + '?' + urllib.urlencode(queryArgs)189 url = url + '?' + urllib.parse.urlencode(queryArgs)
190 # LOG.debug("URL> %s", url)190 # LOG.debug("URL> %s", url)
191 return urllib.urlopen(url)191 return urllib.request.urlopen(url)
192192
193193
194class dottedDict(object):194class dottedDict(object):
@@ -198,7 +198,7 @@
198 self._name = name198 self._name = name
199199
200 if type(dictionary) is dict:200 if type(dictionary) is dict:
201 for key, value in dictionary.items():201 for key, value in list(dictionary.items()):
202 if type(value) is dict:202 if type(value) is dict:
203 value = dottedDict(key, value)203 value = dottedDict(key, value)
204 elif type(value) in (list, tuple) and key != 'tag':204 elif type(value) in (list, tuple) and key != 'tag':
@@ -396,12 +396,12 @@
396 rtm = createRTM(apiKey, secret, token)396 rtm = createRTM(apiKey, secret, token)
397397
398 rspTasks = rtm.tasks.getList(filter='dueWithin:"1 week of today"')398 rspTasks = rtm.tasks.getList(filter='dueWithin:"1 week of today"')
399 print [t.name for t in rspTasks.tasks.list.taskseries]399 print([t.name for t in rspTasks.tasks.list.taskseries])
400 print rspTasks.tasks.list.id400 print(rspTasks.tasks.list.id)
401401
402 rspLists = rtm.lists.getList()402 rspLists = rtm.lists.getList()
403 # print rspLists.lists.list403 # print rspLists.lists.list
404 print [(x.name, x.id) for x in rspLists.lists.list]404 print([(x.name, x.id) for x in rspLists.lists.list])
405405
406406
407def set_log_level(level):407def set_log_level(level):
408408
=== modified file 'GTG/core/__init__.py'
--- GTG/core/__init__.py 2013-11-23 14:40:23 +0000
+++ GTG/core/__init__.py 2014-01-12 07:15:48 +0000
@@ -37,8 +37,8 @@
3737
38#=== IMPORT ===================================================================38#=== IMPORT ===================================================================
39from re import findall39from re import findall
40import configparser
4041
41import ConfigParser
42from xdg.BaseDirectory import xdg_data_home, xdg_config_home, xdg_data_dirs42from xdg.BaseDirectory import xdg_data_home, xdg_config_home, xdg_data_dirs
43import os43import os
4444
@@ -132,8 +132,8 @@
132 toreturn = DEFAULTS[self._section][option]132 toreturn = DEFAULTS[self._section][option]
133 self.set(option, toreturn)133 self.set(option, toreturn)
134 else:134 else:
135 print "Warning : no default conf value for %s in %s" % (135 print("Warning : no default conf value for %s in %s" % (
136 option, self._section)136 option, self._section))
137 toreturn = None137 toreturn = None
138 return toreturn138 return toreturn
139139
@@ -208,10 +208,10 @@
208 def check_config_file(self, path):208 def check_config_file(self, path):
209 """ This function bypasses the errors of config file and allows GTG209 """ This function bypasses the errors of config file and allows GTG
210 to open smoothly"""210 to open smoothly"""
211 config = ConfigParser.ConfigParser()211 config = configparser.ConfigParser()
212 try:212 try:
213 config.read(path)213 config.read(path)
214 except ConfigParser.Error:214 except configparser.Error:
215 open(path, "w").close()215 open(path, "w").close()
216 return config216 return config
217217
218218
=== modified file 'GTG/core/datastore.py'
--- GTG/core/datastore.py 2013-11-23 14:40:23 +0000
+++ GTG/core/datastore.py 2014-01-12 07:15:48 +0000
@@ -106,7 +106,6 @@
106 ### Tags functions ########################################################106 ### Tags functions ########################################################
107 def _add_new_tag(self, name, tag, filter_func, parameters, parent_id=None):107 def _add_new_tag(self, name, tag, filter_func, parameters, parent_id=None):
108 """ Add tag into a tree """108 """ Add tag into a tree """
109 name = name.encode("UTF-8")
110 if self._tagstore.has_node(name):109 if self._tagstore.has_node(name):
111 raise IndexError('tag %s was already in the datastore' % name)110 raise IndexError('tag %s was already in the datastore' % name)
112111
@@ -120,7 +119,6 @@
120119
121 @returns GTG.core.tag.Tag: the new tag120 @returns GTG.core.tag.Tag: the new tag
122 """121 """
123 name = name.encode("UTF-8")
124 parameters = {'tag': name}122 parameters = {'tag': name}
125 tag = Tag(name, req=self.requester, attributes=attributes)123 tag = Tag(name, req=self.requester, attributes=attributes)
126 self._add_new_tag(name, tag, self.treefactory.tag_filter, parameters)124 self._add_new_tag(name, tag, self.treefactory.tag_filter, parameters)
@@ -134,12 +132,11 @@
134 """132 """
135 try:133 try:
136 parameters = parse_search_query(query)134 parameters = parse_search_query(query)
137 except InvalidQuery, e:135 except InvalidQuery as e:
138 Log.warning("Problem with parsing query '%s' (skipping): %s" %136 Log.warning("Problem with parsing query '%s' (skipping): %s" %
139 (query, e.message))137 (query, e.message))
140 return None138 return None
141139
142 name = name.encode("UTF-8")
143140
144 # Create own copy of attributes and add special attributes label, query141 # Create own copy of attributes and add special attributes label, query
145 init_attr = dict(attributes)142 init_attr = dict(attributes)
@@ -176,7 +173,7 @@
176 tag = self.get_tag(oldname)173 tag = self.get_tag(oldname)
177174
178 if not tag.is_search_tag():175 if not tag.is_search_tag():
179 print "Tag renaming not implemented yet"176 print("Tag renaming not implemented yet")
180 return None177 return None
181178
182 query = tag.get_attribute("query")179 query = tag.get_attribute("query")
@@ -360,7 +357,7 @@
360 @return list: a list of TaskSource objects357 @return list: a list of TaskSource objects
361 """358 """
362 result = []359 result = []
363 for backend in self.backends.itervalues():360 for backend in self.backends.values():
364 if backend.is_enabled() or disabled:361 if backend.is_enabled() or disabled:
365 result.append(backend)362 result.append(backend)
366 return result363 return result
@@ -437,7 +434,7 @@
437 return434 return
438435
439 self.is_default_backend_loaded = True436 self.is_default_backend_loaded = True
440 for backend in self.backends.itervalues():437 for backend in self.backends.values():
441 if backend.is_enabled() and not backend.is_default():438 if backend.is_enabled() and not backend.is_default():
442 self._backend_startup(backend)439 self._backend_startup(backend)
443440
@@ -565,7 +562,7 @@
565 thread = threading.Thread(target=b.quit)562 thread = threading.Thread(target=b.quit)
566 threads_dic[b.get_id()] = thread563 threads_dic[b.get_id()] = thread
567 thread.start()564 thread.start()
568 for backend_id, thread in threads_dic.iteritems():565 for backend_id, thread in threads_dic.items():
569 # after 20 seconds, we give up566 # after 20 seconds, we give up
570 thread.join(20)567 thread.join(20)
571 if thread.isAlive():568 if thread.isAlive():
@@ -574,7 +571,7 @@
574 # we save the parameters571 # we save the parameters
575 for b in self.get_all_backends(disabled=True):572 for b in self.get_all_backends(disabled=True):
576 t_xml = doc.createElement("backend")573 t_xml = doc.createElement("backend")
577 for key, value in b.get_parameters().iteritems():574 for key, value in b.get_parameters().items():
578 if key in ["backend", "xmlobject"]:575 if key in ["backend", "xmlobject"]:
579 # We don't want parameters, backend, xmlobject:576 # We don't want parameters, backend, xmlobject:
580 # we'll create them at next startup577 # we'll create them at next startup
581578
=== modified file 'GTG/core/plugins/__init__.py'
--- GTG/core/plugins/__init__.py 2013-11-23 14:40:23 +0000
+++ GTG/core/plugins/__init__.py 2014-01-12 07:15:48 +0000
@@ -21,15 +21,10 @@
21# This is the tool package. It contains some useful function and tool21# This is the tool package. It contains some useful function and tool
22# that could be useful for any part of GTG.22# that could be useful for any part of GTG.
2323
24import os
25
26from GTG import _24from GTG import _
2725
2826
29class GnomeConfig:27class GnomeConfig:
30 current_rep = os.path.dirname(os.path.abspath(__file__))
31 GLADE_FILE = os.path.join(current_rep, "pluginmanager.glade")
32
33 CANLOAD = _("Everything necessary to run this plugin is available.")28 CANLOAD = _("Everything necessary to run this plugin is available.")
34 CANNOTLOAD = _("The plugin can not be loaded")29 CANNOTLOAD = _("The plugin can not be loaded")
35 miss1 = _("Some python modules are missing")30 miss1 = _("Some python modules are missing")
3631
=== modified file 'GTG/core/plugins/api.py'
--- GTG/core/plugins/api.py 2014-01-02 07:08:53 +0000
+++ GTG/core/plugins/api.py 2014-01-12 07:15:48 +0000
@@ -135,7 +135,7 @@
135 """Adds a menu entry to the Plugin Menu of the Main Window135 """Adds a menu entry to the Plugin Menu of the Main Window
136 (task browser).136 (task browser).
137137
138 @param item: The gtk.MenuItem that is going to be added.138 @param item: The Gtk.MenuItem that is going to be added.
139 """139 """
140 widget = self.__builder.get_object('plugin_mi')140 widget = self.__builder.get_object('plugin_mi')
141 widget.get_submenu().append(item)141 widget.get_submenu().append(item)
@@ -145,7 +145,7 @@
145 """Removes a menu entry from the Plugin Menu of the Main Window145 """Removes a menu entry from the Plugin Menu of the Main Window
146 (task browser).146 (task browser).
147147
148 @param item: The gtk.MenuItem that is going to be removed.148 @param item: The Gtk.MenuItem that is going to be removed.
149 @return: Returns C{True} if the operation has sucess or c{False} if it149 @return: Returns C{True} if the operation has sucess or c{False} if it
150 fails.150 fails.
151 """151 """
@@ -162,7 +162,7 @@
162 """Adds a button to the task browser's toolbar or the task editor162 """Adds a button to the task browser's toolbar or the task editor
163 toolbar, depending on which plugin api it's being used.163 toolbar, depending on which plugin api it's being used.
164164
165 @param widget: The gtk.ToolButton that is going to be added to the165 @param widget: The Gtk.ToolButton that is going to be added to the
166 toolbar.166 toolbar.
167 """167 """
168 #-1 means "append to the end"168 #-1 means "append to the end"
@@ -174,17 +174,17 @@
174 """174 """
175 try:175 try:
176 self.__toolbar.remove(widget)176 self.__toolbar.remove(widget)
177 except Exception, e:177 except Exception as e:
178 print "Error removing the toolbar item in the TaskEditor: %s" % e178 print("Error removing the toolbar item in the TaskEditor: %s" % e)
179179
180 def add_widget_to_taskeditor(self, widget):180 def add_widget_to_taskeditor(self, widget):
181 """Adds a widget to the bottom of the task editor dialog181 """Adds a widget to the bottom of the task editor dialog
182182
183 @param widget: The gtk.Widget that is going to be added.183 @param widget: The Gtk.Widget that is going to be added.
184 """184 """
185 vbox = self.__builder.get_object('vbox4')185 vbox = self.__builder.get_object('vbox4')
186 if vbox:186 if vbox:
187 vbox.pack_start(widget)187 vbox.pack_start(widget, True, True, 0)
188 vbox.reorder_child(widget, -2)188 vbox.reorder_child(widget, -2)
189 widget.show_all()189 widget.show_all()
190 self.taskwidget_id += 1190 self.taskwidget_id += 1
@@ -196,14 +196,14 @@
196 def remove_widget_from_taskeditor(self, widg_id):196 def remove_widget_from_taskeditor(self, widg_id):
197 """Remove a widget from the bottom of the task editor dialog197 """Remove a widget from the bottom of the task editor dialog
198198
199 @param widget: The gtk.Widget that is going to be removed199 @param widget: The Gtk.Widget that is going to be removed
200 """200 """
201 if self.is_editor() and widg_id:201 if self.is_editor() and widg_id:
202 try:202 try:
203 wi = self.__builder.get_object('vbox4')203 wi = self.__builder.get_object('vbox4')
204 if wi and widg_id in self.taskwidget_widg:204 if wi and widg_id in self.taskwidget_widg:
205 wi.remove(self.taskwidget_widg.pop(widg_id))205 wi.remove(self.taskwidget_widg.pop(widg_id))
206 except Exception, e:206 except Exception as e:
207 Log.debug("Error removing the toolbar item in the TaskEditor:"207 Log.debug("Error removing the toolbar item in the TaskEditor:"
208 "%s" % e)208 "%s" % e)
209209
@@ -219,7 +219,7 @@
219 if func is None:219 if func is None:
220 func = browser.tv_factory.task_bg_color220 func = browser.tv_factory.task_bg_color
221221
222 for pane in browser.vtree_panes.itervalues():222 for pane in browser.vtree_panes.values():
223 pane.set_bg_color(func, 'bg_color')223 pane.set_bg_color(func, 'bg_color')
224 pane.basetree.get_basetree().refresh_all()224 pane.basetree.get_basetree().refresh_all()
225225
226226
=== modified file 'GTG/core/plugins/engine.py'
--- GTG/core/plugins/engine.py 2013-11-23 14:40:23 +0000
+++ GTG/core/plugins/engine.py 2014-01-12 07:15:48 +0000
@@ -19,7 +19,7 @@
19import imp19import imp
20import os20import os
21import types21import types
22import ConfigParser22import configparser
2323
24import dbus24import dbus
2525
@@ -53,7 +53,7 @@
53 'module_depends': 'dependencies',53 'module_depends': 'dependencies',
54 'dbus_depends': 'dbus-dependencies',54 'dbus_depends': 'dbus-dependencies',
55 }55 }
56 for attr, field in info_fields.iteritems():56 for attr, field in info_fields.items():
57 try:57 try:
58 setattr(self, attr, info[field])58 setattr(self, attr, info[field])
59 except KeyError:59 except KeyError:
@@ -122,12 +122,12 @@
122 f, pathname, desc = imp.find_module(self.module_name, module_path)122 f, pathname, desc = imp.find_module(self.module_name, module_path)
123 module = imp.load_module(self.module_name, f, pathname, desc)123 module = imp.load_module(self.module_name, f, pathname, desc)
124 # find the class object for the actual plugin124 # find the class object for the actual plugin
125 for key, item in module.__dict__.iteritems():125 for key, item in module.__dict__.items():
126 if isinstance(item, types.ClassType):126 if isinstance(item, type):
127 self.plugin_class = item127 self.plugin_class = item
128 self.class_name = item.__dict__['__module__'].split('.')[1]128 self.class_name = item.__dict__['__module__'].split('.')[1]
129 break129 break
130 except ImportError, e:130 except ImportError as e:
131 # load_module() failed, probably because of a module dependency131 # load_module() failed, probably because of a module dependency
132 if len(self.module_depends) > 0:132 if len(self.module_depends) > 0:
133 self._check_module_depends()133 self._check_module_depends()
@@ -135,7 +135,7 @@
135 # no dependencies in info file; use the ImportError instead135 # no dependencies in info file; use the ImportError instead
136 self.missing_modules.append(str(e).split(" ")[3])136 self.missing_modules.append(str(e).split(" ")[3])
137 self.error = True137 self.error = True
138 except Exception, e:138 except Exception as e:
139 # load_module() failed for some other reason139 # load_module() failed for some other reason
140 Log.error(e)140 Log.error(e)
141 self.error = True141 self.error = True
@@ -169,9 +169,9 @@
169 for f in os.listdir(path):169 for f in os.listdir(path):
170 info_file = os.path.join(path, f)170 info_file = os.path.join(path, f)
171 if os.path.isfile(info_file) and f.endswith('.gtg-plugin'):171 if os.path.isfile(info_file) and f.endswith('.gtg-plugin'):
172 info = ConfigParser.ConfigParser()172 info = configparser.ConfigParser()
173 info.read(info_file)173 info.read(info_file)
174 info = dict(info.items("GTG Plugin"))174 info = dict(info.items("GTG Plugin", True))
175 p = Plugin(info, self.plugin_path)175 p = Plugin(info, self.plugin_path)
176 self.plugins[p.module_name] = p176 self.plugins[p.module_name] = p
177177
@@ -188,7 +188,7 @@
188 "disabled",188 "disabled",
189 "all"189 "all"
190 """190 """
191 all_plugins = self.plugins.itervalues()191 all_plugins = iter(self.plugins.values())
192 if kind_of_plugins == "all":192 if kind_of_plugins == "all":
193 return all_plugins193 return all_plugins
194194
@@ -197,7 +197,7 @@
197 (kind_of_plugins == "inactive" and not plugin.active) or197 (kind_of_plugins == "inactive" and not plugin.active) or
198 (kind_of_plugins == "enabled" and plugin.enabled) or198 (kind_of_plugins == "enabled" and plugin.enabled) or
199 (kind_of_plugins == "disabled" and not plugin.enabled))199 (kind_of_plugins == "disabled" and not plugin.enabled))
200 return filter(filter_fun, all_plugins)200 return list(filter(filter_fun, all_plugins))
201201
202 def register_api(self, api):202 def register_api(self, api):
203 '''Adds a plugin api to the list of currently loaded apis'''203 '''Adds a plugin api to the list of currently loaded apis'''
@@ -287,8 +287,8 @@
287 plugin.enabled = False287 plugin.enabled = False
288 else:288 else:
289 self.activate_plguins(self.plugin_apis, [plugin])289 self.activate_plguins(self.plugin_apis, [plugin])
290 except Exception, e:290 except Exception as e:
291 print "Error: %s" % e291 print("Error: %s" % e)
292292
293 def recheck_plugin_errors(self, check_all=False):293 def recheck_plugin_errors(self, check_all=False):
294 """Attempt a reload of plugins with errors, or all plugins."""294 """Attempt a reload of plugins with errors, or all plugins."""
295295
=== modified file 'GTG/core/requester.py'
--- GTG/core/requester.py 2013-11-23 14:40:23 +0000
+++ GTG/core/requester.py 2014-01-12 07:15:48 +0000
@@ -21,13 +21,13 @@
21A nice general purpose interface for the datastore and tagstore21A nice general purpose interface for the datastore and tagstore
22"""22"""
2323
24import gobject24from gi.repository import GObject
2525
26from GTG.core.tag import Tag26from GTG.core.tag import Tag
27from GTG.tools.logger import Log27from GTG.tools.logger import Log
2828
2929
30class Requester(gobject.GObject):30class Requester(GObject.GObject):
31 """ A view on a GTG datastore.31 """ A view on a GTG datastore.
3232
33 L{Requester} is a stateless object that simply provides a nice API for33 L{Requester} is a stateless object that simply provides a nice API for
@@ -39,7 +39,7 @@
3939
40 def __init__(self, datastore, global_conf):40 def __init__(self, datastore, global_conf):
41 """Construct a L{Requester}."""41 """Construct a L{Requester}."""
42 gobject.GObject.__init__(self)42 GObject.GObject.__init__(self)
43 self.ds = datastore43 self.ds = datastore
44 self.__config = global_conf44 self.__config = global_conf
45 self.__basetree = self.ds.get_tasks_tree()45 self.__basetree = self.ds.get_tasks_tree()
@@ -198,7 +198,7 @@
198 tagstore = self.ds.get_tagstore()198 tagstore = self.ds.get_tagstore()
199 view = tagstore.get_viewtree(name='tag_completion', refresh=False)199 view = tagstore.get_viewtree(name='tag_completion', refresh=False)
200 tags = view.get_all_nodes()200 tags = view.get_all_nodes()
201 tags.sort(cmp=lambda x, y: cmp(x.lower(), y.lower()))201 tags.sort(key=str.lower)
202 return tags202 return tags
203203
204 def get_all_tags(self):204 def get_all_tags(self):
205205
=== modified file 'GTG/core/tag.py'
--- GTG/core/tag.py 2013-11-23 14:40:23 +0000
+++ GTG/core/tag.py 2014-01-12 07:15:48 +0000
@@ -28,6 +28,7 @@
2828
29from GTG.core import CoreConfig29from GTG.core import CoreConfig
30from liblarch import TreeNode30from liblarch import TreeNode
31from functools import reduce
3132
3233
33class Tag(TreeNode):34class Tag(TreeNode):
@@ -54,7 +55,7 @@
54 self.req = req55 self.req = req
55 self._save = None56 self._save = None
56 self._attributes = {'name': self._name}57 self._attributes = {'name': self._name}
57 for key, value in attributes.iteritems():58 for key, value in attributes.items():
58 self.set_attribute(key, value)59 self.set_attribute(key, value)
5960
60 self.viewcount = None61 self.viewcount = None
@@ -126,7 +127,7 @@
126 modified = True127 modified = True
127 else:128 else:
128 # Attributes should all be strings.129 # Attributes should all be strings.
129 val = unicode(str(att_value), "UTF-8")130 val = str(att_value)
130 self._attributes[att_name] = val131 self._attributes[att_name] = val
131 if self._save:132 if self._save:
132 self._save()133 self._save()
@@ -174,7 +175,7 @@
174 names.175 names.
175 @param withparent: If True, the "parent" attribute is attached176 @param withparent: If True, the "parent" attribute is attached
176 """177 """
177 attributes = self._attributes.keys()178 attributes = list(self._attributes.keys())
178 if butname:179 if butname:
179 attributes.remove('name')180 attributes.remove('name')
180 if withparent:181 if withparent:
181182
=== modified file 'GTG/core/task.py'
--- GTG/core/task.py 2013-12-17 14:39:47 +0000
+++ GTG/core/task.py 2014-01-12 07:15:48 +0000
@@ -47,7 +47,7 @@
47 TreeNode.__init__(self, ze_id)47 TreeNode.__init__(self, ze_id)
48 # the id of this task in the project should be set48 # the id of this task in the project should be set
49 # tid is a string ! (we have to choose a type and stick to it)49 # tid is a string ! (we have to choose a type and stick to it)
50 assert(isinstance(ze_id, str) or isinstance(ze_id, unicode))50 assert(isinstance(ze_id, str) or isinstance(ze_id, str))
51 self.tid = str(ze_id)51 self.tid = str(ze_id)
52 self.set_uuid(uuid.uuid4())52 self.set_uuid(uuid.uuid4())
53 self.remote_ids = {}53 self.remote_ids = {}
@@ -128,8 +128,6 @@
128 # We should check for other task with the same title128 # We should check for other task with the same title
129 # In that case, we should add a number (like Tomboy does)129 # In that case, we should add a number (like Tomboy does)
130 old_title = self.title130 old_title = self.title
131 if isinstance(title, str):
132 title = title.decode('utf8')
133 if title:131 if title:
134 self.title = title.strip('\t\n')132 self.title = title.strip('\t\n')
135 else:133 else:
@@ -360,7 +358,8 @@
360 return self.due_date358 return self.due_date
361359
362 def get_urgent_date(self):360 def get_urgent_date(self):
363 """Returns the most urgent due date among the task and it's subtasks"""361 """ Returns the most urgent due date among the tasks and its subtasks
362 """
364 urg_date = self.due_date363 urg_date = self.due_date
365 for sub in self.get_subtasks():364 for sub in self.get_subtasks():
366 sub_urg_date = sub.get_urgent_date()365 sub_urg_date = sub.get_urgent_date()
@@ -568,7 +567,7 @@
568 # (Lionel)567 # (Lionel)
569 # Agreed. it's only used by the "add tag to all subtasks" widget.568 # Agreed. it's only used by the "add tag to all subtasks" widget.
570 def get_self_and_all_subtasks(self, active_only=False, tasks=[]):569 def get_self_and_all_subtasks(self, active_only=False, tasks=[]):
571 print "DEPRECATED FUNCTION: get_self_and_all_subtasks"570 print("DEPRECATED FUNCTION: get_self_and_all_subtasks")
572 tasks.append(self)571 tasks.append(self)
573 for tid in self.get_children():572 for tid in self.get_children():
574 i = self.req.get_task(tid)573 i = self.req.get_task(tid)
@@ -579,7 +578,7 @@
579578
580 def get_subtask(self, tid):579 def get_subtask(self, tid):
581 # FIXME : remove this function. This is not useful580 # FIXME : remove this function. This is not useful
582 print "DEPRECATED: get_subtask"581 print("DEPRECATED: get_subtask")
583 """Return the task corresponding to a given ID.582 """Return the task corresponding to a given ID.
584583
585 @param tid: the ID of the task to return.584 @param tid: the ID of the task to return.
@@ -605,7 +604,7 @@
605 @param att_value: The value of the attribute. Will be converted to a604 @param att_value: The value of the attribute. Will be converted to a
606 string.605 string.
607 """606 """
608 val = unicode(str(att_value), "UTF-8")607 val = str(att_value)
609 self.attributes[(namespace, att_name)] = val608 self.attributes[(namespace, att_name)] = val
610 self.sync()609 self.sync()
611610
@@ -662,18 +661,17 @@
662 """661 """
663 Adds a tag. Does not add '@tag' to the contents. See add_tag662 Adds a tag. Does not add '@tag' to the contents. See add_tag
664 """663 """
665 t = tagname.encode("UTF-8")
666 # Do not add the same tag twice664 # Do not add the same tag twice
667 if not t in self.tags:665 if not tagname in self.tags:
668 self.tags.append(t)666 self.tags.append(tagname)
669 if self.is_loaded():667 if self.is_loaded():
670 for child in self.get_subtasks():668 for child in self.get_subtasks():
671 if child.can_be_deleted:669 if child.can_be_deleted:
672 child.add_tag(t)670 child.add_tag(tagname)
673671
674 tag = self.req.get_tag(t)672 tag = self.req.get_tag(tagname)
675 if not tag:673 if not tag:
676 tag = self.req.new_tag(t)674 tag = self.req.new_tag(tagname)
677 tag.modified()675 tag.modified()
678 return True676 return True
679677
680678
=== modified file 'GTG/gtg.py'
--- GTG/gtg.py 2013-11-23 14:40:23 +0000
+++ GTG/gtg.py 2014-01-12 07:15:48 +0000
@@ -1,4 +1,4 @@
1#!/usr/bin/env python21#!/usr/bin/env python3
2# -*- coding: utf-8 -*-2# -*- coding: utf-8 -*-
3# -----------------------------------------------------------------------------3# -----------------------------------------------------------------------------
4# Getting Things GNOME! - a personal organizer for the GNOME desktop4# Getting Things GNOME! - a personal organizer for the GNOME desktop
@@ -74,7 +74,7 @@
74 pidfile = os.path.join(directory, "gtg.pid")74 pidfile = os.path.join(directory, "gtg.pid")
75 if not os.path.exists(pidfile):75 if not os.path.exists(pidfile):
76 open(pidfile, "w").close()76 open(pidfile, "w").close()
77 os.chmod(pidfile, 0600)77 os.chmod(pidfile, 0o600)
7878
79 # see if gtg is already running79 # see if gtg is already running
80 pid = open(pidfile, "r").readline()80 pid = open(pidfile, "r").readline()
@@ -82,7 +82,7 @@
82 p = os.system("/bin/ps %s >/dev/null" % pid)82 p = os.system("/bin/ps %s >/dev/null" % pid)
83 p_name = os.popen("/bin/ps -f %s" % pid).read()83 p_name = os.popen("/bin/ps -f %s" % pid).read()
84 if p == 0 and "gtg" in p_name:84 if p == 0 and "gtg" in p_name:
85 print _("gtg is already running!")85 print(_("gtg is already running!"))
86 try:86 try:
87 d = dbus.SessionBus().get_object(CoreConfig.BUSNAME,87 d = dbus.SessionBus().get_object(CoreConfig.BUSNAME,
88 CoreConfig.BUSINTERFACE)88 CoreConfig.BUSINTERFACE)
8989
=== modified file 'GTG/gtk/__init__.py'
--- GTG/gtk/__init__.py 2013-11-23 14:40:23 +0000
+++ GTG/gtk/__init__.py 2014-01-12 07:15:48 +0000
@@ -17,14 +17,14 @@
17# this program. If not, see <http://www.gnu.org/licenses/>.17# this program. If not, see <http://www.gnu.org/licenses/>.
18# -----------------------------------------------------------------------------18# -----------------------------------------------------------------------------
1919
20""" Configuration for browser, it contains path to .glade files """20""" Configuration for browser, it contains path to .ui files """
2121
22import os22import os
2323
2424
25class ViewConfig:25class ViewConfig(object):
26 current_rep = os.path.dirname(os.path.abspath(__file__))26 current_rep = os.path.dirname(os.path.abspath(__file__))
27 DELETE_GLADE_FILE = os.path.join(current_rep, "deletion.glade")27 DELETE_UI_FILE = os.path.join(current_rep, "deletion.ui")
28 PREFERENCES_GLADE_FILE = os.path.join(current_rep, "preferences.glade")28 PREFERENCES_UI_FILE = os.path.join(current_rep, "preferences.ui")
29 PLUGINS_GLADE_FILE = os.path.join(current_rep, "plugins.glade")29 PLUGINS_UI_FILE = os.path.join(current_rep, "plugins.ui")
30 BACKENDS_GLADE_FILE = os.path.join(current_rep, "backends_dialog.glade")30 BACKENDS_UI_FILE = os.path.join(current_rep, "backends_dialog.ui")
3131
=== renamed file 'GTG/gtk/backends_dialog.glade' => 'GTG/gtk/backends_dialog.ui'
--- GTG/gtk/backends_dialog.glade 2012-11-10 12:08:18 +0000
+++ GTG/gtk/backends_dialog.ui 2014-01-12 07:15:48 +0000
@@ -1,7 +1,6 @@
1<?xml version="1.0" encoding="UTF-8"?>1<?xml version="1.0" encoding="UTF-8"?>
2<interface>2<interface>
3 <requires lib="gtk+" version="2.16"/>3 <!-- interface-requires gtk+ 3.0 -->
4 <!-- interface-naming-policy project-wide -->
5 <object class="GtkAdjustment" id="adjustment1">4 <object class="GtkAdjustment" id="adjustment1">
6 <property name="upper">100</property>5 <property name="upper">100</property>
7 <property name="step_increment">1</property>6 <property name="step_increment">1</property>
@@ -11,7 +10,7 @@
11 <object class="GtkWindow" id="backends_dialog">10 <object class="GtkWindow" id="backends_dialog">
12 <property name="can_focus">False</property>11 <property name="can_focus">False</property>
13 <property name="window_position">mouse</property>12 <property name="window_position">mouse</property>
14 <signal name="delete-event" handler="on_BackendsDialog_delete_event" swapped="no"/>13 <signal name="delete_event" handler="on_BackendsDialog_delete_event"/>
15 <child>14 <child>
16 <object class="GtkAlignment" id="alignment1">15 <object class="GtkAlignment" id="alignment1">
17 <property name="visible">True</property>16 <property name="visible">True</property>
@@ -21,19 +20,21 @@
21 <property name="left_padding">10</property>20 <property name="left_padding">10</property>
22 <property name="right_padding">10</property>21 <property name="right_padding">10</property>
23 <child>22 <child>
24 <object class="GtkVBox" id="vbox1">23 <object class="GtkBox" id="vbox1">
25 <property name="visible">True</property>24 <property name="visible">True</property>
26 <property name="can_focus">False</property>25 <property name="can_focus">False</property>
27 <property name="spacing">10</property>26 <property name="spacing">10</property>
27 <property name="orientation">vertical</property>
28 <child>28 <child>
29 <object class="GtkHBox" id="big_central_hbox">29 <object class="GtkBox" id="big_central_box">
30 <property name="visible">True</property>30 <property name="visible">True</property>
31 <property name="can_focus">False</property>31 <property name="can_focus">False</property>
32 <property name="spacing">10</property>32 <property name="spacing">10</property>
33 <child>33 <child>
34 <object class="GtkVBox" id="vbox2">34 <object class="GtkBox" id="vbox2">
35 <property name="visible">True</property>35 <property name="visible">True</property>
36 <property name="can_focus">False</property>36 <property name="can_focus">False</property>
37 <property name="orientation">vertical</property>
37 <child>38 <child>
38 <object class="GtkViewport" id="treeview_window">39 <object class="GtkViewport" id="treeview_window">
39 <property name="height_request">400</property>40 <property name="height_request">400</property>
@@ -60,7 +61,7 @@
60 <property name="left_padding">10</property>61 <property name="left_padding">10</property>
61 <property name="right_padding">10</property>62 <property name="right_padding">10</property>
62 <child>63 <child>
63 <object class="GtkHButtonBox" id="hbuttonbox3">64 <object class="GtkButtonBox" id="hbuttonbox3">
64 <property name="visible">True</property>65 <property name="visible">True</property>
65 <property name="can_focus">False</property>66 <property name="can_focus">False</property>
66 <property name="spacing">10</property>67 <property name="spacing">10</property>
@@ -145,7 +146,7 @@
145 </packing>146 </packing>
146 </child>147 </child>
147 <child>148 <child>
148 <object class="GtkHButtonBox" id="hbuttonbox2">149 <object class="GtkButtonBox" id="hbuttonbox2">
149 <property name="visible">True</property>150 <property name="visible">True</property>
150 <property name="can_focus">False</property>151 <property name="can_focus">False</property>
151 <property name="layout_style">edge</property>152 <property name="layout_style">edge</property>
152153
=== modified file 'GTG/gtk/backends_dialog/__init__.py'
--- GTG/gtk/backends_dialog/__init__.py 2013-11-23 14:40:23 +0000
+++ GTG/gtk/backends_dialog/__init__.py 2014-01-12 07:15:48 +0000
@@ -26,7 +26,7 @@
26 panel (these are called also "views" in this class)26 panel (these are called also "views" in this class)
27'''27'''
2828
29import gtk29from gi.repository import Gtk
3030
31from webbrowser import open as openurl31from webbrowser import open as openurl
3232
@@ -68,9 +68,8 @@
68 self.backends_tv = None68 self.backends_tv = None
69 self.config_panel = None69 self.config_panel = None
70 self.add_panel = None70 self.add_panel = None
71 # Load from Glade71 builder = Gtk.Builder()
72 builder = gtk.Builder()72 self._load_widgets_from_builder(builder)
73 self._load_widgets_from_glade(builder)
74 # Load and setup other widgets73 # Load and setup other widgets
75 self.dialog.set_title(_("Synchronization Services - %s" % info.NAME))74 self.dialog.set_title(_("Synchronization Services - %s" % info.NAME))
76 self._create_widgets_for_add_panel()75 self._create_widgets_for_add_panel()
@@ -119,14 +118,14 @@
119 @param height: the height of the returned pixbuf118 @param height: the height of the returned pixbuf
120 @param width: the width of the returned pixbuf119 @param width: the width of the returned pixbuf
121120
122 @returns gtk.gdk.Pixbuf: a pixbuf containing the wanted icon, or None121 @returns GdkPixbuf: a pixbuf containing the wanted icon, or None
123 (if the icon is not present)122 (if the icon is not present)
124 '''123 '''
125 icon_info = self.icon_theme.lookup_icon(name, height, 0)124 icon_info = self.icon_theme.lookup_icon(name, height, 0)
126 if icon_info is None:125 if icon_info is None:
127 return None126 return None
128 else:127 else:
129 return gtk.icon_theme_get_default().load_icon(name, height, 0)128 return Gtk.IconTheme.get_default().load_icon(name, height, 0)
130129
131 def _show_panel(self, panel_name):130 def _show_panel(self, panel_name):
132 '''131 '''
@@ -147,7 +146,7 @@
147 Log.error("panel name unknown")146 Log.error("panel name unknown")
148 return147 return
149 # Central pane148 # Central pane
150 # NOTE: self.central_pane is the gtk.Container in which we load panels149 # NOTE: self.central_pane is the Gtk.Container in which we load panels
151 if panel_to_remove in self.central_pane:150 if panel_to_remove in self.central_pane:
152 self.central_pane.remove(panel_to_remove)151 self.central_pane.remove(panel_to_remove)
153 if not panel_to_add in self.central_pane:152 if not panel_to_add in self.central_pane:
@@ -167,13 +166,13 @@
167########################################166########################################
168### WIDGETS AND SIGNALS ################167### WIDGETS AND SIGNALS ################
169########################################168########################################
170 def _load_widgets_from_glade(self, builder):169 def _load_widgets_from_builder(self, builder):
171 '''170 '''
172 Loads widgets from the glade file171 Loads widgets from the builder .ui file
173172
174 @param builder: a gtk.Builder173 @param builder: a Gtk.Builder
175 '''174 '''
176 builder.add_from_file(ViewConfig.BACKENDS_GLADE_FILE)175 builder.add_from_file(ViewConfig.BACKENDS_UI_FILE)
177 widgets = {176 widgets = {
178 'dialog': 'backends_dialog',177 'dialog': 'backends_dialog',
179 'treeview_window': 'treeview_window',178 'treeview_window': 'treeview_window',
@@ -181,14 +180,14 @@
181 'add_button': 'add_button',180 'add_button': 'add_button',
182 'remove_button': 'remove_button',181 'remove_button': 'remove_button',
183 }182 }
184 for attr, widget in widgets.iteritems():183 for attr, widget in widgets.items():
185 setattr(self, attr, builder.get_object(widget))184 setattr(self, attr, builder.get_object(widget))
186185
187 def _setup_signal_connections(self, builder):186 def _setup_signal_connections(self, builder):
188 '''187 '''
189 Creates some GTK signals connections188 Creates some GTK signals connections
190189
191 @param builder: a gtk.Builder190 @param builder: a Gtk.Builder
192 '''191 '''
193 signals = {192 signals = {
194 'on_add_button_clicked': self.on_add_button,193 'on_add_button_clicked': self.on_add_button,
@@ -205,7 +204,7 @@
205 Inform gtk on the location of the backends icons (which is in204 Inform gtk on the location of the backends icons (which is in
206 the GTG directory tree, and not in the default location for icons205 the GTG directory tree, and not in the default location for icons
207 '''206 '''
208 self.icon_theme = gtk.icon_theme_get_default()207 self.icon_theme = Gtk.IconTheme.get_default()
209 for directory in CoreConfig().get_icons_directories():208 for directory in CoreConfig().get_icons_directories():
210 self.icon_theme.prepend_search_path(directory)209 self.icon_theme.prepend_search_path(directory)
211210
@@ -285,17 +284,17 @@
285 # no backend selected284 # no backend selected
286 return285 return
287 backend = self.req.get_backend(backend_id)286 backend = self.req.get_backend(backend_id)
288 dialog = gtk.MessageDialog(287 dialog = Gtk.MessageDialog(
289 parent=self.dialog,288 parent=self.dialog,
290 flags=gtk.DIALOG_DESTROY_WITH_PARENT,289 flags=Gtk.DialogFlags.DESTROY_WITH_PARENT,
291 type=gtk.MESSAGE_QUESTION,290 type=Gtk.MessageType.QUESTION,
292 buttons=gtk.BUTTONS_YES_NO,291 buttons=Gtk.ButtonsType.YES_NO,
293 message_format=_("Do you really want to remove the '%s' "292 message_format=_("Do you really want to remove the '%s' "
294 "synchronization service?") %293 "synchronization service?") %
295 backend.get_human_name())294 backend.get_human_name())
296 response = dialog.run()295 response = dialog.run()
297 dialog.destroy()296 dialog.destroy()
298 if response == gtk.RESPONSE_YES:297 if response == Gtk.ResponseType.YES:
299 # delete the backend and remove it from the lateral treeview298 # delete the backend and remove it from the lateral treeview
300 self.req.remove_backend(backend_id)299 self.req.remove_backend(backend_id)
301 self.backends_tv.remove_backend(backend_id)300 self.backends_tv.remove_backend(backend_id)
302301
=== modified file 'GTG/gtk/backends_dialog/addpanel.py'
--- GTG/gtk/backends_dialog/addpanel.py 2013-11-23 14:40:23 +0000
+++ GTG/gtk/backends_dialog/addpanel.py 2014-01-12 07:15:48 +0000
@@ -17,16 +17,18 @@
17# this program. If not, see <http://www.gnu.org/licenses/>.17# this program. If not, see <http://www.gnu.org/licenses/>.
18# -----------------------------------------------------------------------------18# -----------------------------------------------------------------------------
1919
20import gtk20from gi.repository import Gtk
2121
22from GTG.gtk.backends_dialog.backendscombo import BackendsCombo22from GTG.gtk.backends_dialog.backendscombo import BackendsCombo
23from GTG.backends import BackendFactory23from GTG.backends import BackendFactory
24from GTG import _, ngettext24from GTG import _, ngettext
2525from functools import reduce
2626
27class AddPanel(gtk.VBox):27
28class AddPanel(Gtk.Box):
28 '''29 '''
29 A VBox filled with gtk widgets to let the user choose a new backend.30 A vertical Box filled with gtk widgets to let the user choose a new
31 backend.
30 '''32 '''
3133
32 def __init__(self, backends_dialog):34 def __init__(self, backends_dialog):
@@ -36,7 +38,7 @@
36 @param backends_dialog: a reference to the dialog in which this is38 @param backends_dialog: a reference to the dialog in which this is
37 loaded39 loaded
38 '''40 '''
39 super(AddPanel, self).__init__()41 super(AddPanel, self).__init__(orientation=Gtk.Orientation.VERTICAL)
40 self.dialog = backends_dialog42 self.dialog = backends_dialog
41 self._create_widgets()43 self._create_widgets()
4244
@@ -46,90 +48,90 @@
46 '''48 '''
47 # Division of the available space in three segments:49 # Division of the available space in three segments:
48 # top, middle and bottom.50 # top, middle and bottom.
49 top = gtk.HBox()51 top = Gtk.Box()
50 top.set_spacing(6)52 top.set_spacing(6)
51 middle = gtk.HBox()53 middle = Gtk.Box()
52 bottom = gtk.HBox()54 bottom = Gtk.Box()
53 self._fill_top_hbox(top)55 self._fill_top_box(top)
54 self._fill_middle_hbox(middle)56 self._fill_middle_box(middle)
55 self._fill_bottom_hbox(bottom)57 self._fill_bottom_box(bottom)
56 self.pack_start(top, False)58 self.pack_start(top, False, True, 0)
57 self.pack_start(middle, True)59 self.pack_start(middle, True, True, 0)
58 self.pack_start(bottom, True)60 self.pack_start(bottom, True, True, 0)
59 self.set_border_width(12)61 self.set_border_width(12)
6062
61 def _fill_top_hbox(self, hbox):63 def _fill_top_box(self, box):
62 '''64 '''
63 Helper function to fill and hbox with a combobox that lists the65 Helper function to fill and box with a combobox that lists the
64 available backends and a gtk.Label.66 available backends and a Gtk.Label.
6567
66 @param hbox: the gtk.HBox to fill68 @param box: the Gtk.Box to fill
67 '''69 '''
68 label = gtk.Label(_("Select synchronization service:"))70 label = Gtk.Label(label=_("Select synchronization service:"))
69 label.set_alignment(0, 0.5)71 label.set_alignment(0, 0.5)
70 self.combo_types = BackendsCombo(self.dialog)72 self.combo_types = BackendsCombo(self.dialog)
71 self.combo_types.child.connect('changed', self.on_combo_changed)73 #FIXME
72 hbox.pack_start(label, False, True)74 #self.combo_types.get_child().connect('changed', self.on_combo_changed)
73 hbox.pack_start(self.combo_types, False, True)75 self.combo_types.connect('changed', self.on_combo_changed)
7476 box.pack_start(label, False, True, 0)
75 def _fill_middle_hbox(self, hbox):77 box.pack_start(self.combo_types, False, True, 0)
76 '''78
77 Helper function to fill an hbox with a label describing the backend79 def _fill_middle_box(self, box):
78 and a gtk.Image (that loads the backend image)80 '''
7981 Helper function to fill an box with a label describing the backend
80 @param hbox: the gtk.HBox to fill82 and a Gtk.Image (that loads the backend image)
81 '''83
82 self.label_name = gtk.Label("name")84 @param box: the Gtk.Box to fill
85 '''
86 self.label_name = Gtk.Label(label="name")
83 self.label_name.set_alignment(xalign=0.5, yalign=1)87 self.label_name.set_alignment(xalign=0.5, yalign=1)
84 self.label_description = gtk.Label()88 self.label_description = Gtk.Label()
85 self.label_description.set_justify(gtk.JUSTIFY_FILL)89 self.label_description.set_justify(Gtk.Justification.FILL)
86 self.label_description.set_line_wrap(True)90 self.label_description.set_line_wrap(True)
87 self.label_description.set_size_request(300, -1)91 self.label_description.set_size_request(300, -1)
88 self.label_description.set_alignment(xalign=0, yalign=0.5)92 self.label_description.set_alignment(xalign=0, yalign=0.5)
89 self.label_author = gtk.Label("")93 self.label_author = Gtk.Label(label="")
90 self.label_author.set_line_wrap(True)94 self.label_author.set_line_wrap(True)
91 self.label_author.set_alignment(xalign=0, yalign=0)95 self.label_author.set_alignment(xalign=0, yalign=0)
92 self.label_modules = gtk.Label("")96 self.label_modules = Gtk.Label(label="")
93 self.label_modules.set_line_wrap(True)97 self.label_modules.set_line_wrap(True)
94 self.label_modules.set_alignment(xalign=0, yalign=0)98 self.label_modules.set_alignment(xalign=0, yalign=0)
95 self.image_icon = gtk.Image()99 self.image_icon = Gtk.Image()
96 self.image_icon.set_size_request(128, 128)100 self.image_icon.set_size_request(128, 128)
97 align_image = gtk.Alignment(xalign=1, yalign=0)101 align_image = Gtk.Alignment.new(1, 0, 0, 0)
98 align_image.add(self.image_icon)102 align_image.add(self.image_icon)
99 labels_vbox = gtk.VBox()103 labels_vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
100 labels_vbox.pack_start(self.label_description, True, True, padding=10)104 labels_vbox.pack_start(self.label_description, True, True, 10)
101 labels_vbox.pack_start(self.label_author, True, True)105 labels_vbox.pack_start(self.label_author, True, True, 0)
102 labels_vbox.pack_start(self.label_modules, True, True)106 labels_vbox.pack_start(self.label_modules, True, True, 0)
103 low_hbox = gtk.HBox()107 low_box = Gtk.Box()
104 low_hbox.pack_start(labels_vbox, True, True)108 low_box.pack_start(labels_vbox, True, True, 0)
105 low_hbox.pack_start(align_image, True, True)109 low_box.pack_start(align_image, True, True, 0)
106 vbox = gtk.VBox()110 vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
107 vbox.pack_start(self.label_name, True, True)111 vbox.pack_start(self.label_name, True, True, 0)
108 vbox.pack_start(low_hbox, True, True)112 vbox.pack_start(low_box, True, True, 0)
109 hbox.pack_start(vbox, True, True)113 box.pack_start(vbox, True, True, 0)
110114
111 def _fill_bottom_hbox(self, hbox):115 def _fill_bottom_box(self, box):
112 '''116 '''
113 Helper function to fill and hbox with a buttonbox, featuring117 Helper function to fill and box with a buttonbox, featuring
114 and ok and cancel buttons.118 and ok and cancel buttons.
115119
116 @param hbox: the gtk.HBox to fill120 @param box: the Gtk.Box to fill
117 '''121 '''
118 cancel_button = gtk.Button(stock=gtk.STOCK_CANCEL)122 cancel_button = Gtk.Button(stock=Gtk.STOCK_CANCEL)
119 cancel_button.connect('clicked', self.on_cancel)123 cancel_button.connect('clicked', self.on_cancel)
120 self.ok_button = gtk.Button(stock=gtk.STOCK_OK)124 self.ok_button = Gtk.Button(stock=Gtk.STOCK_OK)
121 self.ok_button.connect('clicked', self.on_confirm)125 self.ok_button.connect('clicked', self.on_confirm)
122 align = gtk.Alignment(xalign=0.5,126 align = Gtk.Alignment.new(0.5, 1, 1, 0)
123 yalign=1,
124 xscale=1)
125 align.set_padding(0, 10, 0, 0)127 align.set_padding(0, 10, 0, 0)
126 buttonbox = gtk.HButtonBox()128 buttonbox = Gtk.ButtonBox()
127 buttonbox.set_layout(gtk.BUTTONBOX_EDGE)129 buttonbox.set_layout(Gtk.ButtonBoxStyle.EDGE)
128 buttonbox.add(cancel_button)130 buttonbox.add(cancel_button)
129 buttonbox.set_child_secondary(cancel_button, False)131 buttonbox.set_child_secondary(cancel_button, False)
130 buttonbox.add(self.ok_button)132 buttonbox.add(self.ok_button)
131 align.add(buttonbox)133 align.add(buttonbox)
132 hbox.pack_start(align, True, True)134 box.pack_start(align, True, True, 0)
133135
134 def refresh_backends(self):136 def refresh_backends(self):
135 '''Populates the combo box containing the available backends'''137 '''Populates the combo box containing the available backends'''
@@ -137,7 +139,7 @@
137139
138 def on_confirm(self, widget=None):140 def on_confirm(self, widget=None):
139 '''141 '''
140 Notifies the dialog holding this VBox that a backend has been142 Notifies the dialog holding this Box that a backend has been
141 chosen143 chosen
142144
143 @param widget: just to make this function usable as a signal callback.145 @param widget: just to make this function usable as a signal callback.
144146
=== modified file 'GTG/gtk/backends_dialog/backendscombo.py'
--- GTG/gtk/backends_dialog/backendscombo.py 2013-11-23 14:40:23 +0000
+++ GTG/gtk/backends_dialog/backendscombo.py 2014-01-12 07:15:48 +0000
@@ -17,12 +17,13 @@
17# this program. If not, see <http://www.gnu.org/licenses/>.17# this program. If not, see <http://www.gnu.org/licenses/>.
18# -----------------------------------------------------------------------------18# -----------------------------------------------------------------------------
1919
20import gtk20from gi.repository import Gtk
21from gi.repository import GdkPixbuf
2122
22from GTG.backends import BackendFactory23from GTG.backends import BackendFactory
2324
2425
25class BackendsCombo(gtk.ComboBoxEntry):26class BackendsCombo(Gtk.ComboBox):
26 '''27 '''
27 A combobox listing all the available backends types28 A combobox listing all the available backends types
28 '''29 '''
@@ -39,7 +40,7 @@
39 @param backends_dialog: reference to the dialog in which this combo is40 @param backends_dialog: reference to the dialog in which this combo is
40 loaded.41 loaded.
41 '''42 '''
42 super(BackendsCombo, self).__init__()43 Gtk.ComboBox.__init__(self)
43 self.dialog = backends_dialog44 self.dialog = backends_dialog
44 self._liststore_init()45 self._liststore_init()
45 self._renderers_init()46 self._renderers_init()
@@ -47,18 +48,18 @@
47 self.show_all()48 self.show_all()
4849
49 def _liststore_init(self):50 def _liststore_init(self):
50 '''Setup the gtk.ListStore'''51 '''Setup the Gtk.ListStore'''
51 self.liststore = gtk.ListStore(str, str, gtk.gdk.Pixbuf)52 self.liststore = Gtk.ListStore(str, str, GdkPixbuf.Pixbuf)
52 self.set_model(self.liststore)53 self.set_model(self.liststore)
5354
54 def _renderers_init(self):55 def _renderers_init(self):
55 '''Configure the cell renderers'''56 '''Configure the cell renderers'''
56 # Text renderer57 # Text renderer
57 text_cell = gtk.CellRendererText()58 text_cell = Gtk.CellRendererText()
58 self.pack_start(text_cell, False)59 self.pack_start(text_cell, False)
59 self.set_text_column(self.COLUMN_HUMAN_NAME)60 self.add_attribute(text_cell, 'text', 1)
60 # Icon renderer61 # Icon renderer
61 pixbuf_cell = gtk.CellRendererPixbuf()62 pixbuf_cell = Gtk.CellRendererPixbuf()
62 self.pack_start(pixbuf_cell, False)63 self.pack_start(pixbuf_cell, False)
63 self.add_attribute(pixbuf_cell, "pixbuf", self.COLUMN_ICON)64 self.add_attribute(pixbuf_cell, "pixbuf", self.COLUMN_ICON)
6465
@@ -68,7 +69,7 @@
68 '''69 '''
69 self.liststore.clear()70 self.liststore.clear()
70 backend_types = BackendFactory().get_all_backends()71 backend_types = BackendFactory().get_all_backends()
71 for name, module in backend_types.iteritems():72 for name, module in backend_types.items():
72 # FIXME: Disable adding another localfile backend.73 # FIXME: Disable adding another localfile backend.
73 # It just produce many warnings, provides no use case74 # It just produce many warnings, provides no use case
74 # See LP bug #940917 (Izidor)75 # See LP bug #940917 (Izidor)
7576
=== modified file 'GTG/gtk/backends_dialog/backendstree.py'
--- GTG/gtk/backends_dialog/backendstree.py 2013-11-23 14:40:23 +0000
+++ GTG/gtk/backends_dialog/backendstree.py 2014-01-12 07:15:48 +0000
@@ -17,16 +17,17 @@
17# this program. If not, see <http://www.gnu.org/licenses/>.17# this program. If not, see <http://www.gnu.org/licenses/>.
18# -----------------------------------------------------------------------------18# -----------------------------------------------------------------------------
1919
20import gtk20from gi.repository import Gtk
21from gi.repository import GdkPixbuf
2122
22from GTG.gtk.colors import get_colored_tags_markup23from GTG.gtk.colors import get_colored_tags_markup
23from GTG.backends.genericbackend import GenericBackend24from GTG.backends.genericbackend import GenericBackend
24from GTG.backends.backendsignals import BackendSignals25from GTG.backends.backendsignals import BackendSignals
2526
2627
27class BackendsTree(gtk.TreeView):28class BackendsTree(Gtk.TreeView):
28 '''29 '''
29 gtk.TreeView that shows the currently loaded backends.30 Gtk.TreeView that shows the currently loaded backends.
30 '''31 '''
3132
32 COLUMN_BACKEND_ID = 0 # never shown, used for internal lookup.33 COLUMN_BACKEND_ID = 0 # never shown, used for internal lookup.
@@ -50,7 +51,7 @@
50 self.refresh()51 self.refresh()
5152
52 def refresh(self):53 def refresh(self):
53 '''refreshes the gtk.Liststore'''54 '''refreshes the Gtk.Liststore'''
54 self.backendid_to_iter = {}55 self.backendid_to_iter = {}
55 self.liststore.clear()56 self.liststore.clear()
5657
@@ -110,7 +111,6 @@
110 @param backend_id: the id of the backend to add111 @param backend_id: the id of the backend to add
111 '''112 '''
112 if backend_id in self.backendid_to_iter:113 if backend_id in self.backendid_to_iter:
113 style = self.get_style()
114 b_iter = self.backendid_to_iter[backend_id]114 b_iter = self.backendid_to_iter[backend_id]
115 b_path = self.liststore.get_path(b_iter)115 b_path = self.liststore.get_path(b_iter)
116 backend = self.req.get_backend(backend_id)116 backend = self.req.get_backend(backend_id)
@@ -118,7 +118,12 @@
118 if backend.is_enabled():118 if backend.is_enabled():
119 text = backend_name119 text = backend_name
120 else:120 else:
121 color = str(style.text[gtk.STATE_INSENSITIVE])121 #FIXME This snippet is on more than 2 places!!!
122 #FIXME create a function which takes a widget and
123 #flag and returns color as #RRGGBB
124 style_context = self.get_style_context()
125 color = style_context.get_color(Gtk.StateFlags.INSENSITIVE)
126 color = color.to_color().to_string()
122 text = "<span color='%s'>%s</span>" % \127 text = "<span color='%s'>%s</span>" % \
123 (color, backend_name)128 (color, backend_name)
124 self.liststore[b_path][self.COLUMN_TEXT] = text129 self.liststore[b_path][self.COLUMN_TEXT] = text
@@ -153,7 +158,7 @@
153158
154 def _init_liststore(self):159 def _init_liststore(self):
155 '''Creates the liststore'''160 '''Creates the liststore'''
156 self.liststore = gtk.ListStore(object, gtk.gdk.Pixbuf, str, str)161 self.liststore = Gtk.ListStore(object, GdkPixbuf.Pixbuf, str, str)
157 self.set_model(self.liststore)162 self.set_model(self.liststore)
158163
159 def _init_renderers(self):164 def _init_renderers(self):
@@ -161,29 +166,29 @@
161 # We hide the columns headers166 # We hide the columns headers
162 self.set_headers_visible(False)167 self.set_headers_visible(False)
163 # For the backend icon168 # For the backend icon
164 pixbuf_cell = gtk.CellRendererPixbuf()169 pixbuf_cell = Gtk.CellRendererPixbuf()
165 tvcolumn_pixbuf = gtk.TreeViewColumn('Icon', pixbuf_cell)170 tvcolumn_pixbuf = Gtk.TreeViewColumn('Icon', pixbuf_cell)
166 tvcolumn_pixbuf.add_attribute(pixbuf_cell, 'pixbuf', self.COLUMN_ICON)171 tvcolumn_pixbuf.add_attribute(pixbuf_cell, 'pixbuf', self.COLUMN_ICON)
167 self.append_column(tvcolumn_pixbuf)172 self.append_column(tvcolumn_pixbuf)
168 # For the backend name173 # For the backend name
169 text_cell = gtk.CellRendererText()174 text_cell = Gtk.CellRendererText()
170 tvcolumn_text = gtk.TreeViewColumn('Name', text_cell)175 tvcolumn_text = Gtk.TreeViewColumn('Name', text_cell)
171 tvcolumn_text.add_attribute(text_cell, 'markup', self.COLUMN_TEXT)176 tvcolumn_text.add_attribute(text_cell, 'markup', self.COLUMN_TEXT)
172 self.append_column(tvcolumn_text)177 self.append_column(tvcolumn_text)
173 text_cell.connect('edited', self.cell_edited_callback)178 text_cell.connect('edited', self.cell_edited_callback)
174 text_cell.set_property('editable', True)179 text_cell.set_property('editable', True)
175 # For the backend tags180 # For the backend tags
176 tags_cell = gtk.CellRendererText()181 tags_cell = Gtk.CellRendererText()
177 tvcolumn_tags = gtk.TreeViewColumn('Tags', tags_cell)182 tvcolumn_tags = Gtk.TreeViewColumn('Tags', tags_cell)
178 tvcolumn_tags.add_attribute(tags_cell, 'markup', self.COLUMN_TAGS)183 tvcolumn_tags.add_attribute(tags_cell, 'markup', self.COLUMN_TAGS)
179 self.append_column(tvcolumn_tags)184 self.append_column(tvcolumn_tags)
180185
181 def cell_edited_callback(self, text_cell, path, new_text):186 def cell_edited_callback(self, text_cell, path, new_text):
182 '''If a backend name is changed, it saves the changes in the Backend187 '''If a backend name is changed, it saves the changes in the Backend
183188
184 @param text_cell: not used. The gtk.CellRendererText that emitted the189 @param text_cell: not used. The Gtk.CellRendererText that emitted the
185 signal. Only here because it's passed by the signal190 signal. Only here because it's passed by the signal
186 @param path: the gtk.TreePath of the edited cell191 @param path: the Gtk.TreePath of the edited cell
187 @param new_text: the new name of the backend192 @param new_text: the new name of the backend
188 '''193 '''
189 # we strip everything not permitted in backend names194 # we strip everything not permitted in backend names
@@ -218,7 +223,7 @@
218 '''223 '''
219 Helper function to get the selected path224 Helper function to get the selected path
220225
221 @return gtk.TreePath : returns exactly one path for the selected object226 @return Gtk.TreePath : returns exactly one path for the selected object
222 or None227 or None
223 '''228 '''
224 selection = self.get_selection()229 selection = self.get_selection()
225230
=== modified file 'GTG/gtk/backends_dialog/configurepanel.py'
--- GTG/gtk/backends_dialog/configurepanel.py 2013-11-23 14:40:23 +0000
+++ GTG/gtk/backends_dialog/configurepanel.py 2014-01-12 07:15:48 +0000
@@ -17,16 +17,16 @@
17# this program. If not, see <http://www.gnu.org/licenses/>.17# this program. If not, see <http://www.gnu.org/licenses/>.
18# -----------------------------------------------------------------------------18# -----------------------------------------------------------------------------
1919
20import gtk20from gi.repository import Gtk
2121
22from GTG import _22from GTG import _
23from GTG.gtk.backends_dialog.parameters_ui import ParametersUI23from GTG.gtk.backends_dialog.parameters_ui import ParametersUI
24from GTG.backends.backendsignals import BackendSignals24from GTG.backends.backendsignals import BackendSignals
2525
2626
27class ConfigurePanel(gtk.VBox):27class ConfigurePanel(Gtk.Box):
28 '''28 '''
29 A VBox that lets you configure a backend29 A vertical Box that lets you configure a backend
30 '''30 '''
3131
32 def __init__(self, backends_dialog):32 def __init__(self, backends_dialog):
@@ -36,7 +36,8 @@
36 @param backends_dialog: a reference to the dialog in which this is36 @param backends_dialog: a reference to the dialog in which this is
37 loaded37 loaded
38 '''38 '''
39 super(ConfigurePanel, self).__init__()39 super(ConfigurePanel, self).__init__(
40 orientation=Gtk.Orientation.VERTICAL)
40 self.dialog = backends_dialog41 self.dialog = backends_dialog
41 self.should_spinner_be_shown = False42 self.should_spinner_be_shown = False
42 self.task_deleted_handle = None43 self.task_deleted_handle = None
@@ -56,61 +57,61 @@
5657
57 def _create_widgets(self):58 def _create_widgets(self):
58 '''59 '''
59 This function fills this Vbox with widgets60 This function fills this box with widgets
60 '''61 '''
61 # Division of the available space in three segments:62 # Division of the available space in three segments:
62 # top, middle and bottom63 # top, middle and bottom
63 top = gtk.HBox()64 top = Gtk.Box()
64 middle = gtk.HBox()65 middle = Gtk.Box()
65 self._fill_top_hbox(top)66 self._fill_top_box(top)
66 self._fill_middle_hbox(middle)67 self._fill_middle_box(middle)
67 self.pack_start(top, False)68 self.pack_start(top, False, True, 0)
68 self.pack_start(middle, False)69 self.pack_start(middle, False, True, 0)
69 align = gtk.Alignment(xalign=0, yalign=0, xscale=1)70 align = Gtk.Alignment.new(0, 0, 1, 0)
70 align.set_padding(10, 0, 0, 0)71 align.set_padding(10, 0, 0, 0)
71 self.parameters_ui = ParametersUI(self.req)72 self.parameters_ui = ParametersUI(self.req)
72 align.add(self.parameters_ui)73 align.add(self.parameters_ui)
73 self.pack_start(align, False)74 self.pack_start(align, False, True, 0)
7475
75 def _fill_top_hbox(self, hbox):76 def _fill_top_box(self, box):
76 """ Fill header with service's icon, name, and a spinner77 """ Fill header with service's icon, name, and a spinner
77 for inidcation of work.78 for inidcation of work.
78
79 @param hbox: the gtk.HBox to fill
80 """79 """
81 self.image_icon = gtk.Image()80 box.set_spacing(10)
81 self.image_icon = Gtk.Image()
82 self.image_icon.set_size_request(48, 48)82 self.image_icon.set_size_request(48, 48)
8383
84 self.human_name_label = gtk.Label()84 self.human_name_label = Gtk.Label()
85 self.human_name_label.set_alignment(xalign=0, yalign=0.5)85 self.human_name_label.set_alignment(xalign=0, yalign=0.5)
8686
87 #FIXME in the newer versions of GTK3 there always be Spinner!
87 try:88 try:
88 self.spinner = gtk.Spinner()89 self.spinner = Gtk.Spinner()
89 except AttributeError:90 except AttributeError:
90 # worarkound for archlinux: bug #62420491 # worarkound for archlinux: bug #624204
91 self.spinner = gtk.HBox()92 self.spinner = Gtk.Box()
92 self.spinner.connect("show", self.on_spinner_show)93 self.spinner.connect("show", self.on_spinner_show)
93 self.spinner.set_size_request(32, 32)94 self.spinner.set_size_request(32, 32)
94 align_spin = gtk.Alignment(xalign=1, yalign=0)95 align_spin = Gtk.Alignment.new(1, 0, 0, 0)
95 align_spin.add(self.spinner)96 align_spin.add(self.spinner)
9697
97 hbox.set_spacing(10)98 box.set_spacing(10)
98 hbox.pack_start(self.image_icon, False)99 box.pack_start(self.image_icon, False, True, 0)
99 hbox.pack_start(self.human_name_label, True)100 box.pack_start(self.human_name_label, True, True, 0)
100 hbox.pack_start(align_spin, False)101 box.pack_start(align_spin, False, True, 0)
101102
102 def _fill_middle_hbox(self, hbox):103 def _fill_middle_box(self, box):
103 '''104 '''
104 Helper function to fill an hbox with a label and a button105 Helper function to fill an box with a label and a button
105106
106 @param hbox: the gtk.HBox to fill107 @param box: the Gtk.Box to fill
107 '''108 '''
108 self.sync_status_label = gtk.Label()109 self.sync_status_label = Gtk.Label()
109 self.sync_status_label.set_alignment(xalign=0.8, yalign=0.5)110 self.sync_status_label.set_alignment(xalign=0.8, yalign=0.5)
110 self.sync_button = gtk.Button()111 self.sync_button = Gtk.Button()
111 self.sync_button.connect("clicked", self.on_sync_button_clicked)112 self.sync_button.connect("clicked", self.on_sync_button_clicked)
112 hbox.pack_start(self.sync_status_label, True)113 box.pack_start(self.sync_status_label, True, True, 0)
113 hbox.pack_start(self.sync_button, True)114 box.pack_start(self.sync_button, True, True, 0)
114115
115 def set_backend(self, backend_id):116 def set_backend(self, backend_id):
116 '''Changes the backend to configure, refreshing this view.117 '''Changes the backend to configure, refreshing this view.
@@ -149,7 +150,7 @@
149150
150 def refresh_sync_status_label(self):151 def refresh_sync_status_label(self):
151 '''152 '''
152 Refreshes the gtk.Label that shows the current state of this backend153 Refreshes the Gtk.Label that shows the current state of this backend
153 '''154 '''
154 if self.backend.is_default():155 if self.backend.is_default():
155 label = _("This is the default synchronization service")156 label = _("This is the default synchronization service")
@@ -183,7 +184,7 @@
183 def on_sync_started(self, sender, backend_id):184 def on_sync_started(self, sender, backend_id):
184 '''185 '''
185 If the backend has started syncing tasks, update the state of the186 If the backend has started syncing tasks, update the state of the
186 gtk.Spinner187 Gtk.Spinner
187188
188 @param sender: not used, here only for signal callback compatibility189 @param sender: not used, here only for signal callback compatibility
189 @param backend_id: the id of the backend that emitted this signal190 @param backend_id: the id of the backend that emitted this signal
@@ -194,7 +195,7 @@
194 def on_sync_ended(self, sender, backend_id):195 def on_sync_ended(self, sender, backend_id):
195 '''196 '''
196 If the backend has stopped syncing tasks, update the state of the197 If the backend has stopped syncing tasks, update the state of the
197 gtk.Spinner198 Gtk.Spinner
198199
199 @param sender: not used, here only for signal callback compatibility200 @param sender: not used, here only for signal callback compatibility
200 @param backend_id: the id of the backend that emitted this signal201 @param backend_id: the id of the backend that emitted this signal
@@ -216,17 +217,17 @@
216217
217 def spinner_set_active(self, active):218 def spinner_set_active(self, active):
218 '''219 '''
219 Enables/disables the gtk.Spinner, while showing/hiding it at the same220 Enables/disables the Gtk.Spinner, while showing/hiding it at the same
220 time221 time
221222
222 @param active: True if the spinner should spin223 @param active: True if the spinner should spin
223 '''224 '''
224 self.should_spinner_be_shown = active225 self.should_spinner_be_shown = active
225 if active:226 if active:
226 if isinstance(self.spinner, gtk.Spinner):227 if isinstance(self.spinner, Gtk.Spinner):
227 self.spinner.start()228 self.spinner.start()
228 self.spinner.show()229 self.spinner.show()
229 else:230 else:
230 self.spinner.hide()231 self.spinner.hide()
231 if isinstance(self.spinner, gtk.Spinner):232 if isinstance(self.spinner, Gtk.Spinner):
232 self.spinner.stop()233 self.spinner.stop()
233234
=== modified file 'GTG/gtk/backends_dialog/parameters_ui/__init__.py'
--- GTG/gtk/backends_dialog/parameters_ui/__init__.py 2013-11-23 14:40:23 +0000
+++ GTG/gtk/backends_dialog/parameters_ui/__init__.py 2014-01-12 07:15:48 +0000
@@ -24,7 +24,7 @@
24server and client24server and client
25'''25'''
2626
27import gtk27from gi.repository import Gtk
28import functools28import functools
2929
30from GTG import _30from GTG import _
@@ -37,9 +37,10 @@
37from GTG.gtk.backends_dialog.parameters_ui.pathui import PathUI37from GTG.gtk.backends_dialog.parameters_ui.pathui import PathUI
3838
3939
40class ParametersUI(gtk.VBox):40class ParametersUI(Gtk.Box):
41 '''41 '''
42 Given a bakcend, this gtk.VBox populates itself with all the necessary42 Given a bakcend, this vertical Gtk.Box populates itself with all the
43 necessary
43 widgets to view and edit a backend configuration44 widgets to view and edit a backend configuration
44 '''45 '''
4546
@@ -50,7 +51,8 @@
5051
51 @param requester: a GTG.core.requester.Requester object52 @param requester: a GTG.core.requester.Requester object
52 '''53 '''
53 super(ParametersUI, self).__init__(False)54 super(ParametersUI, self).__init__(
55 False, orientation=Gtk.Orientation.VERTICAL)
54 self.req = requester56 self.req = requester
55 self.set_spacing(10)57 self.set_spacing(10)
5658
@@ -98,7 +100,7 @@
98 })),100 })),
99 ("tag-with-project-name", self.UI_generator(CheckBoxUI, {101 ("tag-with-project-name", self.UI_generator(CheckBoxUI, {
100 "text": _("Tag your GTG tasks with the project "102 "text": _("Tag your GTG tasks with the project "
101 "targeted by the bug"),103 "targeted by the bug"),
102 "parameter": "tag-with-project-name",104 "parameter": "tag-with-project-name",
103 })),105 })),
104 )106 )
@@ -127,9 +129,9 @@
127 @param backend: the backend that is being configured129 @param backend: the backend that is being configured
128 '''130 '''
129 # remove the old parameters UIs131 # remove the old parameters UIs
130 def _remove_child(self, child):132 def _remove_child(self, child, data=None):
131 self.remove(child)133 self.remove(child)
132 self.foreach(functools.partial(_remove_child, self))134 self.foreach(functools.partial(_remove_child, self), None)
133 # add new widgets135 # add new widgets
134 backend_parameters = backend.get_parameters()136 backend_parameters = backend.get_parameters()
135 if backend_parameters[GenericBackend.KEY_DEFAULT_BACKEND]:137 if backend_parameters[GenericBackend.KEY_DEFAULT_BACKEND]:
@@ -137,7 +139,8 @@
137 return139 return
138 for parameter_name, widget in self.parameter_widgets:140 for parameter_name, widget in self.parameter_widgets:
139 if parameter_name in backend_parameters:141 if parameter_name in backend_parameters:
140 self.pack_start(widget(backend), True)142 #FIXME I am not 100% about this change
143 self.pack_start(widget(backend), True, True, 0)
141 self.show_all()144 self.show_all()
142145
143 def commit_changes(self):146 def commit_changes(self):
@@ -146,6 +149,6 @@
146 modified them)149 modified them)
147 '''150 '''
148151
149 def _commit_changes(child):152 def _commit_changes(child, data=None):
150 child.commit_changes()153 child.commit_changes()
151 self.foreach(_commit_changes)154 self.foreach(_commit_changes, None)
152155
=== modified file 'GTG/gtk/backends_dialog/parameters_ui/checkboxui.py'
--- GTG/gtk/backends_dialog/parameters_ui/checkboxui.py 2013-11-23 14:40:23 +0000
+++ GTG/gtk/backends_dialog/parameters_ui/checkboxui.py 2014-01-12 07:15:48 +0000
@@ -17,10 +17,10 @@
17# this program. If not, see <http://www.gnu.org/licenses/>.17# this program. If not, see <http://www.gnu.org/licenses/>.
18# -----------------------------------------------------------------------------18# -----------------------------------------------------------------------------
1919
20import gtk20from gi.repository import Gtk
2121
2222
23class CheckBoxUI(gtk.HBox):23class CheckBoxUI(Gtk.Box):
24 '''24 '''
25 It's a widget displaying a simple checkbox, with some text to explain its25 It's a widget displaying a simple checkbox, with some text to explain its
26 meaning26 meaning
@@ -46,13 +46,13 @@
46 def _populate_gtk(self, width):46 def _populate_gtk(self, width):
47 '''Creates the checkbox and the related label47 '''Creates the checkbox and the related label
4848
49 @param width: the width of the gtk.Label object49 @param width: the width of the Gtk.Label object
50 '''50 '''
51 self.checkbutton = gtk.CheckButton(label=self.text)51 self.checkbutton = Gtk.CheckButton(label=self.text)
52 backend_parameters = self.backend.get_parameters()[self.parameter]52 backend_parameters = self.backend.get_parameters()[self.parameter]
53 self.checkbutton.set_active(backend_parameters)53 self.checkbutton.set_active(backend_parameters)
54 self.checkbutton.connect("toggled", self.on_modified)54 self.checkbutton.connect("toggled", self.on_modified)
55 self.pack_start(self.checkbutton, False)55 self.pack_start(self.checkbutton, False, True, 0)
5656
57 def commit_changes(self):57 def commit_changes(self):
58 '''Saves the changes to the backend parameter'''58 '''Saves the changes to the backend parameter'''
5959
=== modified file 'GTG/gtk/backends_dialog/parameters_ui/importtagsui.py'
--- GTG/gtk/backends_dialog/parameters_ui/importtagsui.py 2013-11-23 14:40:23 +0000
+++ GTG/gtk/backends_dialog/parameters_ui/importtagsui.py 2014-01-12 07:15:48 +0000
@@ -17,12 +17,13 @@
17# this program. If not, see <http://www.gnu.org/licenses/>.17# this program. If not, see <http://www.gnu.org/licenses/>.
18# -----------------------------------------------------------------------------18# -----------------------------------------------------------------------------
1919
20import gtk20from gi.repository import Gtk
2121
22from GTG.backends.genericbackend import GenericBackend22from GTG.backends.genericbackend import GenericBackend
2323from functools import reduce
2424
25class ImportTagsUI(gtk.VBox):25
26class ImportTagsUI(Gtk.Box):
26 '''27 '''
27 It's a widget displaying a couple of radio buttons, a label and a textbox28 It's a widget displaying a couple of radio buttons, a label and a textbox
28 to let the user change the attached tags (or imported)29 to let the user change the attached tags (or imported)
@@ -42,7 +43,8 @@
42 radio button43 radio button
43 @param parameter_name: the backend parameter this widget should modify44 @param parameter_name: the backend parameter this widget should modify
44 '''45 '''
45 super(ImportTagsUI, self).__init__()46 super(ImportTagsUI, self).__init__(
47 orientation=Gtk.Orientation.VERTICAL)
46 self.backend = backend48 self.backend = backend
47 self.req = req49 self.req = req
48 self.title = title50 self.title = title
@@ -59,26 +61,26 @@
5961
60 @param width: the length of the radio buttons62 @param width: the length of the radio buttons
61 '''63 '''
62 title_label = gtk.Label()64 title_label = Gtk.Label()
63 title_label.set_alignment(xalign=0, yalign=0)65 title_label.set_alignment(xalign=0, yalign=0)
64 title_label.set_markup("<big><b>%s</b></big>" % self.title)66 title_label.set_markup("<big><b>%s</b></big>" % self.title)
65 self.pack_start(title_label, True)67 self.pack_start(title_label, True, True, 0)
66 align = gtk.Alignment(xalign=0, yalign=0, xscale=1)68 align = Gtk.Alignment.new(0, 0, 1, 0)
67 align.set_padding(0, 0, 10, 0)69 align.set_padding(0, 0, 10, 0)
68 self.pack_start(align, True)70 self.pack_start(align, True, True, 0)
69 vbox = gtk.VBox()71 vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
70 align.add(vbox)72 align.add(vbox)
71 self.all_tags_radio = gtk.RadioButton(group=None,73 self.all_tags_radio = Gtk.RadioButton(group=None,
72 label=self.anybox_text)74 label=self.anybox_text)
73 vbox.pack_start(self.all_tags_radio, True)75 vbox.pack_start(self.all_tags_radio, True, True, 0)
74 self.some_tags_radio = gtk.RadioButton(group=self.all_tags_radio,76 self.some_tags_radio = Gtk.RadioButton(group=self.all_tags_radio,
75 label=self.somebox_text)77 label=self.somebox_text)
76 self.some_tags_radio.set_size_request(width=width, height=-1)78 self.some_tags_radio.set_size_request(width=width, height=-1)
77 hbox = gtk.HBox()79 box = Gtk.Box()
78 vbox.pack_start(hbox, True)80 vbox.pack_start(box, True, True, 0)
79 hbox.pack_start(self.some_tags_radio, False)81 box.pack_start(self.some_tags_radio, False, True, 0)
80 self.tags_entry = gtk.Entry()82 self.tags_entry = Gtk.Entry()
81 hbox.pack_start(self.tags_entry, True)83 box.pack_start(self.tags_entry, True, True, 0)
8284
83 def on_changed(self, radio, data=None):85 def on_changed(self, radio, data=None):
84 ''' Signal callback, executed when the user modifies something.86 ''' Signal callback, executed when the user modifies something.
@@ -99,9 +101,9 @@
99 else:101 else:
100 tags = self.tags_entry.get_text().split(",")102 tags = self.tags_entry.get_text().split(",")
101 # stripping spaces103 # stripping spaces
102 tags = map(lambda t: t.strip(), tags)104 tags = [t.strip() for t in tags]
103 # removing empty tags105 # removing empty tags
104 tags = filter(lambda t: t, tags)106 tags = [t for t in tags if t]
105107
106 self.backend.set_parameter(self.parameter_name, tags)108 self.backend.set_parameter(self.parameter_name, tags)
107109
108110
=== modified file 'GTG/gtk/backends_dialog/parameters_ui/passwordui.py'
--- GTG/gtk/backends_dialog/parameters_ui/passwordui.py 2013-11-23 14:40:23 +0000
+++ GTG/gtk/backends_dialog/parameters_ui/passwordui.py 2014-01-12 07:15:48 +0000
@@ -17,12 +17,12 @@
17# this program. If not, see <http://www.gnu.org/licenses/>.17# this program. If not, see <http://www.gnu.org/licenses/>.
18# -----------------------------------------------------------------------------18# -----------------------------------------------------------------------------
1919
20import gtk20from gi.repository import Gtk
2121
22from GTG import _22from GTG import _
2323
2424
25class PasswordUI(gtk.HBox):25class PasswordUI(Gtk.Box):
26 '''Widget displaying a gtk.Label and a textbox to input a password'''26 '''Widget displaying a gtk.Label and a textbox to input a password'''
2727
28 def __init__(self, req, backend, width):28 def __init__(self, req, backend, width):
@@ -31,7 +31,7 @@
3131
32 @param req: a Requester32 @param req: a Requester
33 @param backend: a backend object33 @param backend: a backend object
34 @param width: the width of the gtk.Label object34 @param width: the width of the Gtk.Label object
35 '''35 '''
36 super(PasswordUI, self).__init__()36 super(PasswordUI, self).__init__()
37 self.backend = backend37 self.backend = backend
@@ -43,16 +43,16 @@
43 def _populate_gtk(self, width):43 def _populate_gtk(self, width):
44 '''Creates the text box and the related label44 '''Creates the text box and the related label
4545
46 @param width: the width of the gtk.Label object46 @param width: the width of the Gtk.Label object
47 '''47 '''
48 password_label = gtk.Label(_("Password:"))48 password_label = Gtk.Label(label=_("Password:"))
49 password_label.set_alignment(xalign=0, yalign=0.5)49 password_label.set_alignment(xalign=0, yalign=0.5)
50 password_label.set_size_request(width=width, height=-1)50 password_label.set_size_request(width=width, height=-1)
51 self.pack_start(password_label, False)51 self.pack_start(password_label, False, True, 0)
52 align = gtk.Alignment(xalign=0, yalign=0.5, xscale=1)52 align = Gtk.Alignment.new(0, 0.5, 1, 0)
53 align.set_padding(0, 0, 10, 0)53 align.set_padding(0, 0, 10, 0)
54 self.pack_start(align, True)54 self.pack_start(align, True, True, 0)
55 self.password_textbox = gtk.Entry()55 self.password_textbox = Gtk.Entry()
56 align.add(self.password_textbox)56 align.add(self.password_textbox)
5757
58 def _load_password(self):58 def _load_password(self):
5959
=== modified file 'GTG/gtk/backends_dialog/parameters_ui/pathui.py'
--- GTG/gtk/backends_dialog/parameters_ui/pathui.py 2013-11-23 14:40:23 +0000
+++ GTG/gtk/backends_dialog/parameters_ui/pathui.py 2014-01-12 07:15:48 +0000
@@ -17,13 +17,13 @@
17# this program. If not, see <http://www.gnu.org/licenses/>.17# this program. If not, see <http://www.gnu.org/licenses/>.
18# -----------------------------------------------------------------------------18# -----------------------------------------------------------------------------
1919
20import gtk20from gi.repository import Gtk
21import os.path21import os.path
2222
23from GTG import _23from GTG import _
2424
2525
26class PathUI(gtk.HBox):26class PathUI(Gtk.Box):
27 '''Gtk widgets to show a path in a textbox, and a button to bring up a27 '''Gtk widgets to show a path in a textbox, and a button to bring up a
28 filesystem explorer to modify that path (also, a label to describe those)28 filesystem explorer to modify that path (also, a label to describe those)
29 '''29 '''
@@ -34,7 +34,7 @@
3434
35 @param req: a Requester35 @param req: a Requester
36 @param backend: a backend object36 @param backend: a backend object
37 @param width: the width of the gtk.Label object37 @param width: the width of the Gtk.Label object
38 '''38 '''
39 super(PathUI, self).__init__()39 super(PathUI, self).__init__()
40 self.backend = backend40 self.backend = backend
@@ -42,25 +42,25 @@
42 self._populate_gtk(width)42 self._populate_gtk(width)
4343
44 def _populate_gtk(self, width):44 def _populate_gtk(self, width):
45 '''Creates the gtk.Label, the textbox and the button45 '''Creates the Gtk.Label, the textbox and the button
4646
47 @param width: the width of the gtk.Label object47 @param width: the width of the Gtk.Label object
48 '''48 '''
49 label = gtk.Label(_("Filename:"))49 label = Gtk.Label(label=_("Filename:"))
50 label.set_line_wrap(True)50 label.set_line_wrap(True)
51 label.set_alignment(xalign=0, yalign=0.5)51 label.set_alignment(xalign=0, yalign=0.5)
52 label.set_size_request(width=width, height=-1)52 label.set_size_request(width=width, height=-1)
53 self.pack_start(label, False)53 self.pack_start(label, False, True, 0)
54 align = gtk.Alignment(xalign=0, yalign=0.5, xscale=1)54 align = Gtk.Alignment.new(0, 0.5, 1, 0)
55 align.set_padding(0, 0, 10, 0)55 align.set_padding(0, 0, 10, 0)
56 self.pack_start(align, True)56 self.pack_start(align, True, True, 0)
57 self.textbox = gtk.Entry()57 self.textbox = Gtk.Entry()
58 self.textbox.set_text(self.backend.get_parameters()['path'])58 self.textbox.set_text(self.backend.get_parameters()['path'])
59 self.textbox.connect('changed', self.on_path_modified)59 self.textbox.connect('changed', self.on_path_modified)
60 align.add(self.textbox)60 align.add(self.textbox)
61 self.button = gtk.Button(stock=gtk.STOCK_EDIT)61 self.button = Gtk.Button(stock=Gtk.STOCK_EDIT)
62 self.button.connect('clicked', self.on_button_clicked)62 self.button.connect('clicked', self.on_button_clicked)
63 self.pack_start(self.button, False)63 self.pack_start(self.button, False, True, 0)
6464
65 def commit_changes(self):65 def commit_changes(self):
66 '''Saves the changes to the backend parameter'''66 '''Saves the changes to the backend parameter'''
@@ -81,30 +81,30 @@
8181
82 @param sender: not used, only here for signal compatibility82 @param sender: not used, only here for signal compatibility
83 '''83 '''
84 self.chooser = gtk.FileChooserDialog(84 self.chooser = Gtk.FileChooserDialog(
85 title=None,85 title=None,
86 action=gtk.FILE_CHOOSER_ACTION_SAVE,86 action=Gtk.FileChooserAction.SAVE,
87 buttons=(gtk.STOCK_CANCEL,87 buttons=(Gtk.STOCK_CANCEL,
88 gtk.RESPONSE_CANCEL,88 Gtk.ResponseType.CANCEL,
89 gtk.STOCK_OK,89 Gtk.STOCK_OK,
90 gtk.RESPONSE_OK))90 Gtk.ResponseType.OK))
91 self.chooser.set_default_response(gtk.RESPONSE_OK)91 self.chooser.set_default_response(Gtk.ResponseType.OK)
92 # set default file as the current self.path92 # set default file as the current self.path
93 dirname, basename = os.path.split(self.textbox.get_text())93 dirname, basename = os.path.split(self.textbox.get_text())
94 self.chooser.set_current_name(basename)94 self.chooser.set_current_name(basename)
95 self.chosser.set_current_folder(dirname)95 self.chosser.set_current_folder(dirname)
9696
97 # filter files97 # filter files
98 afilter = gtk.FileFilter()98 afilter = Gtk.FileFilter()
99 afilter.set_name("All files")99 afilter.set_name("All files")
100 afilter.add_pattern("*")100 afilter.add_pattern("*")
101 self.chooser.add_filter(afilter)101 self.chooser.add_filter(afilter)
102 afilter = gtk.FileFilter()102 afilter = Gtk.FileFilter()
103 afilter.set_name("XML files")103 afilter.set_name("XML files")
104 afilter.add_mime_type("text/plain")104 afilter.add_mime_type("text/plain")
105 afilter.add_pattern("*.xml")105 afilter.add_pattern("*.xml")
106 self.chooser.add_filter(afilter)106 self.chooser.add_filter(afilter)
107 response = self.chooser.run()107 response = self.chooser.run()
108 if response == gtk.RESPONSE_OK:108 if response == Gtk.ResponseType.OK:
109 self.textbox.set_text(self.chooser.get_filename())109 self.textbox.set_text(self.chooser.get_filename())
110 self.chooser.destroy()110 self.chooser.destroy()
111111
=== modified file 'GTG/gtk/backends_dialog/parameters_ui/periodui.py'
--- GTG/gtk/backends_dialog/parameters_ui/periodui.py 2013-11-23 14:40:23 +0000
+++ GTG/gtk/backends_dialog/parameters_ui/periodui.py 2014-01-12 07:15:48 +0000
@@ -17,23 +17,23 @@
17# this program. If not, see <http://www.gnu.org/licenses/>.17# this program. If not, see <http://www.gnu.org/licenses/>.
18# -----------------------------------------------------------------------------18# -----------------------------------------------------------------------------
1919
20import gtk20from gi.repository import Gtk
2121
22from GTG import _, ngettext22from GTG import _, ngettext
2323
2424
25class PeriodUI(gtk.HBox):25class PeriodUI(Gtk.Box):
26 '''A widget to change the frequency of a backend synchronization26 '''A widget to change the frequency of a backend synchronization
27 '''27 '''
2828
29 def __init__(self, req, backend, width):29 def __init__(self, req, backend, width):
30 '''30 '''
31 Creates the gtk.Adjustment and the related label. Loads the current31 Creates the Gtk.Adjustment and the related label. Loads the current
32 period.32 period.
3333
34 @param req: a Requester34 @param req: a Requester
35 @param backend: a backend object35 @param backend: a backend object
36 @param width: the width of the gtk.Label object36 @param width: the width of the Gtk.Label object
37 '''37 '''
38 super(PeriodUI, self).__init__()38 super(PeriodUI, self).__init__()
39 self.backend = backend39 self.backend = backend
@@ -44,30 +44,30 @@
44 def _populate_gtk(self, width):44 def _populate_gtk(self, width):
45 '''Creates the gtk widgets45 '''Creates the gtk widgets
4646
47 @param width: the width of the gtk.Label object47 @param width: the width of the Gtk.Label object
48 '''48 '''
49 period_label = gtk.Label(_("Check for new tasks every"))49 period_label = Gtk.Label(label=_("Check for new tasks every"))
50 period_label.set_alignment(xalign=0, yalign=0.5)50 period_label.set_alignment(xalign=0, yalign=0.5)
51 period_label.set_line_wrap(True)51 period_label.set_line_wrap(True)
52 period_label.set_size_request(width=width, height=-1)52 period_label.set_size_request(width=width, height=-1)
53 self.pack_start(period_label, False)53 self.pack_start(period_label, False, True, 0)
54 align = gtk.Alignment(xalign=0, yalign=0.5, xscale=1)54 align = Gtk.Alignment.new(0, 0.5, 1, 0)
55 align.set_padding(0, 0, 10, 0)55 align.set_padding(0, 0, 10, 0)
56 self.pack_start(align, False)56 self.pack_start(align, False, True, 0)
57 period = self.backend.get_parameters()['period']57 period = self.backend.get_parameters()['period']
58 self.adjustment = gtk.Adjustment(value=period,58 self.adjustment = Gtk.Adjustment(value=period,
59 lower=1,59 lower=1,
60 upper=120,60 upper=120,
61 step_incr=1,61 step_incr=1,
62 page_incr=0,62 page_incr=0,
63 page_size=0)63 page_size=0)
64 self.period_spin = gtk.SpinButton(adjustment=self.adjustment,64 self.period_spin = Gtk.SpinButton(adjustment=self.adjustment,
65 climb_rate=0.3,65 climb_rate=0.3,
66 digits=0)66 digits=0)
67 self.minutes_label = gtk.Label()67 self.minutes_label = Gtk.Label()
68 self.update_minutes_label()68 self.update_minutes_label()
69 self.minutes_label.set_alignment(xalign=0, yalign=0.5)69 self.minutes_label.set_alignment(xalign=0, yalign=0.5)
70 self.pack_start(self.minutes_label, False)70 self.pack_start(self.minutes_label, False, True, 0)
71 align.add(self.period_spin)71 align.add(self.period_spin)
72 self.show_all()72 self.show_all()
7373
7474
=== modified file 'GTG/gtk/backends_dialog/parameters_ui/textui.py'
--- GTG/gtk/backends_dialog/parameters_ui/textui.py 2013-11-23 14:40:23 +0000
+++ GTG/gtk/backends_dialog/parameters_ui/textui.py 2014-01-12 07:15:48 +0000
@@ -17,10 +17,10 @@
17# this program. If not, see <http://www.gnu.org/licenses/>.17# this program. If not, see <http://www.gnu.org/licenses/>.
18# -----------------------------------------------------------------------------18# -----------------------------------------------------------------------------
1919
20import gtk20from gi.repository import Gtk
2121
2222
23class TextUI(gtk.HBox):23class TextUI(Gtk.Box):
24 '''A widget to display a simple textbox and a label to describe its content24 '''A widget to display a simple textbox and a label to describe its content
25 '''25 '''
2626
@@ -31,7 +31,7 @@
3131
32 @param req: a Requester32 @param req: a Requester
33 @param backend: a backend object33 @param backend: a backend object
34 @param width: the width of the gtk.Label object34 @param width: the width of the Gtk.Label object
35 '''35 '''
36 super(TextUI, self).__init__()36 super(TextUI, self).__init__()
37 self.backend = backend37 self.backend = backend
@@ -43,17 +43,17 @@
43 def _populate_gtk(self, width):43 def _populate_gtk(self, width):
44 '''Creates the gtk widgets44 '''Creates the gtk widgets
4545
46 @param width: the width of the gtk.Label object46 @param width: the width of the Gtk.Label object
47 '''47 '''
48 label = gtk.Label("%s:" % self.description)48 label = Gtk.Label(label="%s:" % self.description)
49 label.set_line_wrap(True)49 label.set_line_wrap(True)
50 label.set_alignment(xalign=0, yalign=0.5)50 label.set_alignment(xalign=0, yalign=0.5)
51 label.set_size_request(width=width, height=-1)51 label.set_size_request(width=width, height=-1)
52 self.pack_start(label, False)52 self.pack_start(label, False, True, 0)
53 align = gtk.Alignment(xalign=0, yalign=0.5, xscale=1)53 align = Gtk.Alignment.new(0, 0.5, 1, 0)
54 align.set_padding(0, 0, 10, 0)54 align.set_padding(0, 0, 10, 0)
55 self.pack_start(align, True)55 self.pack_start(align, True, True, 0)
56 self.textbox = gtk.Entry()56 self.textbox = Gtk.Entry()
57 backend_parameters = self.backend.get_parameters()[self.parameter_name]57 backend_parameters = self.backend.get_parameters()[self.parameter_name]
58 self.textbox.set_text(backend_parameters)58 self.textbox.set_text(backend_parameters)
59 self.textbox.connect('changed', self.on_text_modified)59 self.textbox.connect('changed', self.on_text_modified)
6060
=== modified file 'GTG/gtk/browser/CellRendererTags.py'
--- GTG/gtk/browser/CellRendererTags.py 2013-11-23 14:40:23 +0000
+++ GTG/gtk/browser/CellRendererTags.py 2014-01-12 07:15:48 +0000
@@ -20,23 +20,19 @@
20#=== IMPORT ===================================================================20#=== IMPORT ===================================================================
2121
22# system imports22# system imports
23import pygtk23from gi.repository import GObject, GLib, Gtk, Gdk
24pygtk.require('2.0')
25import gobject
26import glib
27import gtk
28import cairo24import cairo
29from GTG.tools.logger import Log25from GTG.tools.logger import Log
3026
31#=== MAIN CLASS ===============================================================27#=== MAIN CLASS ===============================================================
3228
3329
34class CellRendererTags(gtk.GenericCellRenderer):30class CellRendererTags(Gtk.CellRenderer):
35 __gproperties__ = {31 __gproperties__ = {
36 'tag_list': (gobject.TYPE_PYOBJECT,32 'tag_list': (GObject.TYPE_PYOBJECT,
37 "Tag list", "A list of tags", gobject.PARAM_READWRITE),33 "Tag list", "A list of tags", GObject.PARAM_READWRITE),
38 'tag': (gobject.TYPE_PYOBJECT, "Tag",34 'tag': (GObject.TYPE_PYOBJECT, "Tag",
39 "Tag", gobject.PARAM_READWRITE),35 "Tag", GObject.PARAM_READWRITE),
40 }36 }
4137
42 # Private methods38 # Private methods
@@ -81,7 +77,7 @@
8177
82 # Class methods78 # Class methods
83 def __init__(self):79 def __init__(self):
84 self.__gobject_init__()80 Gtk.CellRenderer.__init__(self)
85 self.tag_list = None81 self.tag_list = None
86 self.tag = None82 self.tag = None
87 self.xpad = 183 self.xpad = 1
@@ -100,8 +96,7 @@
100 else:96 else:
101 return getattr(self, pspec.name)97 return getattr(self, pspec.name)
10298
103 def on_render(self, window, widget, background_area, cell_area,99 def do_render(self, cr, widget, background_area, cell_area, flags):
104 expose_area, flags):
105100
106 vw_tags = self.__count_viewable_tags()101 vw_tags = self.__count_viewable_tags()
107 count = 0102 count = 0
@@ -115,8 +110,9 @@
115 return110 return
116111
117 # Drawing context112 # Drawing context
118 cr = window.cairo_create()113 #cr = window.cairo_create()
119 gdkcontext = gtk.gdk.CairoContext(cr)114 #gdkcontext = Gdk.CairoContext(cr)
115 gdkcontext = cr
120 gdkcontext.set_antialias(cairo.ANTIALIAS_NONE)116 gdkcontext.set_antialias(cairo.ANTIALIAS_NONE)
121117
122 # Coordinates of the origin point118 # Coordinates of the origin point
@@ -138,12 +134,13 @@
138134
139 if my_tag_icon:135 if my_tag_icon:
140 try:136 try:
141 pixbuf = gtk.icon_theme_get_default().load_icon(137 pixbuf = Gtk.IconTheme.get_default().load_icon(
142 my_tag_icon, 16, 0)138 my_tag_icon, 16, 0)
143 gdkcontext.set_source_pixbuf(pixbuf, rect_x, rect_y)139 Gdk.cairo_set_source_pixbuf(gdkcontext, pixbuf,
140 rect_x, rect_y)
144 gdkcontext.paint()141 gdkcontext.paint()
145 count = count + 1142 count = count + 1
146 except glib.GError:143 except GLib.GError:
147 # In some rare cases an icon could not be found144 # In some rare cases an icon could not be found
148 # (e.g. wrong set icon path, missing icon)145 # (e.g. wrong set icon path, missing icon)
149 # Raising an exception breaks UI and signal catcher badly146 # Raising an exception breaks UI and signal catcher badly
@@ -152,14 +149,14 @@
152 elif my_tag_color:149 elif my_tag_color:
153150
154 # Draw rounded rectangle151 # Draw rounded rectangle
155 my_color = gtk.gdk.color_parse(my_tag_color)152 my_color = Gdk.color_parse(my_tag_color)
156 gdkcontext.set_source_color(my_color)153 Gdk.cairo_set_source_color(gdkcontext, my_color)
157 self.__roundedrec(gdkcontext, rect_x, rect_y, 16, 16, 8)154 self.__roundedrec(gdkcontext, rect_x, rect_y, 16, 16, 8)
158 gdkcontext.fill()155 gdkcontext.fill()
159 count = count + 1156 count = count + 1
160157
161 # Outer line158 # Outer line
162 gdkcontext.set_source_rgba(0, 0, 0, 0.20)159 Gdk.cairo_set_source_rgba(gdkcontext, Gdk.RGBA(0, 0, 0, 0.20))
163 gdkcontext.set_line_width(1.0)160 gdkcontext.set_line_width(1.0)
164 self.__roundedrec(gdkcontext, rect_x, rect_y, 16, 16, 8)161 self.__roundedrec(gdkcontext, rect_x, rect_y, 16, 16, 8)
165 gdkcontext.stroke()162 gdkcontext.stroke()
@@ -171,18 +168,18 @@
171168
172 if not my_tag_icon and not my_tag_color:169 if not my_tag_icon and not my_tag_color:
173 # Draw rounded rectangle170 # Draw rounded rectangle
174 gdkcontext.set_source_rgba(0.95, 0.95, 0.95, 1)171 Gdk.cairo_set_source_rgba(gdkcontext,
172 Gdk.RGBA(0.95, 0.95, 0.95, 1))
175 self.__roundedrec(gdkcontext, rect_x, rect_y, 16, 16, 8)173 self.__roundedrec(gdkcontext, rect_x, rect_y, 16, 16, 8)
176 gdkcontext.fill()174 gdkcontext.fill()
177175
178 # Outer line176 # Outer line
179 gdkcontext.set_source_rgba(0, 0, 0, 0.20)177 Gdk.cairo_set_source_rgba(gdkcontext, Gdk.RGBA(0, 0, 0, 0.20))
180 gdkcontext.set_line_width(1.0)178 gdkcontext.set_line_width(1.0)
181 self.__roundedrec(gdkcontext, rect_x, rect_y, 16, 16, 8)179 self.__roundedrec(gdkcontext, rect_x, rect_y, 16, 16, 8)
182 gdkcontext.stroke()180 gdkcontext.stroke()
183181
184 def on_get_size(self, widget, cell_area=None):182 def do_get_size(self, widget, cell_area=None):
185
186 count = self.__count_viewable_tags()183 count = self.__count_viewable_tags()
187184
188 if count != 0:185 if count != 0:
@@ -192,4 +189,4 @@
192 else:189 else:
193 return (self.xpad, self.ypad, self.xpad * 2, self.ypad * 2)190 return (self.xpad, self.ypad, self.xpad * 2, self.ypad * 2)
194191
195gobject.type_register(CellRendererTags)192GObject.type_register(CellRendererTags)
196193
=== modified file 'GTG/gtk/browser/__init__.py'
--- GTG/gtk/browser/__init__.py 2013-11-23 14:40:23 +0000
+++ GTG/gtk/browser/__init__.py 2014-01-12 07:15:48 +0000
@@ -29,6 +29,8 @@
2929
30class GnomeConfig:30class GnomeConfig:
31 current_rep = os.path.dirname(os.path.abspath(__file__))31 current_rep = os.path.dirname(os.path.abspath(__file__))
32 BROWSER_UI_FILE = os.path.join(current_rep, "taskbrowser.ui")
33 MODIFYTAGS_UI_FILE = os.path.join(current_rep, "modifytags_dialog.ui")
32 GLADE_FILE = os.path.join(current_rep, "taskbrowser.glade")34 GLADE_FILE = os.path.join(current_rep, "taskbrowser.glade")
33 MODIFYTAGS_GLADE_FILE = os.path.join(current_rep,35 MODIFYTAGS_GLADE_FILE = os.path.join(current_rep,
34 "modifytags_dialog.glade")36 "modifytags_dialog.glade")
3537
=== modified file 'GTG/gtk/browser/browser.py'
--- GTG/gtk/browser/browser.py 2013-12-17 17:40:11 +0000
+++ GTG/gtk/browser/browser.py 2014-01-12 07:15:48 +0000
@@ -25,10 +25,7 @@
25import threading25import threading
26from webbrowser import open as openurl26from webbrowser import open as openurl
2727
28import pygtk28from gi.repository import GObject, Gtk, Gdk
29pygtk.require('2.0')
30import gobject
31import gtk
3229
33# our own imports30# our own imports
34from GTG import _, info, ngettext31from GTG import _, info, ngettext
@@ -55,21 +52,21 @@
55 self.start = time.time()52 self.start = time.time()
5653
57 def __exit__(self, *args):54 def __exit__(self, *args):
58 print "%s : %s" % (self.name, time.time() - self.start)55 print(("{0} : {1}".format(self.name, time.time() - self.start)))
5956
6057
61class TaskBrowser(gobject.GObject):58class TaskBrowser(GObject.GObject):
62 """ The UI for browsing open and closed tasks,59 """ The UI for browsing open and closed tasks,
63 and listing tags in a tree """60 and listing tags in a tree """
6461
65 __string_signal__ = (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (str, ))62 __string_signal__ = (GObject.SignalFlags.RUN_FIRST, None, (str, ))
66 __none_signal__ = (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, tuple())63 __none_signal__ = (GObject.SignalFlags.RUN_FIRST, None, tuple())
67 __gsignals__ = {'task-added-via-quick-add': __string_signal__,64 __gsignals__ = {'task-added-via-quick-add': __string_signal__,
68 'visibility-toggled': __none_signal__,65 'visibility-toggled': __none_signal__,
69 }66 }
7067
71 def __init__(self, requester, vmanager):68 def __init__(self, requester, vmanager):
72 gobject.GObject.__init__(self)69 GObject.GObject.__init__(self)
73 # Object prime variables70 # Object prime variables
74 self.req = requester71 self.req = requester
75 self.vmanager = vmanager72 self.vmanager = vmanager
@@ -98,13 +95,13 @@
98 self.tagtreeview = None95 self.tagtreeview = None
9996
100 # Load window tree97 # Load window tree
101 self.builder = gtk.Builder()98 self.builder = Gtk.Builder()
102 self.builder.add_from_file(GnomeConfig.GLADE_FILE)99 self.builder.add_from_file(GnomeConfig.BROWSER_UI_FILE)
103100
104 # Define aliases for specific widgets101 # Define aliases for specific widgets
105 self._init_widget_aliases()102 self._init_widget_aliases()
106103
107 # Init non-glade widgets104 # Init non-GtkBuilder widgets
108 self._init_ui_widget()105 self._init_ui_widget()
109106
110 # Set the tooltip for the toolbar buttons107 # Set the tooltip for the toolbar buttons
@@ -142,8 +139,8 @@
142 """139 """
143 icon_dirs = CoreConfig().get_icons_directories()140 icon_dirs = CoreConfig().get_icons_directories()
144 for i in icon_dirs:141 for i in icon_dirs:
145 gtk.icon_theme_get_default().prepend_search_path(i)142 Gtk.IconTheme.get_default().prepend_search_path(i)
146 gtk.window_set_default_icon_name("gtg")143 Gtk.Window.set_default_icon_name("gtg")
147144
148 def _init_widget_aliases(self):145 def _init_widget_aliases(self):
149 """146 """
@@ -244,7 +241,6 @@
244 """241 """
245 Show the about dialog242 Show the about dialog
246 """243 """
247 gtk.about_dialog_set_url_hook(lambda dialog, url: openurl(url))
248 self.about.set_website(info.URL)244 self.about.set_website(info.URL)
249 self.about.set_website_label(info.URL)245 self.about.set_website_label(info.URL)
250 self.about.set_version(info.VERSION)246 self.about.set_version(info.VERSION)
@@ -382,14 +378,15 @@
382378
383 def _add_accelerator_for_widget(self, agr, name, accel):379 def _add_accelerator_for_widget(self, agr, name, accel):
384 widget = self.builder.get_object(name)380 widget = self.builder.get_object(name)
385 key, mod = gtk.accelerator_parse(accel)381 key, mod = Gtk.accelerator_parse(accel)
386 widget.add_accelerator("activate", agr, key, mod, gtk.ACCEL_VISIBLE)382 widget.add_accelerator("activate", agr, key, mod,
383 Gtk.AccelFlags.VISIBLE)
387384
388 def _init_accelerators(self):385 def _init_accelerators(self):
389 """386 """
390 initialize gtk accelerators for different interface elements387 initialize gtk accelerators for different interface elements
391 """388 """
392 agr = gtk.AccelGroup()389 agr = Gtk.AccelGroup()
393 self.builder.get_object("MainWindow").add_accel_group(agr)390 self.builder.get_object("MainWindow").add_accel_group(agr)
394391
395 self._add_accelerator_for_widget(agr, "view_sidebar", "F9")392 self._add_accelerator_for_widget(agr, "view_sidebar", "F9")
@@ -407,9 +404,9 @@
407 self._add_accelerator_for_widget(agr, "help_contents", "F1")404 self._add_accelerator_for_widget(agr, "help_contents", "F1")
408405
409 quickadd_field = self.builder.get_object("quickadd_field")406 quickadd_field = self.builder.get_object("quickadd_field")
410 key, mod = gtk.accelerator_parse("<Control>l")407 key, mod = Gtk.accelerator_parse("<Control>l")
411 quickadd_field.add_accelerator("grab-focus", agr, key, mod,408 quickadd_field.add_accelerator("grab-focus", agr, key, mod,
412 gtk.ACCEL_VISIBLE)409 Gtk.AccelFlags.VISIBLE)
413410
414### HELPER FUNCTIONS ########################################################411### HELPER FUNCTIONS ########################################################
415 def open_preferences(self, widget):412 def open_preferences(self, widget):
@@ -429,11 +426,9 @@
429 and stores the state in self.config.max426 and stores the state in self.config.max
430 This is used to check the window state afterwards427 This is used to check the window state afterwards
431 and maximize it if needed """428 and maximize it if needed """
432 mask = gtk.gdk.WINDOW_STATE_MAXIMIZED429 mask = Gdk.WindowState.MAXIMIZED
433 if widget.get_window().get_state() & mask == mask:430 is_maximized = widget.get_window().get_state() & mask == mask
434 self.config.set("max", True)431 self.config.set("max", is_maximized)
435 else:
436 self.config.set("max", False)
437432
438 def restore_state_from_conf(self):433 def restore_state_from_conf(self):
439434
@@ -531,7 +526,7 @@
531 return True526 return True
532527
533 for t in self.config.get("opened_tasks"):528 for t in self.config.get("opened_tasks"):
534 gobject.idle_add(open_task, self.req, t)529 GObject.idle_add(open_task, self.req, t)
535530
536 def do_toggle_workview(self):531 def do_toggle_workview(self):
537 """ Switch between default and work view532 """ Switch between default and work view
@@ -616,7 +611,7 @@
616 def on_sort_column_changed(self, model):611 def on_sort_column_changed(self, model):
617 sort_column, sort_order = model.get_sort_column_id()612 sort_column, sort_order = model.get_sort_column_id()
618613
619 if sort_order == gtk.SORT_ASCENDING:614 if sort_order == Gtk.SortType.ASCENDING:
620 sort_order = 0615 sort_order = 0
621 else:616 else:
622 sort_order = 1617 sort_order = 1
@@ -706,10 +701,10 @@
706 self.on_taskdone_cursor_changed)701 self.on_taskdone_cursor_changed)
707 ctree.apply_filter(self.get_selected_tags()[0], refresh=True)702 ctree.apply_filter(self.get_selected_tags()[0], refresh=True)
708 if not self.closed_pane:703 if not self.closed_pane:
709 self.closed_pane = gtk.ScrolledWindow()704 self.closed_pane = Gtk.ScrolledWindow()
710 self.closed_pane.set_size_request(-1, 100)705 self.closed_pane.set_size_request(-1, 100)
711 self.closed_pane.set_policy(gtk.POLICY_AUTOMATIC,706 self.closed_pane.set_policy(Gtk.PolicyType.AUTOMATIC,
712 gtk.POLICY_AUTOMATIC)707 Gtk.PolicyType.AUTOMATIC)
713 self.closed_pane.add(self.vtree_panes['closed'])708 self.closed_pane.add(self.vtree_panes['closed'])
714709
715 elif self.accessory_notebook.page_num(self.closed_pane) != -1:710 elif self.accessory_notebook.page_num(self.closed_pane) != -1:
@@ -811,7 +806,7 @@
811806
812 def on_quickadd_activate(self, widget):807 def on_quickadd_activate(self, widget):
813 """ Add a new task from quickadd toolbar """808 """ Add a new task from quickadd toolbar """
814 text = unicode(self.quickadd_entry.get_text())809 text = str(self.quickadd_entry.get_text())
815 text = text.strip()810 text = text.strip()
816 if text:811 if text:
817 tags = self.get_selected_tags(nospecial=True)812 tags = self.get_selected_tags(nospecial=True)
@@ -840,7 +835,7 @@
840 selection.select_path(path)835 selection.select_path(path)
841836
842 # It cannot be another thread than the main gtk thread !837 # It cannot be another thread than the main gtk thread !
843 gobject.idle_add(selecter, treemodelsort, path, iter, self)838 GObject.idle_add(selecter, treemodelsort, path, iter, self)
844 # event that is set when the new task is created839 # event that is set when the new task is created
845 self.__last_quick_added_tid_event = threading.Event()840 self.__last_quick_added_tid_event = threading.Event()
846 self.__quick_add_select_handle = \841 self.__quick_add_select_handle = \
@@ -854,7 +849,7 @@
854 self.quickadd_entry.set_text('')849 self.quickadd_entry.set_text('')
855850
856 # signal the event for the plugins to catch851 # signal the event for the plugins to catch
857 gobject.idle_add(self.emit, "task-added-via-quick-add",852 GObject.idle_add(self.emit, "task-added-via-quick-add",
858 task.get_id())853 task.get_id())
859 else:854 else:
860 # if no text is selected, we open the currently selected task855 # if no text is selected, we open the currently selected task
@@ -864,7 +859,7 @@
864859
865 def on_quickadd_iconpress(self, widget, icon, event):860 def on_quickadd_iconpress(self, widget, icon, event):
866 """ Clear the text in quickadd field by clicking on 'clear' icon """861 """ Clear the text in quickadd field by clicking on 'clear' icon """
867 if icon == gtk.ENTRY_ICON_SECONDARY:862 if icon == Gtk.EntryIconPosition.SECONDARY:
868 self.quickadd_entry.set_text('')863 self.quickadd_entry.set_text('')
869864
870 def on_tag_treeview_button_press_event(self, treeview, event):865 def on_tag_treeview_button_press_event(self, treeview, event):
@@ -897,38 +892,45 @@
897 selected_tags = self.get_selected_tags(nospecial=True)892 selected_tags = self.get_selected_tags(nospecial=True)
898 selected_search = self.get_selected_search()893 selected_search = self.get_selected_search()
899 # popup menu for searches894 # popup menu for searches
895 # FIXME thos two branches could be simplified
896 # (there is no difference betweenn search and normal tag
900 if selected_search is not None:897 if selected_search is not None:
901 my_tag = self.req.get_tag(selected_search)898 my_tag = self.req.get_tag(selected_search)
902 self.tagpopup.set_tag(my_tag)899 self.tagpopup.set_tag(my_tag)
903 self.tagpopup.popup(None, None, None, event.button, time)900 self.tagpopup.popup(None, None, None, None, event.button,
901 time)
904 elif len(selected_tags) > 0:902 elif len(selected_tags) > 0:
905 # Then we are looking at single, normal tag rather than903 # Then we are looking at single, normal tag rather than
906 # the special 'All tags' or 'Tasks without tags'. We only904 # the special 'All tags' or 'Tasks without tags'. We only
907 # want to popup the menu for normal tags.905 # want to popup the menu for normal tags.
908 my_tag = self.req.get_tag(selected_tags[0])906 my_tag = self.req.get_tag(selected_tags[0])
909 self.tagpopup.set_tag(my_tag)907 self.tagpopup.set_tag(my_tag)
910 self.tagpopup.popup(None, None, None, event.button, time)908 self.tagpopup.popup(None, None, None, None, event.button,
909 time)
911 else:910 else:
912 self.reset_cursor()911 self.reset_cursor()
913 return True912 return True
914913
915 def on_tag_treeview_key_press_event(self, treeview, event):914 def on_tag_treeview_key_press_event(self, treeview, event):
916 keyname = gtk.gdk.keyval_name(event.keyval)915 keyname = Gdk.keyval_name(event.keyval)
917 is_shift_f10 = (keyname == "F10" and916 is_shift_f10 = (keyname == "F10" and
918 event.get_state() & gtk.gdk.SHIFT_MASK)917 event.get_state() & Gdk.ModifierType.SHIFT_MASK)
919 if is_shift_f10 or keyname == "Menu":918 if is_shift_f10 or keyname == "Menu":
920 selected_tags = self.get_selected_tags(nospecial=True)919 selected_tags = self.get_selected_tags(nospecial=True)
921 selected_search = self.get_selected_search()920 selected_search = self.get_selected_search()
921 # FIXME thos two branches could be simplified (there is
922 # no difference betweenn search and normal tag
922 # popup menu for searches923 # popup menu for searches
923 if selected_search is not None:924 if selected_search is not None:
924 self.searchpopup.popup(None, None, None, 0, event.time)925 self.tagpopup.set_tag(selected_search)
926 self.tagpopup.popup(None, None, None, 0, event.time)
925 elif len(selected_tags) > 0:927 elif len(selected_tags) > 0:
926 # Then we are looking at single, normal tag rather than928 # Then we are looking at single, normal tag rather than
927 # the special 'All tags' or 'Tasks without tags'. We only929 # the special 'All tags' or 'Tasks without tags'. We only
928 # want to popup the menu for normal tags.930 # want to popup the menu for normal tags.
929 selected_tag = self.req.get_tag(selected_tags[0])931 selected_tag = self.req.get_tag(selected_tags[0])
930 self.tagpopup.set_tag(selected_tag)932 self.tagpopup.set_tag(selected_tag)
931 self.tagpopup.popup(None, None, None, 0, event.time)933 self.tagpopup.popup(None, None, None, None, 0, event.time)
932 else:934 else:
933 self.reset_cursor()935 self.reset_cursor()
934 return True936 return True
@@ -952,13 +954,14 @@
952 else:954 else:
953 treeview.set_cursor(path, col, 0)955 treeview.set_cursor(path, col, 0)
954 treeview.grab_focus()956 treeview.grab_focus()
955 self.taskpopup.popup(None, None, None, event.button, time)957 self.taskpopup.popup(None, None, None, None, event.button,
958 time)
956 return True959 return True
957960
958 def on_task_treeview_key_press_event(self, treeview, event):961 def on_task_treeview_key_press_event(self, treeview, event):
959 keyname = gtk.gdk.keyval_name(event.keyval)962 keyname = Gdk.keyval_name(event.keyval)
960 is_shift_f10 = (keyname == "F10" and963 is_shift_f10 = (keyname == "F10" and
961 event.get_state() & gtk.gdk.SHIFT_MASK)964 event.get_state() & Gdk.ModifierType.SHIFT_MASK)
962965
963 if keyname == "Delete":966 if keyname == "Delete":
964 self.on_delete_tasks()967 self.on_delete_tasks()
@@ -981,9 +984,9 @@
981 return True984 return True
982985
983 def on_closed_task_treeview_key_press_event(self, treeview, event):986 def on_closed_task_treeview_key_press_event(self, treeview, event):
984 keyname = gtk.gdk.keyval_name(event.keyval)987 keyname = Gdk.keyval_name(event.keyval)
985 is_shift_f10 = (keyname == "F10" and988 is_shift_f10 = (keyname == "F10" and
986 event.get_state() & gtk.gdk.SHIFT_MASK)989 event.get_state() & Gdk.ModifierType.SHIFT_MASK)
987990
988 if keyname == "Delete":991 if keyname == "Delete":
989 self.on_delete_tasks()992 self.on_delete_tasks()
@@ -1214,7 +1217,7 @@
1214 button.set_tooltip_text(settings["tooltip"])1217 button.set_tooltip_text(settings["tooltip"])
12151218
1216 def update_menu_item(menu_item, settings):1219 def update_menu_item(menu_item, settings):
1217 image = gtk.image_new_from_icon_name(settings["icon-name"], 16)1220 image = Gtk.Image.new_from_icon_name(settings["icon-name"], 16)
1218 image.set_pixel_size(16)1221 image.set_pixel_size(16)
1219 image.show()1222 image.show()
1220 menu_item.set_image(image)1223 menu_item.set_image(image)
@@ -1367,8 +1370,8 @@
1367 """Adds a new page tab to the left panel. The tab will1370 """Adds a new page tab to the left panel. The tab will
1368 be added as the last tab. Also causes the tabs to be1371 be added as the last tab. Also causes the tabs to be
1369 shown if they're not.1372 shown if they're not.
1370 @param icon: a gtk.Image picture to display on the tab1373 @param icon: a Gtk.Image picture to display on the tab
1371 @param page: gtk.Frame-based panel to be added1374 @param page: Gtk.Frame-based panel to be added
1372 """1375 """
1373 return self._add_page(self.sidebar_notebook, icon, page)1376 return self._add_page(self.sidebar_notebook, icon, page)
13741377
@@ -1377,23 +1380,24 @@
1377 will be added as the last tab. Also causes the tabs to be1380 will be added as the last tab. Also causes the tabs to be
1378 shown.1381 shown.
1379 @param title: Short text to use for the tab label1382 @param title: Short text to use for the tab label
1380 @param page: gtk.Frame-based panel to be added1383 @param page: Gtk.Frame-based panel to be added
1381 """1384 """
1382 return self._add_page(self.main_notebook, gtk.Label(title), page)1385 return self._add_page(self.main_notebook, Gtk.Label(label=title), page)
13831386
1384 def add_page_to_accessory_notebook(self, title, page):1387 def add_page_to_accessory_notebook(self, title, page):
1385 """Adds a new page tab to the lower right accessory panel. The1388 """Adds a new page tab to the lower right accessory panel. The
1386 tab will be added as the last tab. Also causes the tabs to be1389 tab will be added as the last tab. Also causes the tabs to be
1387 shown.1390 shown.
1388 @param title: Short text to use for the tab label1391 @param title: Short text to use for the tab label
1389 @param page: gtk.Frame-based panel to be added1392 @param page: Gtk.Frame-based panel to be added
1390 """1393 """
1391 return self._add_page(self.accessory_notebook, gtk.Label(title), page)1394 return self._add_page(self.accessory_notebook, Gtk.Label(label=title),
1395 page)
13921396
1393 def remove_page_from_sidebar_notebook(self, page):1397 def remove_page_from_sidebar_notebook(self, page):
1394 """Removes a new page tab from the left panel. If this leaves1398 """Removes a new page tab from the left panel. If this leaves
1395 only one tab in the notebook, the tab selector will be hidden.1399 only one tab in the notebook, the tab selector will be hidden.
1396 @param page: gtk.Frame-based panel to be removed1400 @param page: Gtk.Frame-based panel to be removed
1397 """1401 """
1398 return self._remove_page(self.sidebar_notebook, page)1402 return self._remove_page(self.sidebar_notebook, page)
13991403
@@ -1401,7 +1405,7 @@
1401 """Removes a new page tab from the top right main panel. If1405 """Removes a new page tab from the top right main panel. If
1402 this leaves only one tab in the notebook, the tab selector will1406 this leaves only one tab in the notebook, the tab selector will
1403 be hidden.1407 be hidden.
1404 @param page: gtk.Frame-based panel to be removed1408 @param page: Gtk.Frame-based panel to be removed
1405 """1409 """
1406 return self._remove_page(self.main_notebook, page)1410 return self._remove_page(self.main_notebook, page)
14071411
@@ -1409,7 +1413,7 @@
1409 """Removes a new page tab from the lower right accessory panel.1413 """Removes a new page tab from the lower right accessory panel.
1410 If this leaves only one tab in the notebook, the tab selector1414 If this leaves only one tab in the notebook, the tab selector
1411 will be hidden.1415 will be hidden.
1412 @param page: gtk.Frame-based panel to be removed1416 @param page: Gtk.Frame-based panel to be removed
1413 """1417 """
1414 return self._remove_page(self.accessory_notebook, page)1418 return self._remove_page(self.accessory_notebook, page)
14151419
@@ -1417,7 +1421,7 @@
1417 """ Hides the task browser """1421 """ Hides the task browser """
1418 self.browser_shown = False1422 self.browser_shown = False
1419 self.window.hide()1423 self.window.hide()
1420 gobject.idle_add(self.emit, "visibility-toggled")1424 GObject.idle_add(self.emit, "visibility-toggled")
14211425
1422 def show(self):1426 def show(self):
1423 """ Unhides the TaskBrowser """1427 """ Unhides the TaskBrowser """
@@ -1427,7 +1431,7 @@
1427 self.window.present()1431 self.window.present()
1428 self.window.grab_focus()1432 self.window.grab_focus()
1429 self.quickadd_entry.grab_focus()1433 self.quickadd_entry.grab_focus()
1430 gobject.idle_add(self.emit, "visibility-toggled")1434 GObject.idle_add(self.emit, "visibility-toggled")
14311435
1432 def iconify(self):1436 def iconify(self):
1433 """ Minimizes the TaskBrowser """1437 """ Minimizes the TaskBrowser """
@@ -1469,7 +1473,7 @@
1469 def on_backend_failed(self, sender, backend_id, error_code):1473 def on_backend_failed(self, sender, backend_id, error_code):
1470 """1474 """
1471 Signal callback.1475 Signal callback.
1472 When a backend fails to work, loads a gtk.Infobar to alert the user1476 When a backend fails to work, loads a Gtk.Infobar to alert the user
14731477
1474 @param sender: not used, only here for signal compatibility1478 @param sender: not used, only here for signal compatibility
1475 @param backend_id: the id of the failing backend1479 @param backend_id: the id of the failing backend
@@ -1484,7 +1488,7 @@
1484 '''1488 '''
1485 Signal callback.1489 Signal callback.
1486 When a backend needs some kind of feedback from the user,1490 When a backend needs some kind of feedback from the user,
1487 loads a gtk.Infobar to alert the user.1491 loads a Gtk.Infobar to alert the user.
1488 This is used, for example, to request confirmation after authenticating1492 This is used, for example, to request confirmation after authenticating
1489 via OAuth.1493 via OAuth.
14901494
@@ -1502,10 +1506,10 @@
15021506
1503 def __remove_backend_infobar(self, child, backend_id):1507 def __remove_backend_infobar(self, child, backend_id):
1504 '''1508 '''
1505 Helper function to remove an gtk.Infobar related to a backend1509 Helper function to remove an Gtk.Infobar related to a backend
15061510
1507 @param child: a gtk.Infobar1511 @param child: a Gtk.Infobar
1508 @param backend_id: the id of the backend which gtk.Infobar should be1512 @param backend_id: the id of the backend which Gtk.Infobar should be
1509 removed.1513 removed.
1510 '''1514 '''
1511 if isinstance(child, CustomInfoBar) and\1515 if isinstance(child, CustomInfoBar) and\
@@ -1516,10 +1520,10 @@
1516 def remove_backend_infobar(self, sender, backend_id):1520 def remove_backend_infobar(self, sender, backend_id):
1517 '''1521 '''
1518 Signal callback.1522 Signal callback.
1519 Deletes the gtk.Infobars related to a backend1523 Deletes the Gtk.Infobars related to a backend
15201524
1521 @param sender: not used, only here for signal compatibility1525 @param sender: not used, only here for signal compatibility
1522 @param backend_id: the id of the backend which gtk.Infobar should be1526 @param backend_id: the id of the backend which Gtk.Infobar should be
1523 removed.1527 removed.
1524 '''1528 '''
1525 backend = self.req.get_backend(backend_id)1529 backend = self.req.get_backend(backend_id)
@@ -1534,7 +1538,7 @@
1534 Helper function to create a new infobar for a backend1538 Helper function to create a new infobar for a backend
15351539
1536 @param backend_id: the backend for which we're creating the infobar1540 @param backend_id: the backend for which we're creating the infobar
1537 @returns gtk.Infobar: the created infobar1541 @returns Gtk.Infobar: the created infobar
1538 '''1542 '''
1539 # remove old infobar related to backend_id, if any1543 # remove old infobar related to backend_id, if any
1540 if not self.vbox_toolbars:1544 if not self.vbox_toolbars:
@@ -1542,7 +1546,7 @@
1542 self.vbox_toolbars.foreach(self.__remove_backend_infobar, backend_id)1546 self.vbox_toolbars.foreach(self.__remove_backend_infobar, backend_id)
1543 # add a new one1547 # add a new one
1544 infobar = CustomInfoBar(self.req, self, self.vmanager, backend_id)1548 infobar = CustomInfoBar(self.req, self, self.vmanager, backend_id)
1545 self.vbox_toolbars.pack_start(infobar, True)1549 self.vbox_toolbars.pack_start(infobar, True, True, 0)
1546 return infobar1550 return infobar
15471551
1548#### SEARCH RELATED STUFF #####################################################1552#### SEARCH RELATED STUFF #####################################################
@@ -1570,7 +1574,7 @@
15701574
1571 self.search_actions = []1575 self.search_actions = []
15721576
1573 self.search_complete_store = gtk.ListStore(str)1577 self.search_complete_store = Gtk.ListStore(str)
1574 for tagname in self.req.get_all_tags():1578 for tagname in self.req.get_all_tags():
1575 # only for regular tags1579 # only for regular tags
1576 if tagname.startswith("@"):1580 if tagname.startswith("@"):
15771581
=== modified file 'GTG/gtk/browser/custominfobar.py'
--- GTG/gtk/browser/custominfobar.py 2013-11-23 14:40:23 +0000
+++ GTG/gtk/browser/custominfobar.py 2014-01-12 07:15:48 +0000
@@ -17,7 +17,7 @@
17# this program. If not, see <http://www.gnu.org/licenses/>.17# this program. If not, see <http://www.gnu.org/licenses/>.
18# -----------------------------------------------------------------------------18# -----------------------------------------------------------------------------
1919
20import gtk20from gi.repository import Gtk
21import threading21import threading
2222
23from GTG import _23from GTG import _
@@ -25,9 +25,9 @@
25from GTG.tools.networkmanager import is_connection_up25from GTG.tools.networkmanager import is_connection_up
2626
2727
28class CustomInfoBar(gtk.InfoBar):28class CustomInfoBar(Gtk.InfoBar):
29 '''29 '''
30 A gtk.InfoBar specialized for displaying errors and requests for30 A Gtk.InfoBar specialized for displaying errors and requests for
31 interaction coming from the backends31 interaction coming from the backends
32 '''32 '''
3333
@@ -61,19 +61,19 @@
61 def get_backend_id(self):61 def get_backend_id(self):
62 '''62 '''
63 Getter function to return the id of the backend for which this63 Getter function to return the id of the backend for which this
64 gtk.InfoBar was created64 Gtk.InfoBar was created
65 '''65 '''
66 return self.backend_id66 return self.backend_id
6767
68 def _populate(self):68 def _populate(self):
69 '''Setting up gtk widgets'''69 '''Setting up gtk widgets'''
70 content_hbox = self.get_content_area()70 content_box = self.get_content_area()
71 content_hbox.set_homogeneous(False)71 content_box.set_homogeneous(False)
72 self.label = gtk.Label()72 self.label = Gtk.Label()
73 self.label.set_line_wrap(True)73 self.label.set_line_wrap(True)
74 self.label.set_alignment(0.5, 0.5)74 self.label.set_alignment(0.5, 0.5)
75 self.label.set_justify(gtk.JUSTIFY_FILL)75 self.label.set_justify(Gtk.Justification.FILL)
76 content_hbox.pack_start(self.label, True, True)76 content_box.pack_start(self.label, True, True, 0)
7777
78 def _on_error_response(self, widget, event):78 def _on_error_response(self, widget, event):
79 '''79 '''
@@ -84,7 +84,7 @@
84 @param event: the code of the gtk response84 @param event: the code of the gtk response
85 '''85 '''
86 self.hide()86 self.hide()
87 if event == gtk.RESPONSE_ACCEPT:87 if event == Gtk.ResponseType.ACCEPT:
88 self.vmanager.configure_backend(backend_id=self.backend_id)88 self.vmanager.configure_backend(backend_id=self.backend_id)
8989
90 def set_error_code(self, error_code):90 def set_error_code(self, error_code):
@@ -99,24 +99,24 @@
99 backend_name = self.backend.get_human_name()99 backend_name = self.backend.get_human_name()
100100
101 if error_code == BackendSignals.ERRNO_AUTHENTICATION:101 if error_code == BackendSignals.ERRNO_AUTHENTICATION:
102 self.set_message_type(gtk.MESSAGE_ERROR)102 self.set_message_type(Gtk.MessageType.ERROR)
103 self.label.set_markup(self.AUTHENTICATION_MESSAGE % backend_name)103 self.label.set_markup(self.AUTHENTICATION_MESSAGE % backend_name)
104 self.add_button(_('Configure synchronization service'),104 self.add_button(_('Configure synchronization service'),
105 gtk.RESPONSE_ACCEPT)105 Gtk.ResponseType.ACCEPT)
106 self.add_button(_('Ignore'), gtk.RESPONSE_CLOSE)106 self.add_button(_('Ignore'), Gtk.ResponseType.CLOSE)
107107
108 elif error_code == BackendSignals.ERRNO_NETWORK:108 elif error_code == BackendSignals.ERRNO_NETWORK:
109 if not is_connection_up():109 if not is_connection_up():
110 return110 return
111 self.set_message_type(gtk.MESSAGE_WARNING)111 self.set_message_type(Gtk.MessageType.WARNING)
112 self.label.set_markup(self.NETWORK_MESSAGE % backend_name)112 self.label.set_markup(self.NETWORK_MESSAGE % backend_name)
113 # FIXME: use gtk stock button instead113 # FIXME: use gtk stock button instead
114 self.add_button(_('Ok'), gtk.RESPONSE_CLOSE)114 self.add_button(_('Ok'), Gtk.ResponseType.CLOSE)
115115
116 elif error_code == BackendSignals.ERRNO_DBUS:116 elif error_code == BackendSignals.ERRNO_DBUS:
117 self.set_message_type(gtk.MESSAGE_WARNING)117 self.set_message_type(Gtk.MessageType.WARNING)
118 self.label.set_markup(self.DBUS_MESSAGE % backend_name)118 self.label.set_markup(self.DBUS_MESSAGE % backend_name)
119 self.add_button(_('Ok'), gtk.RESPONSE_CLOSE)119 self.add_button(_('Ok'), Gtk.ResponseType.CLOSE)
120120
121 self.show_all()121 self.show_all()
122122
@@ -132,14 +132,14 @@
132 '''132 '''
133 self._populate()133 self._populate()
134 self.callback = callback134 self.callback = callback
135 self.set_message_type(gtk.MESSAGE_INFO)135 self.set_message_type(Gtk.MessageType.INFO)
136 self.label.set_markup(description)136 self.label.set_markup(description)
137 self.connect("response", self._on_interaction_response)137 self.connect("response", self._on_interaction_response)
138 self.interaction_type = interaction_type138 self.interaction_type = interaction_type
139 if interaction_type == BackendSignals().INTERACTION_CONFIRM:139 if interaction_type == BackendSignals().INTERACTION_CONFIRM:
140 self.add_button(_('Confirm'), gtk.RESPONSE_ACCEPT)140 self.add_button(_('Confirm'), Gtk.ResponseType.ACCEPT)
141 elif interaction_type == BackendSignals().INTERACTION_TEXT:141 elif interaction_type == BackendSignals().INTERACTION_TEXT:
142 self.add_button(_('Continue'), gtk.RESPONSE_ACCEPT)142 self.add_button(_('Continue'), Gtk.ResponseType.ACCEPT)
143 self.show_all()143 self.show_all()
144144
145 def _on_interaction_response(self, widget, event):145 def _on_interaction_response(self, widget, event):
@@ -150,10 +150,10 @@
150 @param widget: not used, here for compatibility with signals callbacks150 @param widget: not used, here for compatibility with signals callbacks
151 @param event: the code of the gtk response151 @param event: the code of the gtk response
152 '''152 '''
153 if event == gtk.RESPONSE_ACCEPT:153 if event == Gtk.ResponseType.ACCEPT:
154 if self.interaction_type == BackendSignals().INTERACTION_TEXT:154 if self.interaction_type == BackendSignals().INTERACTION_TEXT:
155 self._prepare_textual_interaction()155 self._prepare_textual_interaction()
156 print "done"156 print("done")
157 elif self.interaction_type == BackendSignals().INTERACTION_CONFIRM:157 elif self.interaction_type == BackendSignals().INTERACTION_CONFIRM:
158 self.hide()158 self.hide()
159 threading.Thread(target=getattr(self.backend,159 threading.Thread(target=getattr(self.backend,
@@ -167,33 +167,33 @@
167 title, description\167 title, description\
168 = getattr(self.backend,168 = getattr(self.backend,
169 self.callback)("get_ui_dialog_text")169 self.callback)("get_ui_dialog_text")
170 self.dialog = gtk.Window() # type = gtk.WINDOW_POPUP)170 self.dialog = Gtk.Window() # type = Gtk.WindowType.POPUP
171 self.dialog.set_title(title)171 self.dialog.set_title(title)
172 self.dialog.set_transient_for(self.browser.window)172 self.dialog.set_transient_for(self.browser.window)
173 self.dialog.set_destroy_with_parent(True)173 self.dialog.set_destroy_with_parent(True)
174 self.dialog.set_position(gtk.WIN_POS_CENTER_ON_PARENT)174 self.dialog.set_position(Gtk.WindowPosition.CENTER_ON_PARENT)
175 self.dialog.set_modal(True)175 self.dialog.set_modal(True)
176 # self.dialog.set_size_request(300,170)176 # self.dialog.set_size_request(300,170)
177 vbox = gtk.VBox()177 vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
178 self.dialog.add(vbox)178 self.dialog.add(vbox)
179 description_label = gtk.Label()179 description_label = Gtk.Label()
180 description_label.set_justify(gtk.JUSTIFY_FILL)180 description_label.set_justify(Gtk.Justification.FILL)
181 description_label.set_line_wrap(True)181 description_label.set_line_wrap(True)
182 description_label.set_markup(description)182 description_label.set_markup(description)
183 align = gtk.Alignment(0.5, 0.5, 1, 1)183 align = Gtk.Alignment.new(0.5, 0.5, 1, 1)
184 align.set_padding(10, 0, 20, 20)184 align.set_padding(10, 0, 20, 20)
185 align.add(description_label)185 align.add(description_label)
186 vbox.pack_start(align)186 vbox.pack_start(align, True, True, 0)
187 self.text_box = gtk.Entry()187 self.text_box = Gtk.Entry()
188 self.text_box.set_size_request(-1, 40)188 self.text_box.set_size_request(-1, 40)
189 align = gtk.Alignment(0.5, 0.5, 1, 1)189 align = Gtk.Alignment.new(0.5, 0.5, 1, 1)
190 align.set_padding(20, 20, 20, 20)190 align.set_padding(20, 20, 20, 20)
191 align.add(self.text_box)191 align.add(self.text_box)
192 vbox.pack_start(align)192 vbox.pack_start(align, True, True, 0)
193 button = gtk.Button(stock=gtk.STOCK_OK)193 button = Gtk.Button(stock=Gtk.STOCK_OK)
194 button.connect("clicked", self._on_text_confirmed)194 button.connect("clicked", self._on_text_confirmed)
195 button.set_size_request(-1, 40)195 button.set_size_request(-1, 40)
196 vbox.pack_start(button, False)196 vbox.pack_start(button, False, True, 0)
197 self.dialog.show_all()197 self.dialog.show_all()
198 self.hide()198 self.hide()
199199
200200
=== modified file 'GTG/gtk/browser/modifytags_dialog.py'
--- GTG/gtk/browser/modifytags_dialog.py 2013-11-23 14:40:23 +0000
+++ GTG/gtk/browser/modifytags_dialog.py 2014-01-12 07:15:48 +0000
@@ -17,15 +17,18 @@
17# this program. If not, see <http://www.gnu.org/licenses/>.17# this program. If not, see <http://www.gnu.org/licenses/>.
18# -----------------------------------------------------------------------------18# -----------------------------------------------------------------------------
19""" A dialog for batch adding/removal of tags """19""" A dialog for batch adding/removal of tags """
20import gtk20
21from gi.repository import Gtk
2122
22from GTG import _23from GTG import _
23from GTG.gtk.browser import GnomeConfig24from GTG.gtk.browser import GnomeConfig
24from GTG.tools.tags import parse_tag_list25from GTG.tools.tags import parse_tag_list
2526
2627
27class ModifyTagsDialog:28class ModifyTagsDialog(object):
28 """ Dialog for batch adding/removal of tags """29 """
30 Dialog for batch adding/removal of tags
31 """
2932
30 def __init__(self, tag_completion, req):33 def __init__(self, tag_completion, req):
31 self.req = req34 self.req = req
@@ -39,9 +42,9 @@
39 self.last_apply_to_subtasks = False42 self.last_apply_to_subtasks = False
4043
41 def _init_dialog(self):44 def _init_dialog(self):
42 """ Init .glade file """45 """ Init GtkBuilder .ui file """
43 builder = gtk.Builder()46 builder = Gtk.Builder()
44 builder.add_from_file(GnomeConfig.MODIFYTAGS_GLADE_FILE)47 builder.add_from_file(GnomeConfig.MODIFYTAGS_UI_FILE)
45 builder.connect_signals({48 builder.connect_signals({
46 "on_modifytags_confirm":49 "on_modifytags_confirm":
47 self.on_confirm,50 self.on_confirm,
@@ -97,3 +100,5 @@
97 # Rember the last actions100 # Rember the last actions
98 self.last_tag_entry = self.tag_entry.get_text()101 self.last_tag_entry = self.tag_entry.get_text()
99 self.last_apply_to_subtasks = self.apply_to_subtasks.get_active()102 self.last_apply_to_subtasks = self.apply_to_subtasks.get_active()
103
104# -----------------------------------------------------------------------------
100105
=== renamed file 'GTG/gtk/browser/modifytags_dialog.glade' => 'GTG/gtk/browser/modifytags_dialog.ui'
--- GTG/gtk/browser/modifytags_dialog.glade 2012-05-23 08:55:31 +0000
+++ GTG/gtk/browser/modifytags_dialog.ui 2014-01-12 07:15:48 +0000
@@ -1,6 +1,6 @@
1<?xml version="1.0" encoding="UTF-8"?>1<?xml version="1.0" encoding="UTF-8"?>
2<interface>2<interface>
3 <requires lib="gtk+" version="2.16"/>3 <!-- interface-requires gtk+ 3.0 -->
4 <object class="GtkDialog" id="modifytags_dialog">4 <object class="GtkDialog" id="modifytags_dialog">
5 <property name="can_focus">False</property>5 <property name="can_focus">False</property>
6 <property name="border_width">5</property>6 <property name="border_width">5</property>
@@ -11,6 +11,7 @@
11 <object class="GtkBox" id="modifytags_dialog_vbox">11 <object class="GtkBox" id="modifytags_dialog_vbox">
12 <property name="visible">True</property>12 <property name="visible">True</property>
13 <property name="can_focus">False</property>13 <property name="can_focus">False</property>
14 <property name="orientation">vertical</property>
14 <property name="spacing">2</property>15 <property name="spacing">2</property>
15 <child internal-child="action_area">16 <child internal-child="action_area">
16 <object class="GtkButtonBox" id="dialog-action_area3">17 <object class="GtkButtonBox" id="dialog-action_area3">
1718
=== modified file 'GTG/gtk/browser/simple_color_selector.py'
--- GTG/gtk/browser/simple_color_selector.py 2013-11-23 14:40:23 +0000
+++ GTG/gtk/browser/simple_color_selector.py 2014-01-12 07:15:48 +0000
@@ -22,10 +22,8 @@
22from a palette. The widget also allows to define and add new colors.22from a palette. The widget also allows to define and add new colors.
23"""23"""
2424
25import pygtk25from gi.repository import GObject, Gtk, Gdk
26pygtk.require('2.0')26
27import gobject
28import gtk
29import math27import math
3028
31from GTG import _29from GTG import _
@@ -43,38 +41,42 @@
43BUTTON_HEIGHT = 2441BUTTON_HEIGHT = 24
4442
4543
46class SimpleColorSelectorPaletteItem(gtk.DrawingArea):44class SimpleColorSelectorPaletteItem(Gtk.DrawingArea):
47 """An item of the color selecctor palette"""45 """An item of the color selecctor palette"""
4846
49 def __init__(self, color=None):47 def __init__(self, color=None):
50 gtk.DrawingArea.__init__(self)48 Gtk.DrawingArea.__init__(self)
51 self.__gobject_init__()
52 self.color = color49 self.color = color
53 self.selected = False50 self.selected = False
54 self.add_events(gtk.gdk.BUTTON_PRESS_MASK)51 self.add_events(Gdk.EventMask.BUTTON_PRESS_MASK)
55 # Connect callbacks52 # Connect callbacks
56 self.connect("expose_event", self.on_expose)53 #FIXME
54 #self.connect("expose-event", self.on_expose)
55 self.connect("draw", self.on_expose)
57 self.connect("configure_event", self.on_configure)56 self.connect("configure_event", self.on_configure)
5857
59 def __draw(self):58 def __draw(self, cr):
60 """Draws the widget"""59 """Draws the widget"""
61 alloc = self.get_allocation()60 alloc = self.get_allocation()
62 alloc_w, alloc_h = alloc[2], alloc[3]61 #FIXME - why to use a special variables?
62 alloc_w, alloc_h = alloc.width, alloc.height
63 # Drawing context63 # Drawing context
64 cr_ctxt = self.window.cairo_create()64 #cr_ctxt = self.window.cairo_create() # pylint: disable-msg=E1101
65 gdkcontext = gtk.gdk.CairoContext(cr_ctxt)65 #gdkcontext = Gdk.CairoContext(cr_ctxt)
66 #FIXME
67 gdkcontext = cr
6668
67 # Draw rectangle69 # Draw rectangle
68 if self.color is not None:70 if self.color is not None:
69 my_color = gtk.gdk.color_parse(self.color)71 my_color = Gdk.color_parse(self.color)
70 gdkcontext.set_source_color(my_color)72 Gdk.cairo_set_source_color(gdkcontext, my_color)
71 else:73 else:
72 gdkcontext.set_source_rgba(0, 0, 0, 0)74 Gdk.cairo_set_source_rgba(gdkcontext, Gdk.RGBA(0, 0, 0, 0))
73 gdkcontext.rectangle(0, 0, alloc_w, alloc_h)75 gdkcontext.rectangle(0, 0, alloc_w, alloc_h)
74 gdkcontext.fill()76 gdkcontext.fill()
7577
76 # Outer line78 # Outer line
77 gdkcontext.set_source_rgba(0, 0, 0, 0.30)79 Gdk.cairo_set_source_rgba(gdkcontext, Gdk.RGBA(0, 0, 0, 0.30))
78 gdkcontext.set_line_width(2.0)80 gdkcontext.set_line_width(2.0)
79 gdkcontext.rectangle(0, 0, alloc_w, alloc_h)81 gdkcontext.rectangle(0, 0, alloc_w, alloc_h)
80 gdkcontext.stroke()82 gdkcontext.stroke()
@@ -84,16 +86,17 @@
84 size = alloc_h * 0.50 - 386 size = alloc_h * 0.50 - 3
85 pos_x = math.floor((alloc_w - size) / 2)87 pos_x = math.floor((alloc_w - size) / 2)
86 pos_y = math.floor((alloc_h - size) / 2)88 pos_y = math.floor((alloc_h - size) / 2)
87 gdkcontext.set_source_rgba(255, 255, 255, 0.80)89 Gdk.cairo_set_source_rgba(gdkcontext,
90 Gdk.RGBA(255, 255, 255, 0.80))
88 gdkcontext.arc(91 gdkcontext.arc(
89 alloc_w / 2, alloc_h / 2, size / 2 + 3, 0, 2 * math.pi)92 alloc_w / 2, alloc_h / 2, size / 2 + 3, 0, 2 * math.pi)
90 gdkcontext.fill()93 gdkcontext.fill()
91 gdkcontext.set_line_width(1.0)94 gdkcontext.set_line_width(1.0)
92 gdkcontext.set_source_rgba(0, 0, 0, 0.20)95 Gdk.cairo_set_source_rgba(gdkcontext, Gdk.RGBA(0, 0, 0, 0.20))
93 gdkcontext.arc(96 gdkcontext.arc(
94 alloc_w / 2, alloc_h / 2, size / 2 + 3, 0, 2 * math.pi)97 alloc_w / 2, alloc_h / 2, size / 2 + 3, 0, 2 * math.pi)
95 gdkcontext.stroke()98 gdkcontext.stroke()
96 gdkcontext.set_source_rgba(0, 0, 0, 0.50)99 Gdk.cairo_set_source_rgba(gdkcontext, Gdk.RGBA(0, 0, 0, 0.50))
97 gdkcontext.set_line_width(3.0)100 gdkcontext.set_line_width(3.0)
98 gdkcontext.move_to(pos_x, pos_y + size / 2)101 gdkcontext.move_to(pos_x, pos_y + size / 2)
99 gdkcontext.line_to(pos_x + size / 2, pos_y + size)102 gdkcontext.line_to(pos_x + size / 2, pos_y + size)
@@ -101,13 +104,14 @@
101 gdkcontext.stroke()104 gdkcontext.stroke()
102105
103 ### callbacks ###106 ### callbacks ###
104 def on_expose(self, widget, params):107 def on_expose(self, widget, cr):
105 """Callback: redraws the widget when it is exposed"""108 """Callback: redraws the widget when it is exposed"""
106 self.__draw()109 self.__draw(cr)
107110
108 def on_configure(self, widget, params):111 def on_configure(self, widget, params):
109 """Callback: redraws the widget when it is exposed"""112 """Callback: redraws the widget when it is exposed"""
110 self.__draw()113 #FIXME - missing cairo context
114 #self.__draw(cr)
111115
112 ### PUBLIC IF ###116 ### PUBLIC IF ###
113 def set_color(self, color):117 def set_color(self, color):
@@ -124,13 +128,12 @@
124 return self.selected128 return self.selected
125129
126130
127class SimpleColorSelector(gtk.VBox):131class SimpleColorSelector(Gtk.Box):
128 """Widget displaying a palette of colors, possibly with a button allowing132 """Widget displaying a palette of colors, possibly with a button allowing
129 to define new colors."""133 to define new colors."""
130134
131 def __init__(self, width=9, colors=None, custom_colors=None):135 def __init__(self, width=9, colors=None, custom_colors=None):
132 gtk.VBox.__init__(self)136 Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL)
133 self.__gobject_init__()
134 self.width = width137 self.width = width
135 # widget model138 # widget model
136 if colors is None:139 if colors is None:
@@ -168,16 +171,16 @@
168 """Draws the palette of colors"""171 """Draws the palette of colors"""
169 self.__reset_palette()172 self.__reset_palette()
170 # (re-)create the palette widget173 # (re-)create the palette widget
171 self.palette = gtk.Alignment()174 self.palette = Gtk.Alignment()
172 self.pack_start(self.palette)175 self.pack_start(self.palette, True, True, 0)
173 # Draw the palette176 # Draw the palette
174 vbox = gtk.VBox()177 vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
175 self.palette.add(vbox)178 self.palette.add(vbox)
176 vbox.set_spacing(4)179 vbox.set_spacing(4)
177 for i in xrange(len(self.colors)):180 for i in range(len(self.colors)):
178 if i % self.width == 0:181 if i % self.width == 0:
179 cur_hbox = gtk.HBox()182 cur_box = Gtk.Box()
180 vbox.pack_start(cur_hbox)183 vbox.pack_start(cur_box, True, True, 0)
181 # add the color box184 # add the color box
182 img = SimpleColorSelectorPaletteItem()185 img = SimpleColorSelectorPaletteItem()
183 img.set_size_request(186 img.set_size_request(
@@ -186,8 +189,8 @@
186 img.set_color(self.colors[i])189 img.set_color(self.colors[i])
187 self.buttons_lookup[self.colors[i]] = img190 self.buttons_lookup[self.colors[i]] = img
188 self.buttons.append(img)191 self.buttons.append(img)
189 cur_hbox.pack_start(img, expand=False, fill=False)192 cur_box.pack_start(img, False, False, 0)
190 cur_hbox.set_spacing(4)193 cur_box.set_spacing(4)
191 # make palette visible194 # make palette visible
192 self.palette.show_all()195 self.palette.show_all()
193196
@@ -207,16 +210,16 @@
207 """Draws the palette of custom colors"""210 """Draws the palette of custom colors"""
208 self.__reset_custom_palette()211 self.__reset_custom_palette()
209 # (re-)create the palette widget212 # (re-)create the palette widget
210 self.custom_palette = gtk.Alignment(xscale=1.0)213 self.custom_palette = Gtk.Alignment.new(0, 0, 1, 0)
211 self.custom_palette.set_padding(10, 0, 0, 0)214 self.custom_palette.set_padding(10, 0, 0, 0)
212 self.pack_start(self.custom_palette)215 self.pack_start(self.custom_palette, True, True, 0)
213 # Draw the previous color palette: only one line216 # Draw the previous color palette: only one line
214 cc_vbox = gtk.VBox()217 cc_vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
215 self.custom_palette.add(cc_vbox)218 self.custom_palette.add(cc_vbox)
216 cc_vbox.set_spacing(4)219 cc_vbox.set_spacing(4)
217 cc_hbox = gtk.HBox()220 cc_box = Gtk.Box()
218 cc_vbox.pack_start(cc_hbox)221 cc_vbox.pack_start(cc_box, True, True, 0)
219 for i in xrange(len(self.custom_colors)):222 for i in range(len(self.custom_colors)):
220 # add the color box223 # add the color box
221 img = SimpleColorSelectorPaletteItem()224 img = SimpleColorSelectorPaletteItem()
222 img.set_size_request(225 img.set_size_request(
@@ -225,15 +228,15 @@
225 if i < len(self.custom_colors):228 if i < len(self.custom_colors):
226 img.set_color(self.custom_colors[i])229 img.set_color(self.custom_colors[i])
227 self.buttons_lookup[self.custom_colors[i]] = img230 self.buttons_lookup[self.custom_colors[i]] = img
228 cc_hbox.pack_start(img, expand=False, fill=False)231 cc_box.pack_start(img, False, False, 0)
229 cc_hbox.set_spacing(4)232 cc_box.set_spacing(4)
230 self.cc_buttons.append(img)233 self.cc_buttons.append(img)
231 # Draw the add button234 # Draw the add button
232 buttons_hbox = gtk.HBox()235 buttons_hbox = Gtk.Box()
233 cc_vbox.pack_start(buttons_hbox)236 cc_vbox.pack_start(buttons_hbox)
234 img = gtk.Image()237 img = Gtk.Image()
235 img.set_from_stock(gtk.STOCK_ADD, gtk.ICON_SIZE_BUTTON)238 img.set_from_stock(Gtk.STOCK_ADD, Gtk.ICON_SIZE_BUTTON)
236 self.add_button = gtk.Button()239 self.add_button = Gtk.Button()
237 self.add_button.set_image(img)240 self.add_button.set_image(img)
238 self.add_button.set_label(_("Add custom color"))241 self.add_button.set_label(_("Add custom color"))
239 buttons_hbox.pack_start(self.add_button, expand=True, fill=False)242 buttons_hbox.pack_start(self.add_button, expand=True, fill=False)
@@ -284,16 +287,19 @@
284 def on_color_add(self, widget):287 def on_color_add(self, widget):
285 """Callback: when adding a new color, show the color definition288 """Callback: when adding a new color, show the color definition
286 window, update the model, notifies the parent."""289 window, update the model, notifies the parent."""
287 color_dialog = gtk.ColorSelectionDialog(_('Choose a color'))290 color_dialog = Gtk.ColorSelectionDialog(_('Choose a color'))
288 colorsel = color_dialog.colorsel291#FIXME
292 colorsel = color_dialog.get_color_selection()
289 if self.selected_col is not None:293 if self.selected_col is not None:
290 color = gtk.gdk.color_parse(self.selected_col.color)294 color = Gdk.color_parse(self.selected_col.color)
291 colorsel.set_current_color(color)295 colorsel.set_current_color(color)
292 response = color_dialog.run()296 response = color_dialog.run()
293 new_color = colorsel.get_current_color()297 new_color = colorsel.get_current_color()
294 # Check response_id and set color if required298 # Check response_id and set color if required
295 if response == gtk.RESPONSE_OK and new_color:299 if response == Gtk.ResponseType.OK and new_color:
296 strcolor = gtk.color_selection_palette_to_string([new_color])300#FIXME
301 #strcolor = Gtk.color_selection_palette_to_string([new_color])
302 strcolor = new_color.to_string()
297 # Add the color to the palette and notify303 # Add the color to the palette and notify
298 if strcolor not in self.colors:304 if strcolor not in self.colors:
299 self.add_custom_color(strcolor)305 self.add_custom_color(strcolor)
@@ -356,8 +362,8 @@
356 self.selected_col = None362 self.selected_col = None
357 self.clear_button.set_sensitive(False)363 self.clear_button.set_sensitive(False)
358364
359gobject.type_register(SimpleColorSelector)365Gobject.type_register(SimpleColorSelector)
360gobject.signal_new("color-changed", SimpleColorSelector,366Gobject.signal_new("color-changed", SimpleColorSelector,
361 gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ())367 Gobject.SIGNAL_RUN_FIRST, Gobject.TYPE_NONE, ())
362gobject.signal_new("color-added", SimpleColorSelector,368Gobject.signal_new("color-added", SimpleColorSelector,
363 gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ())369 Gobject.SIGNAL_RUN_FIRST, Gobject.TYPE_NONE, ())
364370
=== modified file 'GTG/gtk/browser/tag_context_menu.py'
--- GTG/gtk/browser/tag_context_menu.py 2013-11-23 14:40:23 +0000
+++ GTG/gtk/browser/tag_context_menu.py 2014-01-12 07:15:48 +0000
@@ -26,19 +26,16 @@
26like a color picker)26like a color picker)
27"""27"""
2828
29import pygtk29from gi.repository import Gtk
30pygtk.require('2.0')
31import gtk
3230
33from GTG import _31from GTG import _
3432
3533
36class TagContextMenu(gtk.Menu):34class TagContextMenu(Gtk.Menu):
37 """Context menu fo the tag i the sidebar"""35 """Context menu fo the tag i the sidebar"""
3836
39 def __init__(self, req, vmanager, tag=None):37 def __init__(self, req, vmanager, tag=None):
40 self.__gobject_init__()38 Gtk.Menu.__init__(self)
41 gtk.Menu.__init__(self)
42 self.req = req39 self.req = req
43 self.vmanager = vmanager40 self.vmanager = vmanager
44 self.tag = tag41 self.tag = tag
@@ -54,12 +51,12 @@
54 i.destroy()51 i.destroy()
55 if self.tag is not None:52 if self.tag is not None:
56 # Color chooser FIXME: SHOULD BECOME A COLOR PICKER53 # Color chooser FIXME: SHOULD BECOME A COLOR PICKER
57 self.mi_cc = gtk.MenuItem()54 self.mi_cc = Gtk.MenuItem()
58 self.mi_cc.set_label(_("Edit Tag..."))55 self.mi_cc.set_label(_("Edit Tag..."))
59 self.append(self.mi_cc)56 self.append(self.mi_cc)
60 self.mi_cc.connect('activate', self.on_mi_cc_activate)57 self.mi_cc.connect('activate', self.on_mi_cc_activate)
61 if self.tag.is_search_tag():58 if self.tag.is_search_tag():
62 self.mi_del = gtk.MenuItem()59 self.mi_del = Gtk.MenuItem()
63 self.mi_del.set_label(_("Delete"))60 self.mi_del.set_label(_("Delete"))
64 self.append(self.mi_del)61 self.append(self.mi_del)
65 self.mi_del.connect('activate', self.on_mi_del_activate)62 self.mi_del.connect('activate', self.on_mi_del_activate)
6663
=== modified file 'GTG/gtk/browser/tag_editor.py'
--- GTG/gtk/browser/tag_editor.py 2013-11-23 14:40:23 +0000
+++ GTG/gtk/browser/tag_editor.py 2014-01-12 07:15:48 +0000
@@ -27,48 +27,48 @@
27for a tag.27for a tag.
28"""28"""
2929
30import pygtk30from gi.repository import GObject, Gtk, Gdk, GdkPixbuf
31pygtk.require('2.0')
32import gobject
33import gtk
34import gtk.gdk as gdk
3531
36from GTG import _32from GTG import _
37from GTG.tools.logger import Log33from GTG.tools.logger import Log
38from GTG.gtk.browser.simple_color_selector import SimpleColorSelector34
3935
4036class TagIconSelector(Gtk.Window):
41class TagIconSelector(gtk.Window):
42 """37 """
43 TagIconSelector is intended as a floating window that allows to select38 TagIconSelector is intended as a floating window that allows to select
44 an icon for a tag. It display a list of icon in a popup window.39 an icon for a tag. It display a list of icon in a popup window.
45 """40 """
4641
47 def __init__(self):42 def __init__(self):
48 self.__gobject_init__(type=gtk.WINDOW_POPUP)43 # FIXME
49 gtk.Window.__init__(self)44 #self.__gobject_init__(type=Gtk.WindowType.POPUP)
45 #GObject.GObject.__init__(self)
46 Gtk.Window.__init__(self)
47
50 self.loaded = False48 self.loaded = False
51 self.selected_icon = None49 self.selected_icon = None
52 self.symbol_model = None50 self.symbol_model = None
53 # Build up the window51 # Build up the window
54 self.__build_window()52 self.__build_window()
55 # Make it visible53 # Make it visible
56 self.hide_all()54 #self.hide_all()
55 # FIXME
56 self.hide()
5757
58 def __build_window(self):58 def __build_window(self):
59 """Build up the widget"""59 """Build up the widget"""
60 self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_POPUP_MENU)60 self.set_type_hint(Gdk.WindowTypeHint.POPUP_MENU)
61 vbox = gtk.VBox()61 vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
62 self.add(vbox)62 self.add(vbox)
63 # icon list63 # icon list
64 scld_win = gtk.ScrolledWindow()64 scld_win = Gtk.ScrolledWindow()
65 scld_win.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)65 scld_win.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.ALWAYS)
66 scld_win.set_shadow_type(gtk.SHADOW_ETCHED_IN)66 scld_win.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
67 vbox.pack_start(scld_win, expand=True, fill=True)67 vbox.pack_start(scld_win, True, True, 0)
68 self.symbol_iv = gtk.IconView()68 self.symbol_iv = Gtk.IconView()
69 self.symbol_iv.set_pixbuf_column(0)69 self.symbol_iv.set_pixbuf_column(0)
70 self.symbol_iv.set_property("columns", 7)70 self.symbol_iv.set_columns(7)
71 self.symbol_iv.set_property("item-width", 32)71 self.symbol_iv.set_item_width(32)
72 # IconView size:72 # IconView size:
73 # --------------73 # --------------
74 # it seems that with the above parameters, a row width is about:74 # it seems that with the above parameters, a row width is about:
@@ -80,19 +80,19 @@
80 self.symbol_iv.set_size_request(40 * 7 + 12, 38 * 4)80 self.symbol_iv.set_size_request(40 * 7 + 12, 38 * 4)
81 scld_win.add(self.symbol_iv)81 scld_win.add(self.symbol_iv)
82 # icon remove button82 # icon remove button
83 img = gtk.Image()83 img = Gtk.Image()
84 img.set_from_stock(gtk.STOCK_REMOVE, gtk.ICON_SIZE_BUTTON)84 img.set_from_stock(Gtk.STOCK_REMOVE, Gtk.IconSize.BUTTON)
85 self.remove_bt = gtk.Button()85 self.remove_bt = Gtk.Button()
86 self.remove_bt.set_image(img)86 self.remove_bt.set_image(img)
87 self.remove_bt.set_label(_("Remove selected icon"))87 self.remove_bt.set_label(_("Remove selected icon"))
88 vbox.pack_start(self.remove_bt, fill=False, expand=False)88 vbox.pack_start(self.remove_bt, False, False, 0)
89 # set the callbacks89 # set the callbacks
90 self.symbol_iv.connect("selection-changed", self.on_selection_changed)90 self.symbol_iv.connect("selection-changed", self.on_selection_changed)
91 self.remove_bt.connect("clicked", self.on_remove_bt_clicked)91 self.remove_bt.connect("clicked", self.on_remove_bt_clicked)
9292
93 def __focus_out(self, widget, event):93 def __focus_out(self, widget, event):
94 """Hides the window if the user clicks out of it"""94 """Hides the window if the user clicks out of it"""
95 win_ptr = self.window.get_pointer()95 win_ptr = self.get_window().get_pointer()
96 win_size = self.get_size()96 win_size = self.get_size()
97 if not(0 <= win_ptr[0] <= win_size[0] and97 if not(0 <= win_ptr[0] <= win_size[0] and
98 0 <= win_ptr[1] <= win_size[1]):98 0 <= win_ptr[1] <= win_size[1]):
@@ -106,12 +106,12 @@
106 libraries, e.g. bug #1079587. Gracefuly degradate and skip106 libraries, e.g. bug #1079587. Gracefuly degradate and skip
107 the loading of a corrupted icon.107 the loading of a corrupted icon.
108 """108 """
109 self.symbol_model = gtk.ListStore(gtk.gdk.Pixbuf, str)109 self.symbol_model = Gtk.ListStore(GdkPixbuf.Pixbuf, str)
110 for icon in gtk.icon_theme_get_default().list_icons(context="Emblems"):110 for icon in Gtk.IconTheme.get_default().list_icons(context="Emblems"):
111 try:111 try:
112 img = gtk.icon_theme_get_default().load_icon(icon, 16, 0)112 img = Gtk.IconTheme.get_default().load_icon(icon, 16, 0)
113 self.symbol_model.append([img, icon])113 self.symbol_model.append([img, icon])
114 except gobject.GError:114 except GObject.GError:
115 Log.error("Failed to load icon '%s'" % icon)115 Log.error("Failed to load icon '%s'" % icon)
116 self.symbol_iv.set_model(self.symbol_model)116 self.symbol_iv.set_model(self.symbol_model)
117 self.loaded = True117 self.loaded = True
@@ -152,14 +152,22 @@
152 self.move(pos_x, pos_y)152 self.move(pos_x, pos_y)
153 self.grab_add()153 self.grab_add()
154 # We grab the pointer in the calendar154 # We grab the pointer in the calendar
155 gdk.pointer_grab(self.window, True,155# FIXME THIS DOES NOT WORK!!!!!!!
156 gdk.BUTTON1_MASK | gdk.MOD2_MASK)156 Gdk.pointer_grab(self.get_window(), True,
157 # Gdk.ModifierType.BUTTON1_MASK |
158 # Gdk.ModifierType.MOD2_MASK,
159 # FIXME!!!! JUST GUESSING THE TYPE
160 Gdk.EventMask.ALL_EVENTS_MASK,
161 None,
162 None,
163 0,)
157 self.connect('button-press-event', self.__focus_out)164 self.connect('button-press-event', self.__focus_out)
158165
159 def close_selector(self):166 def close_selector(self):
160 """Hides the window"""167 """Hides the window"""
161 self.hide()168 self.hide()
162 gtk.gdk.pointer_ungrab()169#FIXME!!!
170 Gdk.pointer_ungrab(0)
163 self.grab_remove()171 self.grab_remove()
164172
165 def get_selected_icon(self):173 def get_selected_icon(self):
@@ -171,17 +179,17 @@
171 self.symbol_iv.unselect_all()179 self.symbol_iv.unselect_all()
172180
173181
174gobject.type_register(TagIconSelector)182GObject.type_register(TagIconSelector)
175gobject.signal_new("selection-changed", TagIconSelector,183GObject.signal_new("selection-changed", TagIconSelector,
176 gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ())184 GObject.SignalFlags.RUN_FIRST, None, ())
177185
178186
179class TagEditor(gtk.Window):187class TagEditor(Gtk.Window):
180 """Window allowing to edit a tag's properties."""188 """Window allowing to edit a tag's properties."""
181189
182 def __init__(self, req, vmanager, tag=None):190 def __init__(self, req, vmanager, tag=None):
183 gtk.Window.__init__(self)191 Gtk.Window.__init__(self)
184 self.__gobject_init__()192
185 self.req = req193 self.req = req
186 self.vmanager = vmanager194 self.vmanager = vmanager
187 self.tag = tag195 self.tag = tag
@@ -193,7 +201,7 @@
193 self.tis_selection_changed_hid = None201 self.tis_selection_changed_hid = None
194 self.tag_icon_selector = None202 self.tag_icon_selector = None
195 # Build up the window203 # Build up the window
196 self.set_position(gtk.WIN_POS_CENTER)204 self.set_position(Gtk.WindowPosition.CENTER)
197 self.set_title('Edit tag')205 self.set_title('Edit tag')
198 self.set_border_width(10)206 self.set_border_width(10)
199 self.set_resizable(False)207 self.set_resizable(False)
@@ -206,57 +214,59 @@
206 def __build_window(self):214 def __build_window(self):
207 """Build up the widget"""215 """Build up the widget"""
208 # toplevel widget216 # toplevel widget
209 self.top_vbox = gtk.VBox()217 self.top_vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
210 self.add(self.top_vbox)218 self.add(self.top_vbox)
211 # header line: icon, table with name and "hide in wv"219 # header line: icon, grid with name and "hide in wv"
212 self.hdr_align = gtk.Alignment()220 #FIXME
213 self.top_vbox.pack_start(self.hdr_align)221 self.hdr_align = Gtk.Alignment()
222 self.top_vbox.pack_start(self.hdr_align, True, True, 0)
214 self.hdr_align.set_padding(0, 25, 0, 0)223 self.hdr_align.set_padding(0, 25, 0, 0)
215 self.hdr_hbox = gtk.HBox()224 self.hdr_box = Gtk.Box()
216 self.hdr_align.add(self.hdr_hbox)225 self.hdr_align.add(self.hdr_box)
217 self.hdr_hbox.set_spacing(10)226 self.hdr_box.set_spacing(10)
218 # Button to tag icon selector227 # Button to tag icon selector
219 self.ti_bt = gtk.Button()228 self.ti_bt = Gtk.Button()
220 self.ti_bt_label = gtk.Label()229 self.ti_bt_label = Gtk.Label()
221 self.ti_bt.add(self.ti_bt_label)230 self.ti_bt.add(self.ti_bt_label)
222 self.hdr_hbox.pack_start(self.ti_bt)231 self.hdr_box.pack_start(self.ti_bt, True, True, 0)
223 self.ti_bt.set_size_request(64, 64)232 self.ti_bt.set_size_request(64, 64)
224 self.ti_bt.set_relief(gtk.RELIEF_HALF)233 self.ti_bt.set_relief(Gtk.ReliefStyle.HALF)
225 # vbox for tag name and hid in WV234 # vbox for tag name and hid in WV
226 self.tp_table = gtk.Table(2, 2)235 self.tp_grid = Gtk.Grid()
227 self.hdr_hbox.pack_start(self.tp_table)236 self.hdr_box.pack_start(self.tp_grid, True, True, 0)
228 self.tp_table.set_col_spacing(0, 5)237 self.tp_grid.set_column_spacing(5)
229 self.tn_entry_lbl_align = gtk.Alignment(0, 0.5)238 self.tn_entry_lbl_align = Gtk.Alignment.new(0, 0.5, 0, 0)
230 self.tp_table.attach(self.tn_entry_lbl_align, 0, 1, 0, 1)239 self.tp_grid.add(self.tn_entry_lbl_align)
231 self.tn_entry_lbl = gtk.Label()240 self.tn_entry_lbl = Gtk.Label()
232 self.tn_entry_lbl.set_markup("<span weight='bold'>%s</span>"241 self.tn_entry_lbl.set_markup("<span weight='bold'>%s</span>"
233 % _("Name : "))242 % _("Name : "))
234 self.tn_entry_lbl_align.add(self.tn_entry_lbl)243 self.tn_entry_lbl_align.add(self.tn_entry_lbl)
235 self.tn_entry = gtk.Entry()244 self.tn_entry = Gtk.Entry()
236 self.tp_table.attach(self.tn_entry, 1, 2, 0, 1)
237 self.tn_entry.set_width_chars(20)245 self.tn_entry.set_width_chars(20)
238 self.tn_cb_lbl_align = gtk.Alignment(0, 0.5)246 self.tp_grid.attach(self.tn_entry, 1, 0, 1, 1)
239 self.tp_table.attach(self.tn_cb_lbl_align, 0, 1, 1, 2)247 self.tn_cb_lbl_align = Gtk.Alignment.new(0, 0.5, 0, 0)
240 self.tn_cb_lbl = gtk.Label(_("Show Tag in Work View :"))248 self.tp_grid.attach(self.tn_cb_lbl_align, 0, 1, 1, 1)
249 self.tn_cb_lbl = Gtk.Label(label=_("Show Tag in Work View :"))
241 self.tn_cb_lbl_align.add(self.tn_cb_lbl)250 self.tn_cb_lbl_align.add(self.tn_cb_lbl)
242 self.tn_cb = gtk.CheckButton()251 self.tn_cb = Gtk.CheckButton()
243 self.tp_table.attach(self.tn_cb, 1, 2, 1, 2)252 self.tp_grid.attach(self.tn_cb, 1, 1, 1, 1)
244 # Tag color253 # Tag color
245 self.tc_vbox = gtk.VBox()254 self.tc_vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
246 self.top_vbox.pack_start(self.tc_vbox)255 self.top_vbox.pack_start(self.tc_vbox, True, True, 0)
247 self.tc_label_align = gtk.Alignment()256 self.tc_label_align = Gtk.Alignment()
248 self.tc_vbox.pack_start(self.tc_label_align)257 self.tc_vbox.pack_start(self.tc_label_align, True, True, 0)
249 self.tc_label_align.set_padding(0, 0, 0, 0)258 self.tc_label_align.set_padding(0, 0, 0, 0)
250 self.tc_label = gtk.Label()259 self.tc_label = Gtk.Label()
251 self.tc_label_align.add(self.tc_label)260 self.tc_label_align.add(self.tc_label)
252 self.tc_label.set_markup(261 self.tc_label.set_markup(
253 "<span weight='bold'>%s</span>" % _("Select Tag Color:"))262 "<span weight='bold'>%s</span>" % _("Select Tag Color:"))
254 self.tc_label.set_alignment(0, 0.5)263 self.tc_label.set_alignment(0, 0.5)
255 # Tag color chooser264 # Tag color chooser
256 self.tc_cc_align = gtk.Alignment(0.5, 0.5, 0, 0)265 self.tc_cc_align = Gtk.Alignment.new(0.5, 0.5, 0, 0)
257 self.tc_vbox.pack_start(self.tc_cc_align)266 self.tc_vbox.pack_start(self.tc_cc_align, True, True, 0)
258 self.tc_cc_align.set_padding(15, 15, 10, 10)267 self.tc_cc_align.set_padding(15, 15, 10, 10)
259 self.tc_cc_colsel = SimpleColorSelector()268 #self.tc_cc_colsel = SimpleColorSelector()
269 self.tc_cc_colsel = Gtk.ColorChooserWidget()
260 self.tc_cc_align.add(self.tc_cc_colsel)270 self.tc_cc_align.add(self.tc_cc_colsel)
261 # Icon selector271 # Icon selector
262 self.tag_icon_selector = TagIconSelector()272 self.tag_icon_selector = TagIconSelector()
@@ -272,15 +282,21 @@
272 self.tn_entry.connect('changed', self.on_tn_entry_changed)282 self.tn_entry.connect('changed', self.on_tn_entry_changed)
273 self.tn_cb_clicked_hid = self.tn_cb.connect('clicked',283 self.tn_cb_clicked_hid = self.tn_cb.connect('clicked',
274 self.on_tn_cb_clicked)284 self.on_tn_cb_clicked)
275 self.tc_cc_colsel.connect('color-changed', self.on_tc_colsel_changed)285 #FIXME
276 self.tc_cc_colsel.connect('color-added', self.on_tc_colsel_added)286 #self.tc_cc_colsel.connect('color-changed', self.on_tc_colsel_changed)
287 #self.tc_cc_colsel.connect('color-added', self.on_tc_colsel_added)
288 self.tc_cc_colsel.connect('color-activated',
289 self.on_tc_colsel_activated)
277 self.connect('delete-event', self.on_close)290 self.connect('delete-event', self.on_close)
278291
279 # allow fast closing by Escape key292 # allow fast closing by Escape key
280 agr = gtk.AccelGroup()293 #FIXME
294 '''
295 agr = Gtk.AccelGroup()
281 self.add_accel_group(agr)296 self.add_accel_group(agr)
282 key, modifier = gtk.accelerator_parse('Escape')297 key, modifier = Gtk.accelerator_parse('Escape')
283 agr.connect_group(key, modifier, gtk.ACCEL_VISIBLE, self.on_close)298 agr.connect_group(key, modifier, Gtk.AccelFlags.VISIBLE, self.on_close)
299 '''
284300
285 def __set_default_values(self):301 def __set_default_values(self):
286 """Configure the widget components with their initial default values"""302 """Configure the widget components with their initial default values"""
@@ -291,7 +307,7 @@
291 self.tag_icon_selector.handler_block(self.tis_selection_changed_hid)307 self.tag_icon_selector.handler_block(self.tis_selection_changed_hid)
292 # Default icon308 # Default icon
293 markup = "<span size='small'>%s</span>" % _("Click To\nSet Icon")309 markup = "<span size='small'>%s</span>" % _("Click To\nSet Icon")
294 self.ti_bt_label.set_justify(gtk.JUSTIFY_CENTER)310 self.ti_bt_label.set_justify(Gtk.Justification.CENTER)
295 self.ti_bt_label.set_markup(markup)311 self.ti_bt_label.set_markup(markup)
296 self.ti_bt_label.show()312 self.ti_bt_label.show()
297 self.__set_icon(None)313 self.__set_icon(None)
@@ -301,9 +317,13 @@
301 self.tn_cb.set_active(True)317 self.tn_cb.set_active(True)
302 # Name entry318 # Name entry
303 self.tn_entry.set_text(_("Enter tag name here"))319 self.tn_entry.set_text(_("Enter tag name here"))
304 self.tn_entry.set_icon_from_stock(gtk.ENTRY_ICON_SECONDARY, None)320 self.tn_entry.set_icon_from_stock(Gtk.EntryIconPosition.SECONDARY,
321 None)
305 # Color selection322 # Color selection
306 self.tc_cc_colsel.unselect_color()323 #FIXME
324 #self.tc_cc_colsel.unselect_color()
325 self.tc_cc_colsel.set_use_alpha(False)
326 #self.tc_cc_colsel.set_rgba(self.tc_cc_colsel, None)
307 # Custom colors327 # Custom colors
308 self.custom_colors = self.config.get('custom_colors')328 self.custom_colors = self.config.get('custom_colors')
309 if len(self.custom_colors) > 0:329 if len(self.custom_colors) > 0:
@@ -321,8 +341,8 @@
321 if icon is not None:341 if icon is not None:
322 for i in self.ti_bt:342 for i in self.ti_bt:
323 self.ti_bt.remove(i)343 self.ti_bt.remove(i)
324 ti_bt_img = gtk.image_new_from_icon_name(icon,344 ti_bt_img = Gtk.Image.new_from_icon_name(icon,
325 gtk.ICON_SIZE_BUTTON)345 Gtk.IconSize.BUTTON)
326 ti_bt_img.show()346 ti_bt_img.show()
327 self.ti_bt.add(ti_bt_img)347 self.ti_bt.add(ti_bt_img)
328 else:348 else:
@@ -401,8 +421,11 @@
401 """Callback: displays the tag icon selector widget next421 """Callback: displays the tag icon selector widget next
402 to the button."""422 to the button."""
403 rect = self.ti_bt.get_allocation()423 rect = self.ti_bt.get_allocation()
404 pos_x, pos_y = \424 # print self.ti_bt.get_window().get_origin()
405 self.ti_bt.window.get_origin()425#FIXME
426 result, pos_x, pos_y = \
427 self.ti_bt.get_window().get_origin()
428 # self.ti_bt.window.get_origin()
406 self.tag_icon_selector.show_at_position(429 self.tag_icon_selector.show_at_position(
407 pos_x + rect.x + rect.width + 2,430 pos_x + rect.x + rect.width + 2,
408 pos_y + rect.y)431 pos_y + rect.y)
@@ -417,17 +440,18 @@
417 self.tn_entry_last_recorded_value = self.tn_entry.get_text()440 self.tn_entry_last_recorded_value = self.tn_entry.get_text()
418 # check validity441 # check validity
419 if self.tn_entry_last_recorded_value.strip() == "":442 if self.tn_entry_last_recorded_value.strip() == "":
420 self.tn_entry.set_icon_from_stock(gtk.ENTRY_ICON_SECONDARY,443 self.tn_entry.set_icon_from_stock(Gtk.EntryIconPosition.SECONDARY,
421 gtk.STOCK_DIALOG_ERROR)444 Gtk.STOCK_DIALOG_ERROR)
422 else:445 else:
423 self.tn_entry.set_icon_from_stock(gtk.ENTRY_ICON_SECONDARY, None)446 self.tn_entry.set_icon_from_stock(
447 Gtk.EntryIconPosition.SECONDARY, None)
424 # filter out change requests to reduce commit overhead448 # filter out change requests to reduce commit overhead
425 if self.tn_entry_watch_id is None:449 if self.tn_entry_watch_id is None:
426 # There is no watchers for the text entry. Register one.450 # There is no watchers for the text entry. Register one.
427 # Also, wait 1 second before commiting the change in order to451 # Also, wait 1 second before commiting the change in order to
428 # reduce rename requests452 # reduce rename requests
429 tn_entry_changes = self.watch_tn_entry_changes453 tn_entry_changes = self.watch_tn_entry_changes
430 self.tn_entry_watch_id = gobject.timeout_add(1000,454 self.tn_entry_watch_id = GObject.timeout_add(1000,
431 tn_entry_changes)455 tn_entry_changes)
432456
433 def on_tn_cb_clicked(self, widget):457 def on_tn_cb_clicked(self, widget):
@@ -448,6 +472,19 @@
448 else:472 else:
449 self.tag.del_attribute('color')473 self.tag.del_attribute('color')
450474
475 def on_tc_colsel_activated(self, widget, color):
476 """Callback: update the tag color depending on the current color
477 selection"""
478 print("activated", widget, color, " <--- ignoring for now")
479 return
480 #color = self.tc_cc_colsel.get_rgba().to_color()
481 color = color.to_color()
482 if self.tag is not None:
483 if color is not None:
484 self.tag.set_attribute('color', color)
485 else:
486 self.tag.del_attribute('color')
487
451 def on_tc_colsel_added(self, widget):488 def on_tc_colsel_added(self, widget):
452 """Callback: if a new color is added, we register it in the489 """Callback: if a new color is added, we register it in the
453 configuration"""490 configuration"""
454491
=== renamed file 'GTG/gtk/browser/taskbrowser.glade' => 'GTG/gtk/browser/taskbrowser.ui'
--- GTG/gtk/browser/taskbrowser.glade 2013-11-23 14:40:23 +0000
+++ GTG/gtk/browser/taskbrowser.ui 2014-01-12 07:15:48 +0000
@@ -1,7 +1,6 @@
1<?xml version="1.0" encoding="UTF-8"?>1<?xml version="1.0" encoding="UTF-8"?>
2<interface>2<interface>
3 <requires lib="gtk+" version="2.16"/>3 <!-- interface-requires gtk+ 3.0 -->
4 <!-- interface-naming-policy toplevel-contextual -->
5 <object class="GtkWindow" id="MainWindow">4 <object class="GtkWindow" id="MainWindow">
6 <property name="can_focus">False</property>5 <property name="can_focus">False</property>
7 <property name="title" translatable="yes">Getting Things GNOME!</property>6 <property name="title" translatable="yes">Getting Things GNOME!</property>
@@ -10,9 +9,10 @@
10 <signal name="configure-event" handler="on_move" swapped="no"/>9 <signal name="configure-event" handler="on_move" swapped="no"/>
11 <signal name="size-allocate" handler="on_size_allocate" swapped="no"/>10 <signal name="size-allocate" handler="on_size_allocate" swapped="no"/>
12 <child>11 <child>
13 <object class="GtkVBox" id="master_vbox">12 <object class="GtkBox" id="master_vbox">
14 <property name="visible">True</property>13 <property name="visible">True</property>
15 <property name="can_focus">False</property>14 <property name="can_focus">False</property>
15 <property name="orientation">vertical</property>
16 <child>16 <child>
17 <object class="GtkMenuBar" id="browser_menu">17 <object class="GtkMenuBar" id="browser_menu">
18 <property name="visible">True</property>18 <property name="visible">True</property>
@@ -21,7 +21,6 @@
21 <object class="GtkMenuItem" id="bm_task">21 <object class="GtkMenuItem" id="bm_task">
22 <property name="visible">True</property>22 <property name="visible">True</property>
23 <property name="can_focus">False</property>23 <property name="can_focus">False</property>
24 <property name="use_action_appearance">False</property>
25 <property name="label" translatable="yes">_Tasks</property>24 <property name="label" translatable="yes">_Tasks</property>
26 <property name="use_underline">True</property>25 <property name="use_underline">True</property>
27 <child type="submenu">26 <child type="submenu">
@@ -34,7 +33,6 @@
34 <property name="visible">True</property>33 <property name="visible">True</property>
35 <property name="can_focus">False</property>34 <property name="can_focus">False</property>
36 <property name="tooltip_text" translatable="yes">Create a new task</property>35 <property name="tooltip_text" translatable="yes">Create a new task</property>
37 <property name="use_action_appearance">False</property>
38 <property name="use_underline">True</property>36 <property name="use_underline">True</property>
39 <property name="image">bm_img_task</property>37 <property name="image">bm_img_task</property>
40 <property name="use_stock">False</property>38 <property name="use_stock">False</property>
@@ -48,7 +46,6 @@
48 <property name="visible">True</property>46 <property name="visible">True</property>
49 <property name="sensitive">False</property>47 <property name="sensitive">False</property>
50 <property name="can_focus">False</property>48 <property name="can_focus">False</property>
51 <property name="use_action_appearance">False</property>
52 <property name="use_underline">True</property>49 <property name="use_underline">True</property>
53 <property name="image">bm_img_subtask</property>50 <property name="image">bm_img_subtask</property>
54 <property name="use_stock">False</property>51 <property name="use_stock">False</property>
@@ -62,7 +59,6 @@
62 <property name="visible">True</property>59 <property name="visible">True</property>
63 <property name="sensitive">False</property>60 <property name="sensitive">False</property>
64 <property name="can_focus">False</property>61 <property name="can_focus">False</property>
65 <property name="use_action_appearance">False</property>
66 <property name="use_underline">True</property>62 <property name="use_underline">True</property>
67 <property name="use_stock">True</property>63 <property name="use_stock">True</property>
68 <property name="accel_group">accelgroup1</property>64 <property name="accel_group">accelgroup1</property>
@@ -81,7 +77,6 @@
81 <property name="visible">True</property>77 <property name="visible">True</property>
82 <property name="sensitive">False</property>78 <property name="sensitive">False</property>
83 <property name="can_focus">False</property>79 <property name="can_focus">False</property>
84 <property name="use_action_appearance">False</property>
85 <property name="use_underline">True</property>80 <property name="use_underline">True</property>
86 <property name="image">bm_img_done</property>81 <property name="image">bm_img_done</property>
87 <property name="use_stock">False</property>82 <property name="use_stock">False</property>
@@ -95,7 +90,6 @@
95 <property name="visible">True</property>90 <property name="visible">True</property>
96 <property name="sensitive">False</property>91 <property name="sensitive">False</property>
97 <property name="can_focus">False</property>92 <property name="can_focus">False</property>
98 <property name="use_action_appearance">False</property>
99 <property name="use_underline">True</property>93 <property name="use_underline">True</property>
100 <property name="image">bm_img_dismiss</property>94 <property name="image">bm_img_dismiss</property>
101 <property name="use_stock">False</property>95 <property name="use_stock">False</property>
@@ -109,7 +103,6 @@
109 <property name="visible">True</property>103 <property name="visible">True</property>
110 <property name="sensitive">False</property>104 <property name="sensitive">False</property>
111 <property name="can_focus">False</property>105 <property name="can_focus">False</property>
112 <property name="use_action_appearance">False</property>
113 <property name="use_underline">True</property>106 <property name="use_underline">True</property>
114 <property name="use_stock">True</property>107 <property name="use_stock">True</property>
115 <property name="accel_group">accelgroup1</property>108 <property name="accel_group">accelgroup1</property>
@@ -127,7 +120,6 @@
127 <property name="label">gtk-quit</property>120 <property name="label">gtk-quit</property>
128 <property name="visible">True</property>121 <property name="visible">True</property>
129 <property name="can_focus">False</property>122 <property name="can_focus">False</property>
130 <property name="use_action_appearance">False</property>
131 <property name="use_underline">True</property>123 <property name="use_underline">True</property>
132 <property name="use_stock">True</property>124 <property name="use_stock">True</property>
133 <property name="accel_group">accelgroup1</property>125 <property name="accel_group">accelgroup1</property>
@@ -142,7 +134,6 @@
142 <object class="GtkMenuItem" id="bm_edit">134 <object class="GtkMenuItem" id="bm_edit">
143 <property name="visible">True</property>135 <property name="visible">True</property>
144 <property name="can_focus">False</property>136 <property name="can_focus">False</property>
145 <property name="use_action_appearance">False</property>
146 <property name="label" translatable="yes">_Edit</property>137 <property name="label" translatable="yes">_Edit</property>
147 <property name="use_underline">True</property>138 <property name="use_underline">True</property>
148 <child type="submenu">139 <child type="submenu">
@@ -153,7 +144,6 @@
153 <object class="GtkImageMenuItem" id="edit_undo">144 <object class="GtkImageMenuItem" id="edit_undo">
154 <property name="label">gtk-undo</property>145 <property name="label">gtk-undo</property>
155 <property name="can_focus">False</property>146 <property name="can_focus">False</property>
156 <property name="use_action_appearance">False</property>
157 <property name="use_underline">True</property>147 <property name="use_underline">True</property>
158 <property name="use_stock">True</property>148 <property name="use_stock">True</property>
159 <property name="accel_group">accelgroup1</property>149 <property name="accel_group">accelgroup1</property>
@@ -163,7 +153,6 @@
163 <object class="GtkImageMenuItem" id="edit_redo">153 <object class="GtkImageMenuItem" id="edit_redo">
164 <property name="label">gtk-redo</property>154 <property name="label">gtk-redo</property>
165 <property name="can_focus">False</property>155 <property name="can_focus">False</property>
166 <property name="use_action_appearance">False</property>
167 <property name="use_underline">True</property>156 <property name="use_underline">True</property>
168 <property name="use_stock">True</property>157 <property name="use_stock">True</property>
169 <property name="accel_group">accelgroup1</property>158 <property name="accel_group">accelgroup1</property>
@@ -178,7 +167,6 @@
178 <object class="GtkMenuItem" id="plugins_mi">167 <object class="GtkMenuItem" id="plugins_mi">
179 <property name="visible">True</property>168 <property name="visible">True</property>
180 <property name="can_focus">False</property>169 <property name="can_focus">False</property>
181 <property name="use_action_appearance">False</property>
182 <property name="label">P_lugins</property>170 <property name="label">P_lugins</property>
183 <property name="use_underline">True</property>171 <property name="use_underline">True</property>
184 <signal name="activate" handler="on_edit_plugins_activate" swapped="no"/>172 <signal name="activate" handler="on_edit_plugins_activate" swapped="no"/>
@@ -188,7 +176,6 @@
188 <object class="GtkMenuItem" id="backends_mi">176 <object class="GtkMenuItem" id="backends_mi">
189 <property name="visible">True</property>177 <property name="visible">True</property>
190 <property name="can_focus">False</property>178 <property name="can_focus">False</property>
191 <property name="use_action_appearance">False</property>
192 <property name="label">_Synchronization Services</property>179 <property name="label">_Synchronization Services</property>
193 <property name="use_underline">True</property>180 <property name="use_underline">True</property>
194 <signal name="activate" handler="on_edit_backends_activate" swapped="no"/>181 <signal name="activate" handler="on_edit_backends_activate" swapped="no"/>
@@ -205,7 +192,6 @@
205 <property name="label">gtk-preferences</property>192 <property name="label">gtk-preferences</property>
206 <property name="visible">True</property>193 <property name="visible">True</property>
207 <property name="can_focus">False</property>194 <property name="can_focus">False</property>
208 <property name="use_action_appearance">False</property>
209 <property name="use_underline">True</property>195 <property name="use_underline">True</property>
210 <property name="use_stock">True</property>196 <property name="use_stock">True</property>
211 <property name="accel_group">accelgroup1</property>197 <property name="accel_group">accelgroup1</property>
@@ -220,7 +206,6 @@
220 <object class="GtkMenuItem" id="menu_view">206 <object class="GtkMenuItem" id="menu_view">
221 <property name="visible">True</property>207 <property name="visible">True</property>
222 <property name="can_focus">False</property>208 <property name="can_focus">False</property>
223 <property name="use_action_appearance">False</property>
224 <property name="label" translatable="yes">_View</property>209 <property name="label" translatable="yes">_View</property>
225 <property name="use_underline">True</property>210 <property name="use_underline">True</property>
226 <child type="submenu">211 <child type="submenu">
@@ -231,7 +216,6 @@
231 <object class="GtkCheckMenuItem" id="view_workview">216 <object class="GtkCheckMenuItem" id="view_workview">
232 <property name="visible">True</property>217 <property name="visible">True</property>
233 <property name="can_focus">False</property>218 <property name="can_focus">False</property>
234 <property name="use_action_appearance">False</property>
235 <property name="label" translatable="yes">_Work View</property>219 <property name="label" translatable="yes">_Work View</property>
236 <property name="use_underline">True</property>220 <property name="use_underline">True</property>
237 <signal name="toggled" handler="on_view_workview_toggled" swapped="no"/>221 <signal name="toggled" handler="on_view_workview_toggled" swapped="no"/>
@@ -247,7 +231,6 @@
247 <object class="GtkCheckMenuItem" id="view_sidebar">231 <object class="GtkCheckMenuItem" id="view_sidebar">
248 <property name="visible">True</property>232 <property name="visible">True</property>
249 <property name="can_focus">False</property>233 <property name="can_focus">False</property>
250 <property name="use_action_appearance">False</property>
251 <property name="label" translatable="yes">_Tags Sidebar</property>234 <property name="label" translatable="yes">_Tags Sidebar</property>
252 <property name="use_underline">True</property>235 <property name="use_underline">True</property>
253 <signal name="toggled" handler="on_view_sidebar_toggled" swapped="no"/>236 <signal name="toggled" handler="on_view_sidebar_toggled" swapped="no"/>
@@ -257,7 +240,6 @@
257 <object class="GtkCheckMenuItem" id="view_closed">240 <object class="GtkCheckMenuItem" id="view_closed">
258 <property name="visible">True</property>241 <property name="visible">True</property>
259 <property name="can_focus">False</property>242 <property name="can_focus">False</property>
260 <property name="use_action_appearance">False</property>
261 <property name="label" translatable="yes">_Closed Tasks Pane</property>243 <property name="label" translatable="yes">_Closed Tasks Pane</property>
262 <property name="use_underline">True</property>244 <property name="use_underline">True</property>
263 <signal name="toggled" handler="on_view_closed_toggled" swapped="no"/>245 <signal name="toggled" handler="on_view_closed_toggled" swapped="no"/>
@@ -267,7 +249,6 @@
267 <object class="GtkCheckMenuItem" id="view_toolbar">249 <object class="GtkCheckMenuItem" id="view_toolbar">
268 <property name="visible">True</property>250 <property name="visible">True</property>
269 <property name="can_focus">False</property>251 <property name="can_focus">False</property>
270 <property name="use_action_appearance">False</property>
271 <property name="label" translatable="yes">T_oolbar</property>252 <property name="label" translatable="yes">T_oolbar</property>
272 <property name="use_underline">True</property>253 <property name="use_underline">True</property>
273 <signal name="toggled" handler="on_view_toolbar_toggled" swapped="no"/>254 <signal name="toggled" handler="on_view_toolbar_toggled" swapped="no"/>
@@ -277,7 +258,6 @@
277 <object class="GtkCheckMenuItem" id="view_quickadd">258 <object class="GtkCheckMenuItem" id="view_quickadd">
278 <property name="visible">True</property>259 <property name="visible">True</property>
279 <property name="can_focus">False</property>260 <property name="can_focus">False</property>
280 <property name="use_action_appearance">False</property>
281 <property name="label" translatable="yes">_Quick Add Entry</property>261 <property name="label" translatable="yes">_Quick Add Entry</property>
282 <property name="use_underline">True</property>262 <property name="use_underline">True</property>
283 <signal name="toggled" handler="on_view_quickadd_toggled" swapped="no"/>263 <signal name="toggled" handler="on_view_quickadd_toggled" swapped="no"/>
@@ -290,7 +270,6 @@
290 <child>270 <child>
291 <object class="GtkMenuItem" id="plugin_mi">271 <object class="GtkMenuItem" id="plugin_mi">
292 <property name="can_focus">False</property>272 <property name="can_focus">False</property>
293 <property name="use_action_appearance">False</property>
294 <property name="label" translatable="yes">_Plugins</property>273 <property name="label" translatable="yes">_Plugins</property>
295 <property name="use_underline">True</property>274 <property name="use_underline">True</property>
296 <child type="submenu">275 <child type="submenu">
@@ -305,7 +284,6 @@
305 <object class="GtkMenuItem" id="help_mi">284 <object class="GtkMenuItem" id="help_mi">
306 <property name="visible">True</property>285 <property name="visible">True</property>
307 <property name="can_focus">False</property>286 <property name="can_focus">False</property>
308 <property name="use_action_appearance">False</property>
309 <property name="label" translatable="yes">_Help</property>287 <property name="label" translatable="yes">_Help</property>
310 <property name="use_underline">True</property>288 <property name="use_underline">True</property>
311 <child type="submenu">289 <child type="submenu">
@@ -318,7 +296,6 @@
318 <property name="visible">True</property>296 <property name="visible">True</property>
319 <property name="can_focus">False</property>297 <property name="can_focus">False</property>
320 <property name="tooltip_text" translatable="yes">Open GTG help</property>298 <property name="tooltip_text" translatable="yes">Open GTG help</property>
321 <property name="use_action_appearance">False</property>
322 <property name="image">image7</property>299 <property name="image">image7</property>
323 <property name="use_stock">False</property>300 <property name="use_stock">False</property>
324 <property name="accel_group">accelgroup1</property>301 <property name="accel_group">accelgroup1</property>
@@ -337,7 +314,6 @@
337 <property name="visible">True</property>314 <property name="visible">True</property>
338 <property name="can_focus">False</property>315 <property name="can_focus">False</property>
339 <property name="tooltip_text" translatable="yes">Help to translate GTG into your language</property>316 <property name="tooltip_text" translatable="yes">Help to translate GTG into your language</property>
340 <property name="use_action_appearance">False</property>
341 <property name="use_underline">True</property>317 <property name="use_underline">True</property>
342 <property name="use_stock">True</property>318 <property name="use_stock">True</property>
343 <property name="accel_group">accelgroup1</property>319 <property name="accel_group">accelgroup1</property>
@@ -350,7 +326,6 @@
350 <property name="visible">True</property>326 <property name="visible">True</property>
351 <property name="can_focus">False</property>327 <property name="can_focus">False</property>
352 <property name="tooltip_text" translatable="yes">Report a problem to GTG developers</property>328 <property name="tooltip_text" translatable="yes">Report a problem to GTG developers</property>
353 <property name="use_action_appearance">False</property>
354 <property name="use_underline">True</property>329 <property name="use_underline">True</property>
355 <property name="use_stock">True</property>330 <property name="use_stock">True</property>
356 <property name="accel_group">accelgroup1</property>331 <property name="accel_group">accelgroup1</property>
@@ -368,7 +343,6 @@
368 <property name="label">gtk-about</property>343 <property name="label">gtk-about</property>
369 <property name="visible">True</property>344 <property name="visible">True</property>
370 <property name="can_focus">False</property>345 <property name="can_focus">False</property>
371 <property name="use_action_appearance">False</property>
372 <property name="use_underline">True</property>346 <property name="use_underline">True</property>
373 <property name="use_stock">True</property>347 <property name="use_stock">True</property>
374 <property name="accel_group">accelgroup1</property>348 <property name="accel_group">accelgroup1</property>
@@ -387,9 +361,10 @@
387 </packing>361 </packing>
388 </child>362 </child>
389 <child>363 <child>
390 <object class="GtkVBox" id="vbox_toolbars">364 <object class="GtkBox" id="vbox_toolbars">
391 <property name="visible">True</property>365 <property name="visible">True</property>
392 <property name="can_focus">False</property>366 <property name="can_focus">False</property>
367 <property name="orientation">vertical</property>
393 <child>368 <child>
394 <object class="GtkToolbar" id="task_toolbar">369 <object class="GtkToolbar" id="task_toolbar">
395 <property name="visible">True</property>370 <property name="visible">True</property>
@@ -398,7 +373,6 @@
398 <object class="GtkToolButton" id="new_task_b">373 <object class="GtkToolButton" id="new_task_b">
399 <property name="visible">True</property>374 <property name="visible">True</property>
400 <property name="can_focus">False</property>375 <property name="can_focus">False</property>
401 <property name="use_action_appearance">False</property>
402 <property name="is_important">True</property>376 <property name="is_important">True</property>
403 <property name="label" translatable="yes">New Task</property>377 <property name="label" translatable="yes">New Task</property>
404 <property name="icon_name">gtg-task-new</property>378 <property name="icon_name">gtg-task-new</property>
@@ -412,7 +386,6 @@
412 <child>386 <child>
413 <object class="GtkToolButton" id="new_subtask_b">387 <object class="GtkToolButton" id="new_subtask_b">
414 <property name="can_focus">False</property>388 <property name="can_focus">False</property>
415 <property name="use_action_appearance">False</property>
416 <property name="label" translatable="yes">New Subtask</property>389 <property name="label" translatable="yes">New Subtask</property>
417 <property name="icon_name">gtg-task-new</property>390 <property name="icon_name">gtg-task-new</property>
418 <signal name="clicked" handler="on_add_subtask" swapped="no"/>391 <signal name="clicked" handler="on_add_subtask" swapped="no"/>
@@ -426,7 +399,6 @@
426 <object class="GtkToolButton" id="edit_b">399 <object class="GtkToolButton" id="edit_b">
427 <property name="visible">True</property>400 <property name="visible">True</property>
428 <property name="can_focus">False</property>401 <property name="can_focus">False</property>
429 <property name="use_action_appearance">False</property>
430 <property name="visible_horizontal">False</property>402 <property name="visible_horizontal">False</property>
431 <property name="visible_vertical">False</property>403 <property name="visible_vertical">False</property>
432 <property name="label" translatable="yes">Edit</property>404 <property name="label" translatable="yes">Edit</property>
@@ -450,7 +422,6 @@
450 <child>422 <child>
451 <object class="GtkToolButton" id="Undo">423 <object class="GtkToolButton" id="Undo">
452 <property name="can_focus">False</property>424 <property name="can_focus">False</property>
453 <property name="use_action_appearance">False</property>
454 <property name="label" translatable="yes">Undo</property>425 <property name="label" translatable="yes">Undo</property>
455 <property name="stock_id">gtk-undo</property>426 <property name="stock_id">gtk-undo</property>
456 </object>427 </object>
@@ -462,7 +433,6 @@
462 <child>433 <child>
463 <object class="GtkToolButton" id="Redo">434 <object class="GtkToolButton" id="Redo">
464 <property name="can_focus">False</property>435 <property name="can_focus">False</property>
465 <property name="use_action_appearance">False</property>
466 <property name="label" translatable="yes">Redo</property>436 <property name="label" translatable="yes">Redo</property>
467 <property name="stock_id">gtk-redo</property>437 <property name="stock_id">gtk-redo</property>
468 </object>438 </object>
@@ -486,7 +456,6 @@
486 <property name="visible">True</property>456 <property name="visible">True</property>
487 <property name="sensitive">False</property>457 <property name="sensitive">False</property>
488 <property name="can_focus">False</property>458 <property name="can_focus">False</property>
489 <property name="use_action_appearance">False</property>
490 <property name="is_important">True</property>459 <property name="is_important">True</property>
491 <property name="label" translatable="yes">Mark as Done</property>460 <property name="label" translatable="yes">Mark as Done</property>
492 <property name="icon_name">gtg-task-done</property>461 <property name="icon_name">gtg-task-done</property>
@@ -502,7 +471,6 @@
502 <property name="visible">True</property>471 <property name="visible">True</property>
503 <property name="sensitive">False</property>472 <property name="sensitive">False</property>
504 <property name="can_focus">False</property>473 <property name="can_focus">False</property>
505 <property name="use_action_appearance">False</property>
506 <property name="label" translatable="yes">Dismiss</property>474 <property name="label" translatable="yes">Dismiss</property>
507 <property name="icon_name">gtg-task-dismiss</property>475 <property name="icon_name">gtg-task-dismiss</property>
508 <signal name="clicked" handler="on_dismiss_task" swapped="no"/>476 <signal name="clicked" handler="on_dismiss_task" swapped="no"/>
@@ -516,7 +484,6 @@
516 <object class="GtkToolButton" id="delete_b">484 <object class="GtkToolButton" id="delete_b">
517 <property name="sensitive">False</property>485 <property name="sensitive">False</property>
518 <property name="can_focus">False</property>486 <property name="can_focus">False</property>
519 <property name="use_action_appearance">False</property>
520 <property name="label" translatable="yes">Delete</property>487 <property name="label" translatable="yes">Delete</property>
521 <property name="icon_name">edit-delete</property>488 <property name="icon_name">edit-delete</property>
522 <signal name="clicked" handler="on_delete_task" swapped="no"/>489 <signal name="clicked" handler="on_delete_task" swapped="no"/>
@@ -540,7 +507,6 @@
540 <object class="GtkToggleToolButton" id="workview_toggle">507 <object class="GtkToggleToolButton" id="workview_toggle">
541 <property name="visible">True</property>508 <property name="visible">True</property>
542 <property name="can_focus">False</property>509 <property name="can_focus">False</property>
543 <property name="use_action_appearance">False</property>
544 <property name="is_important">True</property>510 <property name="is_important">True</property>
545 <property name="label" translatable="yes">Work View</property>511 <property name="label" translatable="yes">Work View</property>
546 <property name="stock_id">gtk-index</property>512 <property name="stock_id">gtk-index</property>
@@ -566,15 +532,16 @@
566 </packing>532 </packing>
567 </child>533 </child>
568 <child>534 <child>
569 <object class="GtkHPaned" id="hpaned1">535 <object class="GtkPaned" id="hpaned1">
570 <property name="visible">True</property>536 <property name="visible">True</property>
571 <property name="can_focus">True</property>537 <property name="can_focus">True</property>
572 <child>538 <child>
573 <object class="GtkVBox" id="sidebar_vbox">539 <object class="GtkBox" id="sidebar_vbox">
574 <property name="width_request">75</property>540 <property name="width_request">75</property>
575 <property name="can_focus">False</property>541 <property name="can_focus">False</property>
542 <property name="orientation">vertical</property>
576 <child>543 <child>
577 <object class="GtkHBox" id="hbox4">544 <object class="GtkBox" id="box4">
578 <property name="visible">True</property>545 <property name="visible">True</property>
579 <property name="can_focus">False</property>546 <property name="can_focus">False</property>
580 <child>547 <child>
@@ -608,7 +575,6 @@
608 <property name="visible">True</property>575 <property name="visible">True</property>
609 <property name="can_focus">True</property>576 <property name="can_focus">True</property>
610 <property name="receives_default">True</property>577 <property name="receives_default">True</property>
611 <property name="use_action_appearance">False</property>
612 <property name="relief">none</property>578 <property name="relief">none</property>
613 <signal name="clicked" handler="on_view_sidebar_toggled" swapped="no"/>579 <signal name="clicked" handler="on_view_sidebar_toggled" swapped="no"/>
614 <child>580 <child>
@@ -643,8 +609,6 @@
643 <object class="GtkScrolledWindow" id="sidebar-scroll">609 <object class="GtkScrolledWindow" id="sidebar-scroll">
644 <property name="visible">True</property>610 <property name="visible">True</property>
645 <property name="can_focus">True</property>611 <property name="can_focus">True</property>
646 <property name="hscrollbar_policy">automatic</property>
647 <property name="vscrollbar_policy">automatic</property>
648 <property name="shadow_type">in</property>612 <property name="shadow_type">in</property>
649 <child>613 <child>
650 <placeholder/>614 <placeholder/>
@@ -675,11 +639,12 @@
675 </packing>639 </packing>
676 </child>640 </child>
677 <child>641 <child>
678 <object class="GtkVBox" id="main_vbox">642 <object class="GtkBox" id="main_vbox">
679 <property name="visible">True</property>643 <property name="visible">True</property>
680 <property name="can_focus">False</property>644 <property name="can_focus">False</property>
645 <property name="orientation">vertical</property>
681 <child>646 <child>
682 <object class="GtkHBox" id="quickadd_pane">647 <object class="GtkBox" id="quickadd_pane">
683 <property name="visible">True</property>648 <property name="visible">True</property>
684 <property name="can_focus">False</property>649 <property name="can_focus">False</property>
685 <child>650 <child>
@@ -692,9 +657,6 @@
692 <property name="invisible_char">●</property>657 <property name="invisible_char">●</property>
693 <property name="secondary_icon_stock">gtk-clear</property>658 <property name="secondary_icon_stock">gtk-clear</property>
694 <property name="primary_icon_activatable">False</property>659 <property name="primary_icon_activatable">False</property>
695 <property name="secondary_icon_activatable">True</property>
696 <property name="primary_icon_sensitive">True</property>
697 <property name="secondary_icon_sensitive">True</property>
698 <signal name="changed" handler="on_quickadd_field_changed" swapped="no"/>660 <signal name="changed" handler="on_quickadd_field_changed" swapped="no"/>
699 <signal name="activate" handler="on_quickadd_field_activate" swapped="no"/>661 <signal name="activate" handler="on_quickadd_field_activate" swapped="no"/>
700 <signal name="icon-press" handler="on_quickadd_field_icon_press" swapped="no"/>662 <signal name="icon-press" handler="on_quickadd_field_icon_press" swapped="no"/>
@@ -714,9 +676,10 @@
714 </packing>676 </packing>
715 </child>677 </child>
716 <child>678 <child>
717 <object class="GtkVPaned" id="vpaned1">679 <object class="GtkPaned" id="vpaned1">
718 <property name="visible">True</property>680 <property name="visible">True</property>
719 <property name="can_focus">True</property>681 <property name="can_focus">True</property>
682 <property name="orientation">vertical</property>
720 <child>683 <child>
721 <object class="GtkNotebook" id="main_notebook">684 <object class="GtkNotebook" id="main_notebook">
722 <property name="visible">True</property>685 <property name="visible">True</property>
@@ -728,7 +691,6 @@
728 <property name="visible">True</property>691 <property name="visible">True</property>
729 <property name="can_focus">True</property>692 <property name="can_focus">True</property>
730 <property name="hscrollbar_policy">never</property>693 <property name="hscrollbar_policy">never</property>
731 <property name="vscrollbar_policy">automatic</property>
732 <child>694 <child>
733 <placeholder/>695 <placeholder/>
734 </child>696 </child>
@@ -794,9 +756,10 @@
794 <property name="resizable">False</property>756 <property name="resizable">False</property>
795 <property name="window_position">center-on-parent</property>757 <property name="window_position">center-on-parent</property>
796 <property name="type_hint">dialog</property>758 <property name="type_hint">dialog</property>
797 <property name="program_name" translatable="yes">Getting Things GNOME!</property>759 <property name="program_name">Getting Things GNOME!</property>
798 <property name="copyright" translatable="yes">Copyright © 2008-2013 Lionel Dricot, Bertrand Rousseau</property>760 <property name="copyright" translatable="yes">Copyright © 2008-2013 Lionel Dricot, Bertrand Rousseau</property>
799 <property name="comments" translatable="yes">GTG is a personal tasks and TODO-list items organizer for the GNOME desktop environment.</property>761 <property name="comments" translatable="yes">GTG is a personal tasks and TODO-list items
762organizer for the GNOME desktop environment.</property>
800 <property name="website_label" translatable="yes">GTG website</property>763 <property name="website_label" translatable="yes">GTG website</property>
801 <property name="license" translatable="yes">Getting Things GNOME! is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.764 <property name="license" translatable="yes">Getting Things GNOME! is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
802765
@@ -810,12 +773,13 @@
810 <signal name="delete-event" handler="on_about_delete" swapped="no"/>773 <signal name="delete-event" handler="on_about_delete" swapped="no"/>
811 <signal name="response" handler="on_about_close" swapped="no"/>774 <signal name="response" handler="on_about_close" swapped="no"/>
812 <child internal-child="vbox">775 <child internal-child="vbox">
813 <object class="GtkVBox" id="about_dialog_vbox">776 <object class="GtkBox" id="about_dialog_vbox">
814 <property name="visible">True</property>777 <property name="visible">True</property>
815 <property name="can_focus">False</property>778 <property name="can_focus">False</property>
779 <property name="orientation">vertical</property>
816 <property name="spacing">2</property>780 <property name="spacing">2</property>
817 <child internal-child="action_area">781 <child internal-child="action_area">
818 <object class="GtkHButtonBox" id="dialog-action_area2">782 <object class="GtkButtonBox" id="dialog-action_area2">
819 <property name="visible">True</property>783 <property name="visible">True</property>
820 <property name="can_focus">False</property>784 <property name="can_focus">False</property>
821 <property name="layout_style">end</property>785 <property name="layout_style">end</property>
@@ -863,7 +827,6 @@
863 <property name="label">gtk-edit</property>827 <property name="label">gtk-edit</property>
864 <property name="visible">True</property>828 <property name="visible">True</property>
865 <property name="can_focus">False</property>829 <property name="can_focus">False</property>
866 <property name="use_action_appearance">False</property>
867 <property name="use_underline">True</property>830 <property name="use_underline">True</property>
868 <property name="use_stock">True</property>831 <property name="use_stock">True</property>
869 <property name="accel_group">accelgroup1</property>832 <property name="accel_group">accelgroup1</property>
@@ -881,7 +844,6 @@
881 <property name="label" translatable="yes">Mark as Not Done</property>844 <property name="label" translatable="yes">Mark as Not Done</property>
882 <property name="visible">True</property>845 <property name="visible">True</property>
883 <property name="can_focus">False</property>846 <property name="can_focus">False</property>
884 <property name="use_action_appearance">False</property>
885 <property name="use_underline">True</property>847 <property name="use_underline">True</property>
886 <property name="image">ctcm_img_mark_not_done</property>848 <property name="image">ctcm_img_mark_not_done</property>
887 <property name="use_stock">False</property>849 <property name="use_stock">False</property>
@@ -894,7 +856,6 @@
894 <property name="label" translatable="yes">Und_ismiss</property>856 <property name="label" translatable="yes">Und_ismiss</property>
895 <property name="visible">True</property>857 <property name="visible">True</property>
896 <property name="can_focus">False</property>858 <property name="can_focus">False</property>
897 <property name="use_action_appearance">False</property>
898 <property name="use_underline">True</property>859 <property name="use_underline">True</property>
899 <property name="image">tcm_img_undismiss</property>860 <property name="image">tcm_img_undismiss</property>
900 <property name="use_stock">False</property>861 <property name="use_stock">False</property>
@@ -907,7 +868,6 @@
907 <property name="label">gtk-delete</property>868 <property name="label">gtk-delete</property>
908 <property name="visible">True</property>869 <property name="visible">True</property>
909 <property name="can_focus">False</property>870 <property name="can_focus">False</property>
910 <property name="use_action_appearance">False</property>
911 <property name="use_underline">True</property>871 <property name="use_underline">True</property>
912 <property name="use_stock">True</property>872 <property name="use_stock">True</property>
913 <property name="accel_group">accelgroup1</property>873 <property name="accel_group">accelgroup1</property>
@@ -972,7 +932,6 @@
972 <property name="label" translatable="yes">Add a subtask</property>932 <property name="label" translatable="yes">Add a subtask</property>
973 <property name="visible">True</property>933 <property name="visible">True</property>
974 <property name="can_focus">False</property>934 <property name="can_focus">False</property>
975 <property name="use_action_appearance">False</property>
976 <property name="use_underline">True</property>935 <property name="use_underline">True</property>
977 <property name="image">tcm_img_add_subtask</property>936 <property name="image">tcm_img_add_subtask</property>
978 <property name="use_stock">False</property>937 <property name="use_stock">False</property>
@@ -985,7 +944,6 @@
985 <property name="label">gtk-edit</property>944 <property name="label">gtk-edit</property>
986 <property name="visible">True</property>945 <property name="visible">True</property>
987 <property name="can_focus">False</property>946 <property name="can_focus">False</property>
988 <property name="use_action_appearance">False</property>
989 <property name="use_underline">True</property>947 <property name="use_underline">True</property>
990 <property name="use_stock">True</property>948 <property name="use_stock">True</property>
991 <property name="accel_group">accelgroup1</property>949 <property name="accel_group">accelgroup1</property>
@@ -1003,7 +961,6 @@
1003 <property name="label" translatable="yes">Mark as _Done</property>961 <property name="label" translatable="yes">Mark as _Done</property>
1004 <property name="visible">True</property>962 <property name="visible">True</property>
1005 <property name="can_focus">False</property>963 <property name="can_focus">False</property>
1006 <property name="use_action_appearance">False</property>
1007 <property name="use_underline">True</property>964 <property name="use_underline">True</property>
1008 <property name="image">tcm_img_mark_done</property>965 <property name="image">tcm_img_mark_done</property>
1009 <property name="use_stock">False</property>966 <property name="use_stock">False</property>
@@ -1016,7 +973,6 @@
1016 <property name="label" translatable="yes">D_ismiss</property>973 <property name="label" translatable="yes">D_ismiss</property>
1017 <property name="visible">True</property>974 <property name="visible">True</property>
1018 <property name="can_focus">False</property>975 <property name="can_focus">False</property>
1019 <property name="use_action_appearance">False</property>
1020 <property name="use_underline">True</property>976 <property name="use_underline">True</property>
1021 <property name="image">tcm_img_dismiss</property>977 <property name="image">tcm_img_dismiss</property>
1022 <property name="use_stock">False</property>978 <property name="use_stock">False</property>
@@ -1029,7 +985,6 @@
1029 <property name="label">gtk-delete</property>985 <property name="label">gtk-delete</property>
1030 <property name="visible">True</property>986 <property name="visible">True</property>
1031 <property name="can_focus">False</property>987 <property name="can_focus">False</property>
1032 <property name="use_action_appearance">False</property>
1033 <property name="use_underline">True</property>988 <property name="use_underline">True</property>
1034 <property name="use_stock">True</property>989 <property name="use_stock">True</property>
1035 <property name="accel_group">accelgroup1</property>990 <property name="accel_group">accelgroup1</property>
@@ -1047,7 +1002,6 @@
1047 <property name="label" translatable="yes">_Set Start Date</property>1002 <property name="label" translatable="yes">_Set Start Date</property>
1048 <property name="visible">True</property>1003 <property name="visible">True</property>
1049 <property name="can_focus">False</property>1004 <property name="can_focus">False</property>
1050 <property name="use_action_appearance">False</property>
1051 <property name="use_underline">True</property>1005 <property name="use_underline">True</property>
1052 <property name="use_stock">False</property>1006 <property name="use_stock">False</property>
1053 <child type="submenu">1007 <child type="submenu">
@@ -1059,7 +1013,6 @@
1059 <property name="label" translatable="yes">T_oday</property>1013 <property name="label" translatable="yes">T_oday</property>
1060 <property name="visible">True</property>1014 <property name="visible">True</property>
1061 <property name="can_focus">False</property>1015 <property name="can_focus">False</property>
1062 <property name="use_action_appearance">False</property>
1063 <property name="use_underline">True</property>1016 <property name="use_underline">True</property>
1064 <property name="use_stock">False</property>1017 <property name="use_stock">False</property>
1065 <signal name="activate" handler="on_mark_as_started" swapped="no"/>1018 <signal name="activate" handler="on_mark_as_started" swapped="no"/>
@@ -1070,7 +1023,6 @@
1070 <property name="label" translatable="yes">_Tomorrow</property>1023 <property name="label" translatable="yes">_Tomorrow</property>
1071 <property name="visible">True</property>1024 <property name="visible">True</property>
1072 <property name="can_focus">False</property>1025 <property name="can_focus">False</property>
1073 <property name="use_action_appearance">False</property>
1074 <property name="use_underline">True</property>1026 <property name="use_underline">True</property>
1075 <property name="use_stock">False</property>1027 <property name="use_stock">False</property>
1076 <signal name="activate" handler="on_start_for_tomorrow" swapped="no"/>1028 <signal name="activate" handler="on_start_for_tomorrow" swapped="no"/>
@@ -1081,7 +1033,6 @@
1081 <property name="label" translatable="yes">Next _Week</property>1033 <property name="label" translatable="yes">Next _Week</property>
1082 <property name="visible">True</property>1034 <property name="visible">True</property>
1083 <property name="can_focus">False</property>1035 <property name="can_focus">False</property>
1084 <property name="use_action_appearance">False</property>
1085 <property name="use_underline">True</property>1036 <property name="use_underline">True</property>
1086 <property name="use_stock">False</property>1037 <property name="use_stock">False</property>
1087 <signal name="activate" handler="on_start_for_next_week" swapped="no"/>1038 <signal name="activate" handler="on_start_for_next_week" swapped="no"/>
@@ -1092,7 +1043,6 @@
1092 <property name="label" translatable="yes">Next _Month</property>1043 <property name="label" translatable="yes">Next _Month</property>
1093 <property name="visible">True</property>1044 <property name="visible">True</property>
1094 <property name="can_focus">False</property>1045 <property name="can_focus">False</property>
1095 <property name="use_action_appearance">False</property>
1096 <property name="use_underline">True</property>1046 <property name="use_underline">True</property>
1097 <property name="use_stock">False</property>1047 <property name="use_stock">False</property>
1098 <signal name="activate" handler="on_start_for_next_month" swapped="no"/>1048 <signal name="activate" handler="on_start_for_next_month" swapped="no"/>
@@ -1103,7 +1053,6 @@
1103 <property name="label" translatable="yes">Next _Year</property>1053 <property name="label" translatable="yes">Next _Year</property>
1104 <property name="visible">True</property>1054 <property name="visible">True</property>
1105 <property name="can_focus">False</property>1055 <property name="can_focus">False</property>
1106 <property name="use_action_appearance">False</property>
1107 <property name="use_underline">True</property>1056 <property name="use_underline">True</property>
1108 <property name="use_stock">False</property>1057 <property name="use_stock">False</property>
1109 <signal name="activate" handler="on_start_for_next_year" swapped="no"/>1058 <signal name="activate" handler="on_start_for_next_year" swapped="no"/>
@@ -1120,7 +1069,6 @@
1120 <property name="label" translatable="yes">_Clear Start Date</property>1069 <property name="label" translatable="yes">_Clear Start Date</property>
1121 <property name="visible">True</property>1070 <property name="visible">True</property>
1122 <property name="can_focus">False</property>1071 <property name="can_focus">False</property>
1123 <property name="use_action_appearance">False</property>
1124 <property name="use_underline">True</property>1072 <property name="use_underline">True</property>
1125 <property name="use_stock">False</property>1073 <property name="use_stock">False</property>
1126 <signal name="activate" handler="on_start_clear" swapped="no"/>1074 <signal name="activate" handler="on_start_clear" swapped="no"/>
@@ -1135,7 +1083,6 @@
1135 <property name="label" translatable="yes">Set Due Date</property>1083 <property name="label" translatable="yes">Set Due Date</property>
1136 <property name="visible">True</property>1084 <property name="visible">True</property>
1137 <property name="can_focus">False</property>1085 <property name="can_focus">False</property>
1138 <property name="use_action_appearance">False</property>
1139 <property name="use_underline">True</property>1086 <property name="use_underline">True</property>
1140 <property name="use_stock">False</property>1087 <property name="use_stock">False</property>
1141 <child type="submenu">1088 <child type="submenu">
@@ -1147,7 +1094,6 @@
1147 <property name="label" translatable="yes">T_oday</property>1094 <property name="label" translatable="yes">T_oday</property>
1148 <property name="visible">True</property>1095 <property name="visible">True</property>
1149 <property name="can_focus">False</property>1096 <property name="can_focus">False</property>
1150 <property name="use_action_appearance">False</property>
1151 <property name="use_underline">True</property>1097 <property name="use_underline">True</property>
1152 <property name="use_stock">False</property>1098 <property name="use_stock">False</property>
1153 <signal name="activate" handler="on_set_due_today" swapped="no"/>1099 <signal name="activate" handler="on_set_due_today" swapped="no"/>
@@ -1158,7 +1104,6 @@
1158 <property name="label" translatable="yes">_Tomorrow</property>1104 <property name="label" translatable="yes">_Tomorrow</property>
1159 <property name="visible">True</property>1105 <property name="visible">True</property>
1160 <property name="can_focus">False</property>1106 <property name="can_focus">False</property>
1161 <property name="use_action_appearance">False</property>
1162 <property name="use_underline">True</property>1107 <property name="use_underline">True</property>
1163 <property name="use_stock">False</property>1108 <property name="use_stock">False</property>
1164 <signal name="activate" handler="on_set_due_tomorrow" swapped="no"/>1109 <signal name="activate" handler="on_set_due_tomorrow" swapped="no"/>
@@ -1169,7 +1114,6 @@
1169 <property name="label" translatable="yes">Next _Week</property>1114 <property name="label" translatable="yes">Next _Week</property>
1170 <property name="visible">True</property>1115 <property name="visible">True</property>
1171 <property name="can_focus">False</property>1116 <property name="can_focus">False</property>
1172 <property name="use_action_appearance">False</property>
1173 <property name="use_underline">True</property>1117 <property name="use_underline">True</property>
1174 <property name="use_stock">False</property>1118 <property name="use_stock">False</property>
1175 <signal name="activate" handler="on_set_due_next_week" swapped="no"/>1119 <signal name="activate" handler="on_set_due_next_week" swapped="no"/>
@@ -1180,7 +1124,6 @@
1180 <property name="label" translatable="yes">Next _Month</property>1124 <property name="label" translatable="yes">Next _Month</property>
1181 <property name="visible">True</property>1125 <property name="visible">True</property>
1182 <property name="can_focus">False</property>1126 <property name="can_focus">False</property>
1183 <property name="use_action_appearance">False</property>
1184 <property name="use_underline">True</property>1127 <property name="use_underline">True</property>
1185 <property name="use_stock">False</property>1128 <property name="use_stock">False</property>
1186 <signal name="activate" handler="on_set_due_next_month" swapped="no"/>1129 <signal name="activate" handler="on_set_due_next_month" swapped="no"/>
@@ -1191,7 +1134,6 @@
1191 <property name="label" translatable="yes">Next _Year</property>1134 <property name="label" translatable="yes">Next _Year</property>
1192 <property name="visible">True</property>1135 <property name="visible">True</property>
1193 <property name="can_focus">False</property>1136 <property name="can_focus">False</property>
1194 <property name="use_action_appearance">False</property>
1195 <property name="use_underline">True</property>1137 <property name="use_underline">True</property>
1196 <property name="use_stock">False</property>1138 <property name="use_stock">False</property>
1197 <signal name="activate" handler="on_set_due_next_year" swapped="no"/>1139 <signal name="activate" handler="on_set_due_next_year" swapped="no"/>
@@ -1208,7 +1150,6 @@
1208 <property name="label" translatable="yes">_Now</property>1150 <property name="label" translatable="yes">_Now</property>
1209 <property name="visible">True</property>1151 <property name="visible">True</property>
1210 <property name="can_focus">False</property>1152 <property name="can_focus">False</property>
1211 <property name="use_action_appearance">False</property>
1212 <property name="use_underline">True</property>1153 <property name="use_underline">True</property>
1213 <property name="use_stock">False</property>1154 <property name="use_stock">False</property>
1214 <signal name="activate" handler="on_set_due_now" swapped="no"/>1155 <signal name="activate" handler="on_set_due_now" swapped="no"/>
@@ -1219,7 +1160,6 @@
1219 <property name="label" translatable="yes">_Soon</property>1160 <property name="label" translatable="yes">_Soon</property>
1220 <property name="visible">True</property>1161 <property name="visible">True</property>
1221 <property name="can_focus">False</property>1162 <property name="can_focus">False</property>
1222 <property name="use_action_appearance">False</property>
1223 <property name="use_underline">True</property>1163 <property name="use_underline">True</property>
1224 <property name="use_stock">False</property>1164 <property name="use_stock">False</property>
1225 <signal name="activate" handler="on_set_due_soon" swapped="no"/>1165 <signal name="activate" handler="on_set_due_soon" swapped="no"/>
@@ -1230,7 +1170,6 @@
1230 <property name="label" translatable="yes">_Someday</property>1170 <property name="label" translatable="yes">_Someday</property>
1231 <property name="visible">True</property>1171 <property name="visible">True</property>
1232 <property name="can_focus">False</property>1172 <property name="can_focus">False</property>
1233 <property name="use_action_appearance">False</property>
1234 <property name="use_underline">True</property>1173 <property name="use_underline">True</property>
1235 <property name="use_stock">False</property>1174 <property name="use_stock">False</property>
1236 <signal name="activate" handler="on_set_due_someday" swapped="no"/>1175 <signal name="activate" handler="on_set_due_someday" swapped="no"/>
@@ -1247,7 +1186,6 @@
1247 <property name="label" translatable="yes">_Clear Due Date</property>1186 <property name="label" translatable="yes">_Clear Due Date</property>
1248 <property name="visible">True</property>1187 <property name="visible">True</property>
1249 <property name="can_focus">False</property>1188 <property name="can_focus">False</property>
1250 <property name="use_action_appearance">False</property>
1251 <property name="use_underline">True</property>1189 <property name="use_underline">True</property>
1252 <property name="use_stock">False</property>1190 <property name="use_stock">False</property>
1253 <signal name="activate" handler="on_set_due_clear" swapped="no"/>1191 <signal name="activate" handler="on_set_due_clear" swapped="no"/>
@@ -1268,7 +1206,6 @@
1268 <property name="label" translatable="yes">Modify Tags...</property>1206 <property name="label" translatable="yes">Modify Tags...</property>
1269 <property name="visible">True</property>1207 <property name="visible">True</property>
1270 <property name="can_focus">False</property>1208 <property name="can_focus">False</property>
1271 <property name="use_action_appearance">False</property>
1272 <property name="image">image3</property>1209 <property name="image">image3</property>
1273 <property name="use_stock">False</property>1210 <property name="use_stock">False</property>
1274 <signal name="activate" handler="on_modify_tags" swapped="no"/>1211 <signal name="activate" handler="on_modify_tags" swapped="no"/>
12751212
=== modified file 'GTG/gtk/browser/treeview_factory.py'
--- GTG/gtk/browser/treeview_factory.py 2013-11-23 14:40:23 +0000
+++ GTG/gtk/browser/treeview_factory.py 2014-01-12 07:15:48 +0000
@@ -17,9 +17,7 @@
17# this program. If not, see <http://www.gnu.org/licenses/>.17# this program. If not, see <http://www.gnu.org/licenses/>.
18# -----------------------------------------------------------------------------18# -----------------------------------------------------------------------------
1919
20import gtk20from gi.repository import GObject, Gtk, Pango
21import gobject
22import pango
23import xml.sax.saxutils as saxutils21import xml.sax.saxutils as saxutils
24import locale22import locale
2523
@@ -150,7 +148,9 @@
150 return sort148 return sort
151149
152 def title_sorting(self, task1, task2, order):150 def title_sorting(self, task1, task2, order):
153 return cmp(task1.get_title(), task2.get_title())151 t1 = task1.get_title()
152 t2 = task2.get_title()
153 return (t1 > t2) - (t1 < t2)
154154
155 def __date_comp(self, task1, task2, para, order):155 def __date_comp(self, task1, task2, para, order):
156 '''This is a quite complex method to sort tasks by date,156 '''This is a quite complex method to sort tasks by date,
@@ -174,15 +174,15 @@
174 else:174 else:
175 raise ValueError(175 raise ValueError(
176 'invalid date comparison parameter: %s') % para176 'invalid date comparison parameter: %s') % para
177 sort = cmp(t2, t1)177 sort = (t2 > t1) - (t2 < t1)
178 else:178 else:
179 sort = 0179 sort = 0
180180
181 # local function181 # local function
182 def reverse_if_descending(s):182 def reverse_if_descending(s):
183 """Make a cmp() result relative to the top instead of following183 """Make a cmpare result relative to the top instead of following
184 user-specified sort direction"""184 user-specified sort direction"""
185 if order == gtk.SORT_ASCENDING:185 if order == Gtk.SortType.ASCENDING:
186 return s186 return s
187 else:187 else:
188 return -1 * s188 return -1 * s
@@ -193,14 +193,16 @@
193 t1_tags.sort()193 t1_tags.sort()
194 t2_tags = task2.get_tags_name()194 t2_tags = task2.get_tags_name()
195 t2_tags.sort()195 t2_tags.sort()
196 sort = reverse_if_descending(cmp(t1_tags, t2_tags))196 cmp_tags = (t1_tags > t2_tags) - (t1_tags < t2_tags)
197 sort = reverse_if_descending(cmp_tags)
197198
198 if sort == 0: # Break ties by sorting by title199 if sort == 0: # Break ties by sorting by title
199 t1_title = task1.get_title()200 t1_title = task1.get_title()
200 t2_title = task2.get_title()201 t2_title = task2.get_title()
201 t1_title = locale.strxfrm(t1_title)202 t1_title = locale.strxfrm(t1_title)
202 t2_title = locale.strxfrm(t2_title)203 t2_title = locale.strxfrm(t2_title)
203 sort = reverse_if_descending(cmp(t1_title, t2_title))204 cmp_title = (t1_title > t2_title) - (t1_title < t2_title)
205 sort = reverse_if_descending(cmp_title)
204206
205 return sort207 return sort
206208
@@ -234,7 +236,7 @@
234 t1_name = locale.strxfrm(t1.get_name())236 t1_name = locale.strxfrm(t1.get_name())
235 t2_name = locale.strxfrm(t2.get_name())237 t2_name = locale.strxfrm(t2.get_name())
236 if not t1_sp and not t2_sp:238 if not t1_sp and not t2_sp:
237 return cmp(t1_name, t2_name)239 return (t1_name > t2_name) - (t1_name < t2_name)
238 elif not t1_sp and t2_sp:240 elif not t1_sp and t2_sp:
239 return 1241 return 1
240 elif t1_sp and not t2_sp:242 elif t1_sp and not t2_sp:
@@ -242,7 +244,7 @@
242 else:244 else:
243 t1_order = t1.get_attribute("order")245 t1_order = t1.get_attribute("order")
244 t2_order = t2.get_attribute("order")246 t2_order = t2.get_attribute("order")
245 return cmp(t1_order, t2_order)247 return (t1_order > t2_order) - (t1_order < t2_order)
246248
247 def ontag_task_dnd(self, source, target):249 def ontag_task_dnd(self, source, target):
248 task = self.req.get_task(source)250 task = self.req.get_task(source)
@@ -262,7 +264,7 @@
262 # Tag id264 # Tag id
263 col_name = 'tag_id'265 col_name = 'tag_id'
264 col = {}266 col = {}
265 col['renderer'] = ['markup', gtk.CellRendererText()]267 col['renderer'] = ['markup', Gtk.CellRendererText()]
266 col['value'] = [str, lambda node: node.get_id()]268 col['value'] = [str, lambda node: node.get_id()]
267 col['visible'] = False269 col['visible'] = False
268 col['order'] = 0270 col['order'] = 0
@@ -276,7 +278,7 @@
276 render_tags.set_property('ypad', 3)278 render_tags.set_property('ypad', 3)
277 col['title'] = _("Tags")279 col['title'] = _("Tags")
278 col['renderer'] = ['tag', render_tags]280 col['renderer'] = ['tag', render_tags]
279 col['value'] = [gobject.TYPE_PYOBJECT, lambda node: node]281 col['value'] = [GObject.TYPE_PYOBJECT, lambda node: node]
280 col['expandable'] = False282 col['expandable'] = False
281 col['resizable'] = False283 col['resizable'] = False
282 col['order'] = 1284 col['order'] = 1
@@ -285,7 +287,7 @@
285 # Tag names287 # Tag names
286 col_name = 'tagname'288 col_name = 'tagname'
287 col = {}289 col = {}
288 render_text = gtk.CellRendererText()290 render_text = Gtk.CellRendererText()
289 render_text.set_property('ypad', 3)291 render_text.set_property('ypad', 3)
290 col['renderer'] = ['markup', render_text]292 col['renderer'] = ['markup', render_text]
291 col['value'] = [str, self.tag_name]293 col['value'] = [str, self.tag_name]
@@ -297,7 +299,7 @@
297 # Tag count299 # Tag count
298 col_name = 'tagcount'300 col_name = 'tagcount'
299 col = {}301 col = {}
300 render_text = gtk.CellRendererText()302 render_text = Gtk.CellRendererText()
301 render_text.set_property('xpad', 3)303 render_text.set_property('xpad', 3)
302 render_text.set_property('ypad', 3)304 render_text.set_property('ypad', 3)
303 render_text.set_property('xalign', 1.0)305 render_text.set_property('xalign', 1.0)
@@ -369,7 +371,7 @@
369 # invisible 'task_id' column371 # invisible 'task_id' column
370 col_name = 'task_id'372 col_name = 'task_id'
371 col = {}373 col = {}
372 col['renderer'] = ['markup', gtk.CellRendererText()]374 col['renderer'] = ['markup', Gtk.CellRendererText()]
373 col['value'] = [str, lambda node: node.get_id()]375 col['value'] = [str, lambda node: node.get_id()]
374 col['visible'] = False376 col['visible'] = False
375 col['order'] = 0377 col['order'] = 0
@@ -385,8 +387,8 @@
385 # invisible 'title' column387 # invisible 'title' column
386 col_name = 'title'388 col_name = 'title'
387 col = {}389 col = {}
388 render_text = gtk.CellRendererText()390 render_text = Gtk.CellRendererText()
389 render_text.set_property("ellipsize", pango.ELLIPSIZE_END)391 render_text.set_property("ellipsize", Pango.EllipsizeMode.END)
390 col['renderer'] = ['markup', render_text]392 col['renderer'] = ['markup', render_text]
391 col['value'] = [str, self.task_title_column]393 col['value'] = [str, self.task_title_column]
392 col['visible'] = False394 col['visible'] = False
@@ -400,7 +402,7 @@
400 render_tags = CellRendererTags()402 render_tags = CellRendererTags()
401 render_tags.set_property('xalign', 0.0)403 render_tags.set_property('xalign', 0.0)
402 col['renderer'] = ['tag_list', render_tags]404 col['renderer'] = ['tag_list', render_tags]
403 col['value'] = [gobject.TYPE_PYOBJECT, self.task_tags_column]405 col['value'] = [GObject.TYPE_PYOBJECT, self.task_tags_column]
404 col['expandable'] = False406 col['expandable'] = False
405 col['resizable'] = False407 col['resizable'] = False
406 col['order'] = 1408 col['order'] = 1
@@ -410,8 +412,8 @@
410 col_name = 'label'412 col_name = 'label'
411 col = {}413 col = {}
412 col['title'] = _("Title")414 col['title'] = _("Title")
413 render_text = gtk.CellRendererText()415 render_text = Gtk.CellRendererText()
414 render_text.set_property("ellipsize", pango.ELLIPSIZE_END)416 render_text.set_property("ellipsize", Pango.EllipsizeMode.END)
415 col['renderer'] = ['markup', render_text]417 col['renderer'] = ['markup', render_text]
416 col['value'] = [str, self.task_label_column]418 col['value'] = [str, self.task_label_column]
417 col['expandable'] = True419 col['expandable'] = True
@@ -434,8 +436,10 @@
434 treeview.set_rules_hint(False)436 treeview.set_rules_hint(False)
435 treeview.set_multiple_selection(True)437 treeview.set_multiple_selection(True)
436 # Updating the unactive color (same for everyone)438 # Updating the unactive color (same for everyone)
437 self.unactive_color = \439 color = treeview.get_style_context().get_color(
438 treeview.style.text[gtk.STATE_INSENSITIVE].to_string()440 Gtk.StateFlags.INSENSITIVE)
441 # Convert color into #RRRGGGBBB
442 self.unactive_color = color.to_color().to_string()
439 return treeview443 return treeview
440444
441 def build_tag_treeview(self, tree, desc):445 def build_tag_treeview(self, tree, desc):
@@ -448,8 +452,11 @@
448 treeview.set_dnd_name('gtg/tag-iter-str')452 treeview.set_dnd_name('gtg/tag-iter-str')
449 treeview.set_dnd_external('gtg/task-iter-str', self.ontag_task_dnd)453 treeview.set_dnd_external('gtg/task-iter-str', self.ontag_task_dnd)
450 # Updating the unactive color (same for everyone)454 # Updating the unactive color (same for everyone)
451 self.unactive_color = \455 color = treeview.get_style_context().get_color(
452 treeview.style.text[gtk.STATE_INSENSITIVE].to_string()456 Gtk.StateFlags.INSENSITIVE)
457 # Convert color into #RRRGGGBBB
458 self.unactive_color = color.to_color().to_string()
459
453 treeview.set_sort_column('tag_id')460 treeview.set_sort_column('tag_id')
454 self.tags_view = treeview461 self.tags_view = treeview
455 return treeview462 return treeview
456463
=== modified file 'GTG/gtk/colors.py'
--- GTG/gtk/colors.py 2013-11-23 14:40:23 +0000
+++ GTG/gtk/colors.py 2014-01-12 07:15:48 +0000
@@ -17,7 +17,8 @@
17# this program. If not, see <http://www.gnu.org/licenses/>.17# this program. If not, see <http://www.gnu.org/licenses/>.
18# -----------------------------------------------------------------------------18# -----------------------------------------------------------------------------
1919
20import gtk20from gi.repository import Gdk
21from functools import reduce
2122
22# Take list of Tags and give the background color that should be applied23# Take list of Tags and give the background color that should be applied
23# The returned color might be None (in which case, the default is used)24# The returned color might be None (in which case, the default is used)
@@ -25,7 +26,7 @@
2526
26def background_color(tags, bgcolor=None):27def background_color(tags, bgcolor=None):
27 if not bgcolor:28 if not bgcolor:
28 bgcolor = gtk.gdk.color_parse("#FFFFFF")29 bgcolor = Gdk.color_parse("#FFFFFF")
29 # Compute color30 # Compute color
30 my_color = None31 my_color = None
31 color_count = 0.032 color_count = 0.0
@@ -35,7 +36,7 @@
35 for my_tag in tags:36 for my_tag in tags:
36 my_color_str = my_tag.get_attribute("color")37 my_color_str = my_tag.get_attribute("color")
37 if my_color_str:38 if my_color_str:
38 my_color = gtk.gdk.color_parse(my_color_str)39 my_color = Gdk.color_parse(my_color_str)
39 color_count = color_count + 140 color_count = color_count + 1
40 red = red + my_color.red41 red = red + my_color.red
41 green = green + my_color.green42 green = green + my_color.green
@@ -52,7 +53,7 @@
52 green = int(green * alpha + bgcolor.green * (1 - alpha))53 green = int(green * alpha + bgcolor.green * (1 - alpha))
53 blue = int(blue * alpha + bgcolor.blue * (1 - alpha))54 blue = int(blue * alpha + bgcolor.blue * (1 - alpha))
5455
55 my_color = gtk.gdk.Color(red, green, blue).to_string()56 my_color = Gdk.Color(red, green, blue).to_string()
56 return my_color57 return my_color
5758
5859
@@ -82,9 +83,11 @@
82 '''83 '''
83 Calls get_colored_tag_markup for each tag_name in tag_names84 Calls get_colored_tag_markup for each tag_name in tag_names
84 '''85 '''
85 tag_markups = map(lambda t: get_colored_tag_markup(req, t), tag_names)86 tag_markups = [get_colored_tag_markup(req, t) for t in tag_names]
86 tags_txt = ""87 tags_txt = ""
87 if tag_markups:88 if tag_markups:
88 # reduce crashes if applied to an empty list89 # reduce crashes if applied to an empty list
89 tags_txt = reduce(lambda a, b: a + ", " + b, tag_markups)90 tags_txt = reduce(lambda a, b: a + ", " + b, tag_markups)
90 return tags_txt91 return tags_txt
92
93# -----------------------------------------------------------------------------
9194
=== modified file 'GTG/gtk/crashhandler.py'
--- GTG/gtk/crashhandler.py 2013-02-25 07:35:07 +0000
+++ GTG/gtk/crashhandler.py 2014-01-12 07:15:48 +0000
@@ -1,4 +1,4 @@
1#!/usr/bin/env python21#!/usr/bin/env python3
2# Copyright 2010 David D. Lowe2# Copyright 2010 David D. Lowe
3# All rights reserved.3# All rights reserved.
4#4#
@@ -23,9 +23,9 @@
2323
24"""GTK except hook for your applications.24"""GTK except hook for your applications.
25To use, simply import this module and call gtkcrashhandler.initialize().25To use, simply import this module and call gtkcrashhandler.initialize().
26Import this module before calling gtk.main().26Import this module before calling Gtk.main().
2727
28If gtkcrashhandler cannot import gtk, pygtk, pango or gobject,28If gtkcrashhandler cannot import Gtk, Pango or GObject,
29gtkcrashhandler will print a warning and use the default excepthook.29gtkcrashhandler will print a warning and use the default excepthook.
3030
31If you're using multiple threads, use gtkcrashhandler_thread decorator."""31If you're using multiple threads, use gtkcrashhandler_thread decorator."""
@@ -34,24 +34,22 @@
34import os34import os
35import time35import time
36import signal36import signal
37import traceback
38import threading
37from contextlib import contextmanager39from contextlib import contextmanager
3840
39from GTG import info41from GTG import info
4042
4143
42try:44try:
43 import pygtk45 from gi.repository import GObject, Gtk, Pango
44 pygtk.require("2.0") # not tested on earlier versions
45 import gtk
46 import pango
47 import gobject
48 _gtk_initialized = True
49except Exception:46except Exception:
50 print >> sys.stderr, "gtkcrashhandler could not load GTK 2.0"47 print("gtkcrashhandler could not load GTK 3.0", file=sys.stderr)
51 _gtk_initialized = False48 _gtk_initialized = False
52import traceback49else:
50 _gtk_initialized = True
51
53from gettext import gettext as _52from gettext import gettext as _
54import threading
5553
56APP_NAME = None54APP_NAME = None
57MESSAGE = _("We're terribly sorry. Could you help us fix the problem by "55MESSAGE = _("We're terribly sorry. Could you help us fix the problem by "
@@ -99,7 +97,7 @@
99 if thread:97 if thread:
100 if not isinstance(thread, threading._MainThread):98 if not isinstance(thread, threading._MainThread):
101 tb = "Exception in thread %s:\n%s" % (thread.getName(), tb)99 tb = "Exception in thread %s:\n%s" % (thread.getName(), tb)
102 print >> sys.stderr, tb100 print(tb, file=sys.stderr)
103101
104 # determine whether to add a "Report problem..." button102 # determine whether to add a "Report problem..." button
105 add_apport_button = False103 add_apport_button = False
@@ -109,7 +107,7 @@
109 try:107 try:
110 from apport.fileutils import likely_packaged108 from apport.fileutils import likely_packaged
111 try:109 try:
112 filename = os.path.realpath(os.path.join(os.getcwdu(),110 filename = os.path.realpath(os.path.join(os.getcwd(),
113 sys.argv[0]))111 sys.argv[0]))
114 except:112 except:
115 filename = os.path.realpath("/proc/%i/exe" % os.getpid())113 filename = os.path.realpath("/proc/%i/exe" % os.getpid())
@@ -176,17 +174,17 @@
176 if dialog is not None:174 if dialog is not None:
177 return 1175 return 1
178176
179 dialog = gtk.Dialog(title)177 dialog = Gtk.Dialog(title)
180178
181 # title Label179 # title Label
182 label = gtk.Label()180 label = Gtk.Label()
183 label.set_markup("<b>%s</b>" % _("It looks like an error has occurred."))181 label.set_markup("<b>%s</b>" % _("It looks like an error has occurred."))
184 label.set_alignment(0, 0.5)182 label.set_alignment(0, 0.5)
185 dialog.get_content_area().pack_start(label, False)183 dialog.get_content_area().pack_start(label, False, True, 0)
186184
187 # message Label185 # message Label
188 global MESSAGE186 global MESSAGE
189 text_label = gtk.Label()187 text_label = Gtk.Label()
190 text_label.set_markup(MESSAGE)188 text_label.set_markup(MESSAGE)
191 text_label.set_alignment(0, 0.5)189 text_label.set_alignment(0, 0.5)
192 text_label.set_line_wrap(True)190 text_label.set_line_wrap(True)
@@ -197,36 +195,36 @@
197195
198 text_label.connect("size-allocate", text_label_size_allocate)196 text_label.connect("size-allocate", text_label_size_allocate)
199 if not MESSAGE == "":197 if not MESSAGE == "":
200 dialog.get_content_area().pack_start(text_label, False)198 dialog.get_content_area().pack_start(text_label, False, True, 0)
201199
202 # TextView with error_string200 # TextView with error_string
203 buffer = gtk.TextBuffer()201 buffer = Gtk.TextBuffer()
204 buffer.set_text(error_string)202 buffer.set_text(error_string)
205 textview = gtk.TextView()203 textview = Gtk.TextView()
206 textview.set_buffer(buffer)204 textview.set_buffer(buffer)
207 textview.set_editable(False)205 textview.set_editable(False)
208 try:206 try:
209 textview.modify_font(pango.FontDescription("monospace 8"))207 textview.override_font(Pango.FontDescription("monospace 8"))
210 except Exception:208 except Exception:
211 print >> sys.stderr, "gtkcrashhandler: modify_font raised an exception"209 print("gtkcrashhandler: override_font raised an exception", file=sys.stderr)
212210
213 # allow scrolling of textview211 # allow scrolling of textview
214 scrolled = gtk.ScrolledWindow()212 scrolled = Gtk.ScrolledWindow()
215 scrolled.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)213 scrolled.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
216 scrolled.add_with_viewport(textview)214 scrolled.add_with_viewport(textview)
217215
218 # hide the textview in an Expander widget216 # hide the textview in an Expander widget
219 expander = gtk.expander_new_with_mnemonic(_("_Details"))217 expander = Gtk.expander_new_with_mnemonic(_("_Details"))
220 expander.add(scrolled)218 expander.add(scrolled)
221 expander.connect('activate', on_expanded)219 expander.connect('activate', on_expanded)
222 dialog.get_content_area().pack_start(expander, True)220 dialog.get_content_area().pack_start(expander, True, True, 0)
223221
224 # add buttons222 # add buttons
225 if add_apport_button:223 if add_apport_button:
226 dialog.add_button(_("_Report this problem..."), 3)224 dialog.add_button(_("_Report this problem..."), 3)
227 # If we're have multiple threads, or if we're in a GTK callback,225 # If we're have multiple threads, or if we're in a GTK callback,
228 # execution can continue normally in other threads, so add button226 # execution can continue normally in other threads, so add button
229 if gtk.main_level() > 0 or threading.activeCount() > 1:227 if Gtk.main_level() > 0 or threading.activeCount() > 1:
230 dialog.add_button(_("_Ignore the error"), 1)228 dialog.add_button(_("_Ignore the error"), 1)
231 dialog.add_button(("_Close the program"), 2)229 dialog.add_button(("_Close the program"), 2)
232 dialog.set_default_response(2)230 dialog.set_default_response(2)
@@ -275,28 +273,28 @@
275 def gtkcrashhandler_wrapped_run(*args, **kwargs):273 def gtkcrashhandler_wrapped_run(*args, **kwargs):
276 try:274 try:
277 run(*args, **kwargs)275 run(*args, **kwargs)
278 except Exception, ee:276 except Exception as ee:
279 lock = threading.Lock()277 lock = threading.Lock()
280 lock.acquire()278 lock.acquire()
281 tb = sys.exc_info()[2]279 tb = sys.exc_info()[2]
282 if gtk.main_level() > 0:280 if Gtk.main_level() > 0:
283 gobject.idle_add(281 GObject.idle_add(
284 lambda ee=ee, tb=tb, thread=threading.currentThread():282 lambda ee=ee, tb=tb, thread=threading.currentThread():
285 _replacement_excepthook(ee.__class__, ee, tb,283 _replacement_excepthook(ee.__class__, ee, tb,
286 thread=thread))284 thread=thread))
287 else:285 else:
288 time.sleep(0.1) # ugly hack, seems like threads that are286 time.sleep(0.1) # ugly hack, seems like threads that are
289 # started before running gtk.main() cause287 # started before running Gtk.main() cause
290 # this one to crash.288 # this one to crash.
291 # This delay allows gtk.main() to initialize289 # This delay allows Gtk.main() to initialize
292 # properly.290 # properly.
293 # My advice: run gtk.main() before starting291 # My advice: run Gtk.main() before starting
294 # any threads or don't run gtk.main() at all292 # any threads or don't run Gtk.main() at all
295 _replacement_excepthook(ee.__class__, ee, tb,293 _replacement_excepthook(ee.__class__, ee, tb,
296 thread=threading.currentThread())294 thread=threading.currentThread())
297 lock.release()295 lock.release()
298296
299 # return wrapped run if gtkcrashhandler has been initialized297 # return wrapped run if Gtkcrashhandler has been initialized
300 global _gtk_initialized, _old_sys_excepthook298 global _gtk_initialized, _old_sys_excepthook
301 if _gtk_initialized and _old_sys_excepthook:299 if _gtk_initialized and _old_sys_excepthook:
302 return gtkcrashhandler_wrapped_run300 return gtkcrashhandler_wrapped_run
@@ -307,7 +305,7 @@
307 # throw test exception305 # throw test exception
308 initialize(app_name="gtkcrashhandler", message="Don't worry, though. This "306 initialize(app_name="gtkcrashhandler", message="Don't worry, though. This "
309 "is just a test. To use the code properly, call "307 "is just a test. To use the code properly, call "
310 "gtkcrashhandler.initialize() in your PyGTK app to "308 "gtkcrashhandler.initialize() in your GTK app to "
311 "automatically catch any Python exceptions like this.")309 "automatically catch any Python exceptions like this.")
312310
313 class DoNotRunException(Exception):311 class DoNotRunException(Exception):
314312
=== modified file 'GTG/gtk/dbuswrapper.py'
--- GTG/gtk/dbuswrapper.py 2013-11-23 14:40:23 +0000
+++ GTG/gtk/dbuswrapper.py 2014-01-12 07:15:48 +0000
@@ -38,7 +38,7 @@
38 so these need to be converted into blank values D-Bus accepts.38 so these need to be converted into blank values D-Bus accepts.
39 @return: Cleaned up dictionary39 @return: Cleaned up dictionary
40 """40 """
41 for k, v in data.items():41 for k, v in list(data.items()):
42 # Manually specify an arbitrary content type for empty Python arrays42 # Manually specify an arbitrary content type for empty Python arrays
43 # because D-Bus can't handle the type conversion for empty arrays43 # because D-Bus can't handle the type conversion for empty arrays
44 if not v and isinstance(v, list):44 if not v and isinstance(v, list):
4545
=== modified file 'GTG/gtk/delete_dialog.py'
--- GTG/gtk/delete_dialog.py 2013-11-23 14:40:23 +0000
+++ GTG/gtk/delete_dialog.py 2014-01-12 07:15:48 +0000
@@ -18,7 +18,7 @@
18# -----------------------------------------------------------------------------18# -----------------------------------------------------------------------------
1919
2020
21import gtk21from gi.repository import Gtk
2222
23from GTG import _, ngettext23from GTG import _, ngettext
24from GTG.gtk import ViewConfig24from GTG.gtk import ViewConfig
@@ -34,8 +34,8 @@
34 # Tags which must be updated34 # Tags which must be updated
35 self.update_tags = []35 self.update_tags = []
36 # Load window tree36 # Load window tree
37 self.builder = gtk.Builder()37 self.builder = Gtk.Builder()
38 self.builder.add_from_file(ViewConfig.DELETE_GLADE_FILE)38 self.builder.add_from_file(ViewConfig.DELETE_UI_FILE)
39 signals = {"on_delete_confirm": self.on_delete_confirm,39 signals = {"on_delete_confirm": self.on_delete_confirm,
40 "on_delete_cancel": lambda x: x.hide, }40 "on_delete_cancel": lambda x: x.hide, }
41 self.builder.connect_signals(signals)41 self.builder.connect_signals(signals)
4242
=== renamed file 'GTG/gtk/deletion.glade' => 'GTG/gtk/deletion.ui'
--- GTG/gtk/deletion.glade 2012-05-23 08:55:31 +0000
+++ GTG/gtk/deletion.ui 2014-01-12 07:15:48 +0000
@@ -1,6 +1,6 @@
1<?xml version="1.0" encoding="UTF-8"?>1<?xml version="1.0" encoding="UTF-8"?>
2<interface>2<interface>
3 <requires lib="gtk+" version="2.16"/>3 <!-- interface-requires gtk+ 3.0 -->
4 <object class="GtkDialog" id="confirm_delete">4 <object class="GtkDialog" id="confirm_delete">
5 <property name="can_focus">False</property>5 <property name="can_focus">False</property>
6 <property name="border_width">5</property>6 <property name="border_width">5</property>
@@ -28,7 +28,7 @@
28 <property name="use_action_appearance">False</property>28 <property name="use_action_appearance">False</property>
29 <signal name="released" handler="on_delete_cancel" swapped="no"/>29 <signal name="released" handler="on_delete_cancel" swapped="no"/>
30 <child>30 <child>
31 <object class="GtkHBox" id="cd-hbox2">31 <object class="GtkBox" id="cd-box2">
32 <property name="visible">True</property>32 <property name="visible">True</property>
33 <property name="can_focus">False</property>33 <property name="can_focus">False</property>
34 <child>34 <child>
@@ -75,7 +75,7 @@
75 <signal name="activate" handler="on_delete_confirm" swapped="no"/>75 <signal name="activate" handler="on_delete_confirm" swapped="no"/>
76 <signal name="released" handler="on_delete_confirm" swapped="no"/>76 <signal name="released" handler="on_delete_confirm" swapped="no"/>
77 <child>77 <child>
78 <object class="GtkHBox" id="cd-hbox3">78 <object class="GtkBox" id="cd-box3">
79 <property name="visible">True</property>79 <property name="visible">True</property>
80 <property name="can_focus">False</property>80 <property name="can_focus">False</property>
81 <child>81 <child>
@@ -120,7 +120,7 @@
120 </packing>120 </packing>
121 </child>121 </child>
122 <child>122 <child>
123 <object class="GtkHBox" id="cd-hbox1">123 <object class="GtkBox" id="cd-box1">
124 <property name="visible">True</property>124 <property name="visible">True</property>
125 <property name="can_focus">False</property>125 <property name="can_focus">False</property>
126 <child>126 <child>
@@ -139,10 +139,11 @@
139 </packing>139 </packing>
140 </child>140 </child>
141 <child>141 <child>
142 <object class="GtkVBox" id="cd-vbox2">142 <object class="GtkBox" id="cd-vbox2">
143 <property name="visible">True</property>143 <property name="visible">True</property>
144 <property name="can_focus">False</property>144 <property name="can_focus">False</property>
145 <property name="spacing">16</property>145 <property name="spacing">16</property>
146 <property name="orientation">vertical</property>
146 <child>147 <child>
147 <object class="GtkLabel" id="cd-label2">148 <object class="GtkLabel" id="cd-label2">
148 <property name="visible">True</property>149 <property name="visible">True</property>
149150
=== modified file 'GTG/gtk/editor/__init__.py'
--- GTG/gtk/editor/__init__.py 2013-11-23 14:40:23 +0000
+++ GTG/gtk/editor/__init__.py 2014-01-12 07:15:48 +0000
@@ -26,7 +26,7 @@
2626
27class GnomeConfig:27class GnomeConfig:
28 current_rep = os.path.dirname(os.path.abspath(__file__))28 current_rep = os.path.dirname(os.path.abspath(__file__))
29 GLADE_FILE = os.path.join(current_rep, "taskeditor.glade")29 EDITOR_UI_FILE = os.path.join(current_rep, "taskeditor.ui")
3030
31 MARK_DONE = _("Mark as Done")31 MARK_DONE = _("Mark as Done")
32 MARK_UNDONE = _("Mark as not Done")32 MARK_UNDONE = _("Mark as not Done")
3333
=== modified file 'GTG/gtk/editor/calendar.py'
--- GTG/gtk/editor/calendar.py 2013-11-23 14:40:23 +0000
+++ GTG/gtk/editor/calendar.py 2014-01-12 07:15:48 +0000
@@ -19,31 +19,29 @@
1919
20import datetime20import datetime
2121
22import gobject22from gi.repository import GObject, Gdk
23import gtk
24from gtk import gdk
2523
26from GTG.tools.dates import Date24from GTG.tools.dates import Date
2725
2826
29class GTGCalendar(gobject.GObject):27class GTGCalendar(GObject.GObject):
30 """ Wrapper around gtk.Calendar object """28 """ Wrapper around Gtk.Calendar object """
3129
32 # CONSTANTS30 # CONSTANTS
33 DATE_KIND_DUE = "due"31 DATE_KIND_DUE = "due"
34 DATE_KIND_START = "start"32 DATE_KIND_START = "start"
35 DATE_KIND_CLOSED = "closed"33 DATE_KIND_CLOSED = "closed"
3634
37 # Gobject signal description35 #Gobject signal description
38 __signal_type__ = (gobject.SIGNAL_RUN_FIRST,36 __signal_type__ = (GObject.SignalFlags.RUN_FIRST,
39 gobject.TYPE_NONE,37 None,
40 [])38 [])
4139
42 __gsignals__ = {'date-changed': __signal_type__, }40 __gsignals__ = {'date-changed': __signal_type__, }
4341
44 def __init__(self, gtk_builder):42 def __init__(self, Gtk_builder):
45 super(GTGCalendar, self).__init__()43 super(GTGCalendar, self).__init__()
46 self.__builder = gtk_builder44 self.__builder = Gtk_builder
47 self.__date_kind = None45 self.__date_kind = None
48 self.__date = Date.no_date()46 self.__date = Date.no_date()
49 self.__init_gtk__()47 self.__init_gtk__()
@@ -106,13 +104,13 @@
106 else:104 else:
107 # If marked day is 31th, and the next month does not have 31th day,105 # If marked day is 31th, and the next month does not have 31th day,
108 # unmark_day raises a warning. Clear_marks() is clever way how106 # unmark_day raises a warning. Clear_marks() is clever way how
109 # to let PyGTK solve it's bussiness.107 # to let GTK solve it's bussiness.
110 self.__calendar.clear_marks()108 self.__calendar.clear_marks()
111109
112 def move_calendar_inside(self, width, height, x, y):110 def move_calendar_inside(self, width, height, x, y):
113 """ This method moves the calender inside the screen whenever part of111 """ This method moves the calender inside the screen whenever part of
114 it is displayed outside the screen """112 it is displayed outside the screen """
115 screen_width = gtk.gdk.screen_width()113 screen_width = Gdk.Screen.width()
116 # To display calendar inside the screen when editor window is114 # To display calendar inside the screen when editor window is
117 # outside leftside of the screen115 # outside leftside of the screen
118 if x < width:116 if x < width:
@@ -132,32 +130,49 @@
132 # ones? question by invernizzi)130 # ones? question by invernizzi)
133 self.move_calendar_inside(width, height, x, y)131 self.move_calendar_inside(width, height, x, y)
134 self.__window.grab_add()132 self.__window.grab_add()
135 # We grab the pointer in the calendar133
136 gdk.pointer_grab(self.__window.window, True,134 #We grab the pointer in the calendar
137 gdk.BUTTON1_MASK | gdk.MOD2_MASK)135 #Gdk.pointer_grab(
136 #self.__window.get_window(),
137 #True,
138 #Gdk.ModifierType.BUTTON1_MASK | Gdk.ModifierType.MOD2_MASK
139 #)
140#FIXME THIS DOES NOT WORK!!!!!!!
141 Gdk.pointer_grab(
142 self.get_window(),
143 True,
144 #Gdk.ModifierType.BUTTON1_MASK | Gdk.ModifierType.MOD2_MASK,
145#FIXME!!!! JUST GUESSING THE TYPE
146 Gdk.EventMask.ALL_EVENTS_MASK,
147 None,
148 None,
149 0,
150 )
151
138 self.__window.connect('button-press-event', self.__focus_out)152 self.__window.connect('button-press-event', self.__focus_out)
139 self.__sigid = self.__calendar.connect("day-selected",153 self.__sigid = self.__calendar.connect("day-selected",
140 self.__day_selected,154 self.__day_selected,
141 "RealDate")155 "RealDate",)
156
142 self.__sigid_month = self.__calendar.connect("month-changed",157 self.__sigid_month = self.__calendar.connect("month-changed",
143 self.__month_changed)158 self.__month_changed)
144 # Problem: gtk.Calendar does not tell you directly if the159 # Problem: Gtk.Calendar does not tell you directly if the
145 # "day-selected" signal was caused by the user clicking on160 # "day-selected" signal was caused by the user clicking on
146 # a date, or just browsing the calendar.161 # a date, or just browsing the calendar.
147 # Solution: we track that in a variable162 # Solution: we track that in a variable
148 self.__is_user_just_browsing_the_calendar = False163 self.__is_user_just_browsing_the_calendar = False
149 self.__mark_today_in_bold()164 self.__mark_today_in_bold()
150165
151 def __focus_out(self, w=None, e=None):166 def __focus_out(self, w=None, e=None):
152 # We should only close if the pointer click is out of the calendar !167 # We should only close if the pointer click is out of the calendar !
153 p = self.__window.window.get_pointer()168 p = self.__window.get_window().get_pointer()
154 s = self.__window.get_size()169 s = self.__window.get_size()
155 if not(0 <= p[0] <= s[0] and 0 <= p[1] <= s[1]):170 if not(0 <= p[0] <= s[0] and 0 <= p[1] <= s[1]):
156 self.close_calendar()171 self.close_calendar()
157172
158 def close_calendar(self, widget=None, e=None):173 def close_calendar(self, widget=None, e=None):
159 self.__window.hide()174 self.__window.hide()
160 gtk.gdk.pointer_ungrab()175 Gdk.pointer_ungrab(0)
161 self.__window.grab_remove()176 self.__window.grab_remove()
162 if self.__sigid is not None:177 if self.__sigid is not None:
163 self.__calendar.disconnect(self.__sigid)178 self.__calendar.disconnect(self.__sigid)
@@ -181,11 +196,11 @@
181 else:196 else:
182 # inform the Editor that the date has changed197 # inform the Editor that the date has changed
183 self.close_calendar()198 self.close_calendar()
184 gobject.idle_add(self.emit, "date-changed")199 GObject.idle_add(self.emit, "date-changed")
185200
186 def __from_calendar_date_to_datetime(self, calendar_date):201 def __from_calendar_date_to_datetime(self, calendar_date):
187 '''202 '''
188 gtk.Calendar uses a 0-based convention for counting months.203 Gtk.Calendar uses a 0-based convention for counting months.
189 The rest of the world, including the datetime module, starts from 1.204 The rest of the world, including the datetime module, starts from 1.
190 This is a converter between the two. GTG follows the datetime205 This is a converter between the two. GTG follows the datetime
191 convention.206 convention.
192207
=== modified file 'GTG/gtk/editor/editor.py'
--- GTG/gtk/editor/editor.py 2013-11-23 14:40:23 +0000
+++ GTG/gtk/editor/editor.py 2014-01-12 07:15:48 +0000
@@ -25,8 +25,7 @@
25"""25"""
26import time26import time
2727
28import pango28from gi.repository import Gtk, Gdk, Pango
29import gtk
3029
31from GTG import _, ngettext30from GTG import _, ngettext
32from GTG.gtk.editor import GnomeConfig31from GTG.gtk.editor import GnomeConfig
@@ -38,7 +37,7 @@
38from GTG.gtk.editor.calendar import GTGCalendar37from GTG.gtk.editor.calendar import GTGCalendar
3938
4039
41class TaskEditor:40class TaskEditor(object):
4241
43 def __init__(self,42 def __init__(self,
44 requester,43 requester,
@@ -59,8 +58,8 @@
59 self.config = taskconfig58 self.config = taskconfig
60 self.time = None59 self.time = None
61 self.clipboard = clipboard60 self.clipboard = clipboard
62 self.builder = gtk.Builder()61 self.builder = Gtk.Builder()
63 self.builder.add_from_file(GnomeConfig.GLADE_FILE)62 self.builder.add_from_file(GnomeConfig.EDITOR_UI_FILE)
64 self.donebutton = self.builder.get_object("mark_as_done_editor")63 self.donebutton = self.builder.get_object("mark_as_done_editor")
65 self.dismissbutton = self.builder.get_object("dismiss_editor")64 self.dismissbutton = self.builder.get_object("dismiss_editor")
66 self.deletebutton = self.builder.get_object("delete_editor")65 self.deletebutton = self.builder.get_object("delete_editor")
@@ -75,25 +74,25 @@
75 "mark_as_done_clicked": self.change_status,74 "mark_as_done_clicked": self.change_status,
76 "on_dismiss": self.dismiss,75 "on_dismiss": self.dismiss,
77 "delete_clicked": self.delete_task,76 "delete_clicked": self.delete_task,
78 "on_duedate_pressed": (self.on_date_pressed,77 "on_duedate_pressed": lambda w: self.on_date_pressed(
79 GTGCalendar.DATE_KIND_DUE),78 w, GTGCalendar.DATE_KIND_DUE),
80 "on_startdate_pressed": (self.on_date_pressed,79 "on_startdate_pressed": lambda w: self.on_date_pressed(
81 GTGCalendar.DATE_KIND_START),80 w, GTGCalendar.DATE_KIND_START),
82 "on_closeddate_pressed": (self.on_date_pressed,81 "on_closeddate_pressed": lambda w: self.on_date_pressed(
83 GTGCalendar.DATE_KIND_CLOSED),82 w, GTGCalendar.DATE_KIND_CLOSED),
84 "close_clicked": self.close,83 "close_clicked": self.close,
85 "duedate_changed": (self.date_changed,84 "duedate_changed": lambda w: self.date_changed(
86 GTGCalendar.DATE_KIND_DUE),85 w, GTGCalendar.DATE_KIND_DUE),
87 "duedate_focus_out": (self.date_focus_out,86 "duedate_focus_out": lambda w, e: self.date_focus_out(
88 GTGCalendar.DATE_KIND_DUE),87 w, e, GTGCalendar.DATE_KIND_DUE),
89 "startingdate_changed": (self.date_changed,88 "startingdate_changed": lambda w: self.date_changed(
90 GTGCalendar.DATE_KIND_START),89 w, GTGCalendar.DATE_KIND_START),
91 "startdate_focus_out": (self.date_focus_out,90 "startdate_focus_out": lambda w, e: self.date_focus_out(
92 GTGCalendar.DATE_KIND_START),91 w, e, GTGCalendar.DATE_KIND_START),
93 "closeddate_changed": (self.date_changed,92 "closeddate_changed": lambda w: self.date_changed(
94 GTGCalendar.DATE_KIND_CLOSED),93 w, GTGCalendar.DATE_KIND_CLOSED),
95 "closeddate_focus_out": (self.date_focus_out,94 "closeddate_focus_out": lambda w, e: self.date_focus_out(
96 GTGCalendar.DATE_KIND_CLOSED),95 w, e, GTGCalendar.DATE_KIND_CLOSED),
97 "on_insert_subtask_clicked": self.insert_subtask,96 "on_insert_subtask_clicked": self.insert_subtask,
98 "on_inserttag_clicked": self.inserttag_clicked,97 "on_inserttag_clicked": self.inserttag_clicked,
99 "on_move": self.on_move,98 "on_move": self.on_move,
@@ -115,7 +114,7 @@
115 scrolled.add(self.textview)114 scrolled.add(self.textview)
116 conf_font_value = self.browser_config.get("font_name")115 conf_font_value = self.browser_config.get("font_name")
117 if conf_font_value != "":116 if conf_font_value != "":
118 self.textview.modify_font(pango.FontDescription(conf_font_value))117 self.textview.override_font(Pango.FontDescription(conf_font_value))
119 # Voila! it's done118 # Voila! it's done
120 self.calendar = GTGCalendar(self.builder)119 self.calendar = GTGCalendar(self.builder)
121 self.duedate_widget = self.builder.get_object("duedate_entry")120 self.duedate_widget = self.builder.get_object("duedate_entry")
@@ -189,38 +188,38 @@
189 # Define accelerator-keys for this dialog188 # Define accelerator-keys for this dialog
190 # TODO: undo/redo189 # TODO: undo/redo
191 def init_accelerators(self):190 def init_accelerators(self):
192 agr = gtk.AccelGroup()191 agr = Gtk.AccelGroup()
193 self.window.add_accel_group(agr)192 self.window.add_accel_group(agr)
194193
195 # Escape and Ctrl-W close the dialog. It's faster to call close194 # Escape and Ctrl-W close the dialog. It's faster to call close
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to status/vote changes: