gtg team mailing list archive
-
gtg team
-
Mailing list archive
-
Message #03851
[Merge] lp:~huxuan/gtg/port-to-gtk3-py3 into lp:gtg
Xuan (Sean) Hu has proposed merging lp:~huxuan/gtg/port-to-gtk3-py3 into lp:gtg.
Requested reviews:
Gtg developers (gtg)
For more details, see:
https://code.launchpad.net/~huxuan/gtg/port-to-gtk3-py3/+merge/187552
This is the Gtk3 and Python3 ported GTG.
You can get more information about the porting work here [1].
Besides, there is a shared evernote [2] listed test actions and coverage [3] report.
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/
--
https://code.launchpad.net/~huxuan/gtg/port-to-gtk3-py3/+merge/187552
Your team Gtg developers is requested to review the proposed merge of lp:~huxuan/gtg/port-to-gtk3-py3 into lp:gtg.
=== modified file 'AUTHORS'
--- AUTHORS 2013-06-04 19:29:36 +0000
+++ AUTHORS 2013-09-25 16:29:12 +0000
@@ -112,6 +112,7 @@
For 0.3.1:
----------
+* Joe R. Nassimian <nassimian.joseph@xxxxxxxxx>
* Antonio Roquentin <https://launchpad.net/~antonio-roquentin> (no email provided)
* Codee <kmhpfoss@xxxxxxxxx>
* Tom Kadwill <tomkadwill@xxxxxxxxx>
=== modified file 'GTG/__init__.py'
--- GTG/__init__.py 2013-02-25 07:35:07 +0000
+++ GTG/__init__.py 2013-09-25 16:29:12 +0000
@@ -29,13 +29,9 @@
locale.setlocale(locale.LC_ALL, 'C')
import gettext
-try:
- from gtk import glade
- loaded_glade = glade
-except:
- # that's not pretty but it looks functional.
- loaded_glade = None
+# FIXME is this construction needed?
+# There are many other places where this is used
try:
from xdg.BaseDirectory import xdg_config_home
config_home = xdg_config_home
@@ -48,11 +44,9 @@
GETTEXT_DOMAIN = 'gtg'
LOCALE_PATH = gettext.bindtextdomain(GETTEXT_DOMAIN)
-for module in gettext, loaded_glade:
- # check if glade is well loaded to avoid error in Fedora build farm
- if module:
- module.bindtextdomain(GETTEXT_DOMAIN, LOCALE_PATH)
- module.textdomain(GETTEXT_DOMAIN)
+gettext.bindtextdomain(GETTEXT_DOMAIN, LOCALE_PATH)
+gettext.textdomain(GETTEXT_DOMAIN)
+# FIXME set translation for Builder as well!
translation = gettext.translation(GETTEXT_DOMAIN, LOCALE_PATH, fallback=True)
=== modified file 'GTG/backends/__init__.py'
--- GTG/backends/__init__.py 2013-02-25 07:35:07 +0000
+++ GTG/backends/__init__.py 2013-09-25 16:29:12 +0000
@@ -50,30 +50,29 @@
"""
Creates a dictionary of the currently available backend modules
"""
- super(BackendFactory, self).__init__()
+ Borg.__init__(self)
if hasattr(self, "backend_modules"):
# This object has already been constructed
return
self.backend_modules = {}
# Look for backends in the GTG/backends dir
this_dir = os.path.dirname(__file__)
- backend_files = filter(lambda f: f.endswith(".py") and
- f.startswith(self.BACKEND_PREFIX),
- os.listdir(this_dir))
+ backend_files = [f for f in os.listdir(this_dir) if f.endswith(".py") and
+ f.startswith(self.BACKEND_PREFIX)]
# Create module names
- module_names = map(lambda f: f.replace(".py", ""), backend_files)
+ module_names = [f.replace(".py", "") for f in backend_files]
Log.debug("Backends found: " + str(module_names))
# Load backend modules
for module_name in module_names:
extended_module_name = "GTG.backends." + module_name
try:
__import__(extended_module_name)
- except ImportError, exception:
+ except ImportError as exception:
# Something is wrong with this backend, skipping
Log.warning("Backend %s could not be loaded: %s" %
(module_name, str(exception)))
continue
- except Exception, exception:
+ except Exception as exception:
# Other exception log as errors
Log.error("Malformated backend %s: %s" %
(module_name, str(exception)))
@@ -113,11 +112,11 @@
# type
parameters = module.Backend.get_static_parameters()
# we all the parameters and their default values in dic
- for param_name, param_dic in parameters.iteritems():
+ for param_name, param_dic in parameters.items():
dic[param_name] = param_dic[GenericBackend.PARAM_DEFAULT_VALUE]
dic["pid"] = str(uuid.uuid4())
dic["module"] = module.Backend.get_name()
- for param_name, param_value in additional_parameters.iteritems():
+ for param_name, param_value in additional_parameters.items():
dic[param_name] = param_value
dic["backend"] = module.Backend(dic)
return dic
@@ -146,7 +145,7 @@
# Building the dictionary
parameters_specs = module.Backend.get_static_parameters()
dic["pid"] = str(xp.getAttribute("pid"))
- for param_name, param_dic in parameters_specs.iteritems():
+ for param_name, param_dic in parameters_specs.items():
if xp.hasAttribute(param_name):
# we need to convert the parameter to the right format.
# we fetch the format from the static_parameters
=== modified file 'GTG/backends/backend_rtm.py'
--- GTG/backends/backend_rtm.py 2013-02-25 08:12:02 +0000
+++ GTG/backends/backend_rtm.py 2013-09-25 16:29:12 +0000
@@ -41,6 +41,7 @@
from GTG.core.task import Task
from GTG.tools.interruptible import interruptible
from GTG.tools.logger import Log
+from functools import reduce
class Backend(PeriodicImportBackend):
@@ -140,7 +141,7 @@
# set
stored_rtm_task_ids = self.sync_engine.get_all_remote()
current_rtm_task_ids = [tid for tid in
- self.rtm_proxy.get_rtm_tasks_dict().iterkeys()]
+ self.rtm_proxy.get_rtm_tasks_dict().keys()]
if self._this_is_the_first_loop:
self._on_successful_authentication()
@@ -424,7 +425,7 @@
# tags to add
for tag in tags.difference(gtg_tags_lower):
gtg_all_tags = self.datastore.get_all_tags()
- matching_tags = filter(lambda t: t.lower() == tag, gtg_all_tags)
+ matching_tags = [t for t in gtg_all_tags if t.lower() == tag]
if len(matching_tags) != 0:
tag = matching_tags[0]
task.add_tag(tag)
@@ -471,7 +472,7 @@
three times before giving up.
'''
MAX_ATTEMPTS = 3
- for i in xrange(MAX_ATTEMPTS):
+ for i in range(MAX_ATTEMPTS):
try:
return fun(*args)
except:
@@ -589,7 +590,7 @@
self.rtm = createRTM(self.PUBLIC_KEY, self.PRIVATE_KEY, self.token)
self.timeline = self.rtm.timelines.create().timeline
return True
- except (RTMError, RTMAPIError), e:
+ except (RTMError, RTMAPIError) as e:
Log.error("RTM ERROR" + str(e))
return False
@@ -890,8 +891,7 @@
return ""
else:
note_list = self.__getattr_the_rtm_way(notes, 'note')
- return "".join(map(lambda note: "%s\n" % getattr(note, '$t'),
- note_list))
+ return "".join(["%s\n" % getattr(note, '$t') for note in note_list])
def set_text(self, text, transaction_ids=[]):
'''
=== modified file 'GTG/backends/backendsignals.py'
--- GTG/backends/backendsignals.py 2013-02-25 07:35:07 +0000
+++ GTG/backends/backendsignals.py 2013-09-25 16:29:12 +0000
@@ -17,7 +17,7 @@
# this program. If not, see <http://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------------
-import gobject
+from gi.repository import GObject
from GTG.tools.borg import Borg
@@ -59,10 +59,10 @@
@returns: tuple
'''
- return (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, args)
-
-
-class _BackendSignalsGObject(gobject.GObject):
+ return (GObject.SignalFlags.RUN_FIRST, None, args)
+
+
+class _BackendSignalsGObject(GObject.GObject):
# signal name constants
BACKEND_STATE_TOGGLED = 'backend-state-toggled' # emitted when a
@@ -103,7 +103,7 @@
# As a general rule, signals should only be emitted in the GenericBackend
# class
def _emit_signal(self, signal, backend_id):
- gobject.idle_add(self.emit, signal, backend_id)
+ GObject.idle_add(self.emit, signal, backend_id)
def backend_state_changed(self, backend_id):
self._emit_signal(self.BACKEND_STATE_TOGGLED, backend_id)
@@ -118,15 +118,15 @@
self._emit_signal(self.BACKEND_REMOVED, backend_id)
def default_backend_loaded(self):
- gobject.idle_add(self.emit, self.DEFAULT_BACKEND_LOADED)
+ GObject.idle_add(self.emit, self.DEFAULT_BACKEND_LOADED)
def backend_failed(self, backend_id, error_code):
- gobject.idle_add(self.emit, self.BACKEND_FAILED, backend_id,
+ GObject.idle_add(self.emit, self.BACKEND_FAILED, backend_id,
error_code)
def interaction_requested(self, backend_id, description,
interaction_type, callback_str):
- gobject.idle_add(self.emit, self.INTERACTION_REQUESTED,
+ GObject.idle_add(self.emit, self.INTERACTION_REQUESTED,
backend_id, description, interaction_type,
callback_str)
=== modified file 'GTG/backends/genericbackend.py'
--- GTG/backends/genericbackend.py 2013-08-17 05:31:47 +0000
+++ GTG/backends/genericbackend.py 2013-09-25 16:29:12 +0000
@@ -33,6 +33,7 @@
from GTG.core import CoreConfig
from GTG.tools.logger import Log
from GTG.tools.interruptible import _cancellation_point
+from functools import reduce
PICKLE_BACKUP_NBR = 2
@@ -261,9 +262,9 @@
if cls._general_description[cls.BACKEND_TYPE] == \
cls.TYPE_READWRITE:
for key, value in \
- cls._static_parameters_obligatory_for_rw.iteritems():
+ cls._static_parameters_obligatory_for_rw.items():
temp_dic[key] = value
- for key, value in cls._static_parameters.iteritems():
+ for key, value in cls._static_parameters.items():
temp_dic[key] = value
return temp_dic
@@ -537,7 +538,7 @@
# mkdir -p
try:
os.makedirs(os.path.dirname(path))
- except OSError, exception:
+ except OSError as exception:
if exception.errno != errno.EEXIST:
raise
=== modified file 'GTG/backends/generictomboy.py'
--- GTG/backends/generictomboy.py 2013-02-25 08:12:02 +0000
+++ GTG/backends/generictomboy.py 2013-09-25 16:29:12 +0000
@@ -121,7 +121,7 @@
while True:
try:
[key, timer] = \
- self._tomboy_setting_timers.iteritems().next()
+ next(iter(self._tomboy_setting_timers.items()))
except StopIteration:
break
timer.cancel()
@@ -411,12 +411,12 @@
try:
end_of_title = content.index('\n')
except ValueError:
- return content, unicode("")
+ return content, str("")
title = content[: end_of_title]
if len(content) > end_of_title:
return title, content[end_of_title + 1:]
else:
- return title, unicode("")
+ return title, str("")
def _populate_task(self, task, note):
'''
@@ -433,10 +433,10 @@
# update the tags list
task.set_only_these_tags(extract_tags_from_text(content))
# extract title and text
- [title, text] = self._tomboy_split_title_and_text(unicode(content))
+ [title, text] = self._tomboy_split_title_and_text(str(content))
# Tomboy speaks unicode, we don't
- title = unicodedata.normalize('NFKD', title).encode('ascii', 'ignore')
- text = unicodedata.normalize('NFKD', text).encode('ascii', 'ignore')
+ title = unicodedata.normalize('NFKD', title)
+ text = unicodedata.normalize('NFKD', text)
task.set_title(title)
task.set_text(text)
task.add_remote_id(self.get_id(), note)
@@ -462,7 +462,7 @@
# tomboy passes Dbus.String objects, which are not pickable. We convert
# those to unicode
if "remote_id" in kwargs:
- kwargs["remote_id"] = unicode(kwargs["remote_id"])
+ kwargs["remote_id"] = str(kwargs["remote_id"])
try:
self.sync_engine.break_relationship(*args, **kwargs)
# we try to save the state at each change in the sync_engine:
@@ -480,7 +480,7 @@
# tomboy passes Dbus.String objects, which are not pickable. We convert
# those to unicode
if "remote_id" in kwargs:
- kwargs["remote_id"] = unicode(kwargs["remote_id"])
+ kwargs["remote_id"] = str(kwargs["remote_id"])
self.sync_engine.record_relationship(*args, **kwargs)
# we try to save the state at each change in the sync_engine:
=== modified file 'GTG/backends/rtm/rtm.py'
--- GTG/backends/rtm/rtm.py 2013-02-25 08:12:02 +0000
+++ GTG/backends/rtm/rtm.py 2013-09-25 16:29:12 +0000
@@ -8,7 +8,7 @@
)
-import urllib
+import urllib.request, urllib.parse, urllib.error
from hashlib import md5
from GTG import _
@@ -80,7 +80,7 @@
self.authInfo = AuthStateMachine(['frob', 'token'])
# this enables one to do 'rtm.tasks.getList()', for example
- for prefix, methods in API.items():
+ for prefix, methods in list(API.items()):
setattr(self, prefix,
RTMAPICategory(self, prefix, methods))
@@ -130,7 +130,7 @@
'frob': frob
}
params['api_sig'] = self._sign(params)
- return AUTH_SERVICE_URL + '?' + urllib.urlencode(params)
+ return AUTH_SERVICE_URL + '?' + urllib.parse.urlencode(params)
def getToken(self):
frob = self.authInfo.get('frob')
@@ -178,7 +178,7 @@
# Utility functions
def sortedItems(dictionary):
"Return a list of (key, value) sorted based on keys"
- keys = dictionary.keys()
+ keys = list(dictionary.keys())
keys.sort()
for key in keys:
yield key, dictionary[key]
@@ -186,9 +186,9 @@
def openURL(url, queryArgs=None):
if queryArgs:
- url = url + '?' + urllib.urlencode(queryArgs)
+ url = url + '?' + urllib.parse.urlencode(queryArgs)
# LOG.debug("URL> %s", url)
- return urllib.urlopen(url)
+ return urllib.request.urlopen(url)
class dottedDict(object):
@@ -198,7 +198,7 @@
self._name = name
if type(dictionary) is dict:
- for key, value in dictionary.items():
+ for key, value in list(dictionary.items()):
if type(value) is dict:
value = dottedDict(key, value)
elif type(value) in (list, tuple) and key != 'tag':
@@ -396,12 +396,12 @@
rtm = createRTM(apiKey, secret, token)
rspTasks = rtm.tasks.getList(filter='dueWithin:"1 week of today"')
- print [t.name for t in rspTasks.tasks.list.taskseries]
- print rspTasks.tasks.list.id
+ print([t.name for t in rspTasks.tasks.list.taskseries])
+ print(rspTasks.tasks.list.id)
rspLists = rtm.lists.getList()
# print rspLists.lists.list
- print [(x.name, x.id) for x in rspLists.lists.list]
+ print([(x.name, x.id) for x in rspLists.lists.list])
def set_log_level(level):
=== modified file 'GTG/core/__init__.py'
--- GTG/core/__init__.py 2013-09-05 17:16:29 +0000
+++ GTG/core/__init__.py 2013-09-25 16:29:12 +0000
@@ -37,8 +37,8 @@
#=== IMPORT ===================================================================
from re import findall
+import configparser
-import ConfigParser
from xdg.BaseDirectory import xdg_data_home, xdg_config_home, xdg_data_dirs
import os
@@ -132,8 +132,8 @@
toreturn = DEFAULTS[self._section][option]
self.set(option, toreturn)
else:
- print "Warning : no default conf value for %s in %s" % (
- option, self._section)
+ print("Warning : no default conf value for %s in %s" % (
+ option, self._section))
toreturn = None
return toreturn
@@ -208,10 +208,10 @@
def check_config_file(self, path):
""" This function bypasses the errors of config file and allows GTG
to open smoothly"""
- config = ConfigParser.ConfigParser()
+ config = configparser.ConfigParser()
try:
config.read(path)
- except ConfigParser.Error:
+ except configparser.Error:
open(path, "w").close()
return config
=== modified file 'GTG/core/datastore.py'
--- GTG/core/datastore.py 2013-02-25 07:35:07 +0000
+++ GTG/core/datastore.py 2013-09-25 16:29:12 +0000
@@ -106,7 +106,6 @@
### Tags functions ########################################################
def _add_new_tag(self, name, tag, filter_func, parameters, parent_id=None):
""" Add tag into a tree """
- name = name.encode("UTF-8")
if self._tagstore.has_node(name):
raise IndexError('tag %s was already in the datastore' % name)
@@ -120,7 +119,6 @@
@returns GTG.core.tag.Tag: the new tag
"""
- name = name.encode("UTF-8")
parameters = {'tag': name}
tag = Tag(name, req=self.requester, attributes=attributes)
self._add_new_tag(name, tag, self.treefactory.tag_filter, parameters)
@@ -134,12 +132,11 @@
"""
try:
parameters = parse_search_query(query)
- except InvalidQuery, e:
+ except InvalidQuery as e:
Log.warning("Problem with parsing query '%s' (skipping): %s" %
(query, e.message))
return None
- name = name.encode("UTF-8")
# Create own copy of attributes and add special attributes label, query
init_attr = dict(attributes)
@@ -176,7 +173,7 @@
tag = self.get_tag(oldname)
if not tag.is_search_tag():
- print "Tag renaming not implemented yet"
+ print("Tag renaming not implemented yet")
return None
query = tag.get_attribute("query")
@@ -360,7 +357,7 @@
@return list: a list of TaskSource objects
"""
result = []
- for backend in self.backends.itervalues():
+ for backend in self.backends.values():
if backend.is_enabled() or disabled:
result.append(backend)
return result
@@ -437,7 +434,7 @@
return
self.is_default_backend_loaded = True
- for backend in self.backends.itervalues():
+ for backend in self.backends.values():
if backend.is_enabled() and not backend.is_default():
self._backend_startup(backend)
@@ -565,7 +562,7 @@
thread = threading.Thread(target=b.quit)
threads_dic[b.get_id()] = thread
thread.start()
- for backend_id, thread in threads_dic.iteritems():
+ for backend_id, thread in threads_dic.items():
# after 20 seconds, we give up
thread.join(20)
if thread.isAlive():
@@ -574,7 +571,7 @@
# we save the parameters
for b in self.get_all_backends(disabled=True):
t_xml = doc.createElement("backend")
- for key, value in b.get_parameters().iteritems():
+ for key, value in b.get_parameters().items():
if key in ["backend", "xmlobject"]:
# We don't want parameters, backend, xmlobject:
# we'll create them at next startup
=== modified file 'GTG/core/plugins/__init__.py'
--- GTG/core/plugins/__init__.py 2013-02-25 07:35:07 +0000
+++ GTG/core/plugins/__init__.py 2013-09-25 16:29:12 +0000
@@ -21,15 +21,10 @@
# This is the tool package. It contains some useful function and tool
# that could be useful for any part of GTG.
-import os
-
from GTG import _
class GnomeConfig:
- current_rep = os.path.dirname(os.path.abspath(__file__))
- GLADE_FILE = os.path.join(current_rep, "pluginmanager.glade")
-
CANLOAD = _("Everything necessary to run this plugin is available.")
CANNOTLOAD = _("The plugin can not be loaded")
miss1 = _("Some python modules are missing")
=== modified file 'GTG/core/plugins/api.py'
--- GTG/core/plugins/api.py 2013-02-25 07:35:07 +0000
+++ GTG/core/plugins/api.py 2013-09-25 16:29:12 +0000
@@ -121,7 +121,7 @@
"""Adds a menu entry to the Plugin Menu of the Main Window
(task browser).
- @param item: The gtk.MenuItem that is going to be added.
+ @param item: The Gtk.MenuItem that is going to be added.
"""
widget = self.__builder.get_object('plugin_mi')
widget.get_submenu().append(item)
@@ -131,7 +131,7 @@
"""Removes a menu entry from the Plugin Menu of the Main Window
(task browser).
- @param item: The gtk.MenuItem that is going to be removed.
+ @param item: The Gtk.MenuItem that is going to be removed.
@return: Returns C{True} if the operation has sucess or c{False} if it
fails.
"""
@@ -148,7 +148,7 @@
"""Adds a button to the task browser's toolbar or the task editor
toolbar, depending on which plugin api it's being used.
- @param widget: The gtk.ToolButton that is going to be added to the
+ @param widget: The Gtk.ToolButton that is going to be added to the
toolbar.
"""
#-1 means "append to the end"
@@ -160,17 +160,17 @@
"""
try:
self.__toolbar.remove(widget)
- except Exception, e:
- print "Error removing the toolbar item in the TaskEditor: %s" % e
+ except Exception as e:
+ print("Error removing the toolbar item in the TaskEditor: %s" % e)
def add_widget_to_taskeditor(self, widget):
"""Adds a widget to the bottom of the task editor dialog
- @param widget: The gtk.Widget that is going to be added.
+ @param widget: The Gtk.Widget that is going to be added.
"""
vbox = self.__builder.get_object('vbox4')
if vbox:
- vbox.pack_start(widget)
+ vbox.pack_start(widget, True, True, 0)
vbox.reorder_child(widget, -2)
widget.show_all()
self.taskwidget_id += 1
@@ -182,14 +182,14 @@
def remove_widget_from_taskeditor(self, widg_id):
"""Remove a widget from the bottom of the task editor dialog
- @param widget: The gtk.Widget that is going to be removed
+ @param widget: The Gtk.Widget that is going to be removed
"""
if self.is_editor() and widg_id:
try:
wi = self.__builder.get_object('vbox4')
if wi and widg_id in self.taskwidget_widg:
wi.remove(self.taskwidget_widg.pop(widg_id))
- except Exception, e:
+ except Exception as e:
Log.debug("Error removing the toolbar item in the TaskEditor:"
"%s" % e)
@@ -205,7 +205,7 @@
if func is None:
func = browser.tv_factory.task_bg_color
- for pane in browser.vtree_panes.itervalues():
+ for pane in browser.vtree_panes.values():
pane.set_bg_color(func, 'bg_color')
pane.basetree.get_basetree().refresh_all()
=== modified file 'GTG/core/plugins/engine.py'
--- GTG/core/plugins/engine.py 2013-08-17 06:20:51 +0000
+++ GTG/core/plugins/engine.py 2013-09-25 16:29:12 +0000
@@ -19,7 +19,7 @@
import imp
import os
import types
-import ConfigParser
+import configparser
import dbus
@@ -53,7 +53,7 @@
'module_depends': 'dependencies',
'dbus_depends': 'dbus-dependencies',
}
- for attr, field in info_fields.iteritems():
+ for attr, field in info_fields.items():
try:
setattr(self, attr, info[field])
except KeyError:
@@ -122,12 +122,12 @@
f, pathname, desc = imp.find_module(self.module_name, module_path)
module = imp.load_module(self.module_name, f, pathname, desc)
# find the class object for the actual plugin
- for key, item in module.__dict__.iteritems():
- if isinstance(item, types.ClassType):
+ for key, item in module.__dict__.items():
+ if isinstance(item, type):
self.plugin_class = item
self.class_name = item.__dict__['__module__'].split('.')[1]
break
- except ImportError, e:
+ except ImportError as e:
# load_module() failed, probably because of a module dependency
if len(self.module_depends) > 0:
self._check_module_depends()
@@ -135,7 +135,7 @@
# no dependencies in info file; use the ImportError instead
self.missing_modules.append(str(e).split(" ")[3])
self.error = True
- except Exception, e:
+ except Exception as e:
# load_module() failed for some other reason
Log.error(e)
self.error = True
@@ -169,9 +169,9 @@
for f in os.listdir(path):
info_file = os.path.join(path, f)
if os.path.isfile(info_file) and f.endswith('.gtg-plugin'):
- info = ConfigParser.ConfigParser()
+ info = configparser.ConfigParser()
info.read(info_file)
- info = dict(info.items("GTG Plugin"))
+ info = dict(info.items("GTG Plugin", True))
p = Plugin(info, self.plugin_path)
self.plugins[p.module_name] = p
@@ -188,7 +188,7 @@
"disabled",
"all"
"""
- all_plugins = self.plugins.itervalues()
+ all_plugins = iter(self.plugins.values())
if kind_of_plugins == "all":
return all_plugins
@@ -197,7 +197,7 @@
(kind_of_plugins == "inactive" and not plugin.active) or
(kind_of_plugins == "enabled" and plugin.enabled) or
(kind_of_plugins == "disabled" and not plugin.enabled))
- return filter(filter_fun, all_plugins)
+ return list(filter(filter_fun, all_plugins))
def register_api(self, api):
'''Adds a plugin api to the list of currently loaded apis'''
@@ -285,8 +285,8 @@
plugin.enabled = False
else:
self.activate_plguins(self.plugin_apis, [plugin])
- except Exception, e:
- print "Error: %s" % e
+ except Exception as e:
+ print("Error: %s" % e)
def recheck_plugin_errors(self, check_all=False):
"""Attempt a reload of plugins with errors, or all plugins."""
=== modified file 'GTG/core/requester.py'
--- GTG/core/requester.py 2013-02-25 07:35:07 +0000
+++ GTG/core/requester.py 2013-09-25 16:29:12 +0000
@@ -21,13 +21,13 @@
A nice general purpose interface for the datastore and tagstore
"""
-import gobject
+from gi.repository import GObject
from GTG.core.tag import Tag
from GTG.tools.logger import Log
-class Requester(gobject.GObject):
+class Requester(GObject.GObject):
""" A view on a GTG datastore.
L{Requester} is a stateless object that simply provides a nice API for
@@ -39,7 +39,7 @@
def __init__(self, datastore, global_conf):
"""Construct a L{Requester}."""
- gobject.GObject.__init__(self)
+ GObject.GObject.__init__(self)
self.ds = datastore
self.__config = global_conf
self.__basetree = self.ds.get_tasks_tree()
@@ -198,7 +198,7 @@
tagstore = self.ds.get_tagstore()
view = tagstore.get_viewtree(name='tag_completion', refresh=False)
tags = view.get_all_nodes()
- tags.sort(cmp=lambda x, y: cmp(x.lower(), y.lower()))
+ tags.sort(key=str.lower)
return tags
def get_all_tags(self):
=== modified file 'GTG/core/tag.py'
--- GTG/core/tag.py 2013-02-25 07:35:07 +0000
+++ GTG/core/tag.py 2013-09-25 16:29:12 +0000
@@ -28,6 +28,7 @@
from GTG.core import CoreConfig
from liblarch import TreeNode
+from functools import reduce
class Tag(TreeNode):
@@ -54,7 +55,7 @@
self.req = req
self._save = None
self._attributes = {'name': self._name}
- for key, value in attributes.iteritems():
+ for key, value in attributes.items():
self.set_attribute(key, value)
self.viewcount = None
@@ -126,7 +127,7 @@
modified = True
else:
# Attributes should all be strings.
- val = unicode(str(att_value), "UTF-8")
+ val = str(att_value)
self._attributes[att_name] = val
if self._save:
self._save()
@@ -174,7 +175,7 @@
names.
@param withparent: If True, the "parent" attribute is attached
"""
- attributes = self._attributes.keys()
+ attributes = list(self._attributes.keys())
if butname:
attributes.remove('name')
if withparent:
=== modified file 'GTG/core/task.py'
--- GTG/core/task.py 2013-07-03 03:35:35 +0000
+++ GTG/core/task.py 2013-09-25 16:29:12 +0000
@@ -47,7 +47,7 @@
TreeNode.__init__(self, ze_id)
# the id of this task in the project should be set
# tid is a string ! (we have to choose a type and stick to it)
- assert(isinstance(ze_id, str) or isinstance(ze_id, unicode))
+ assert(isinstance(ze_id, str) or isinstance(ze_id, str))
self.tid = str(ze_id)
self.set_uuid(uuid.uuid4())
self.remote_ids = {}
@@ -128,8 +128,6 @@
# We should check for other task with the same title
# In that case, we should add a number (like Tomboy does)
old_title = self.title
- if isinstance(title, str):
- title = title.decode('utf8')
if title:
self.title = title.strip('\t\n')
else:
@@ -360,7 +358,8 @@
return self.due_date
def get_urgent_date(self):
- """Returns the most urgent due date among the task and it's subtasks"""
+ """ Returns the most urgent due date among the tasks and its subtasks
+ """
urg_date = self.due_date
for sub in self.get_subtasks():
sub_urg_date = sub.get_urgent_date()
@@ -568,7 +567,7 @@
# (Lionel)
# Agreed. it's only used by the "add tag to all subtasks" widget.
def get_self_and_all_subtasks(self, active_only=False, tasks=[]):
- print "DEPRECATED FUNCTION: get_self_and_all_subtasks"
+ print("DEPRECATED FUNCTION: get_self_and_all_subtasks")
tasks.append(self)
for tid in self.get_children():
i = self.req.get_task(tid)
@@ -579,7 +578,7 @@
def get_subtask(self, tid):
# FIXME : remove this function. This is not useful
- print "DEPRECATED: get_subtask"
+ print("DEPRECATED: get_subtask")
"""Return the task corresponding to a given ID.
@param tid: the ID of the task to return.
@@ -605,7 +604,7 @@
@param att_value: The value of the attribute. Will be converted to a
string.
"""
- val = unicode(str(att_value), "UTF-8")
+ val = str(att_value)
self.attributes[(namespace, att_name)] = val
self.sync()
@@ -662,18 +661,17 @@
"""
Adds a tag. Does not add '@tag' to the contents. See add_tag
"""
- t = tagname.encode("UTF-8")
# Do not add the same tag twice
- if not t in self.tags:
- self.tags.append(t)
+ if not tagname in self.tags:
+ self.tags.append(tagname)
if self.is_loaded():
for child in self.get_subtasks():
if child.can_be_deleted:
- child.add_tag(t)
+ child.add_tag(tagname)
- tag = self.req.get_tag(t)
+ tag = self.req.get_tag(tagname)
if not tag:
- tag = self.req.new_tag(t)
+ tag = self.req.new_tag(tagname)
tag.modified()
return True
=== modified file 'GTG/gtg.py'
--- GTG/gtg.py 2013-02-25 07:35:07 +0000
+++ GTG/gtg.py 2013-09-25 16:29:12 +0000
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Getting Things GNOME! - a personal organizer for the GNOME desktop
@@ -74,7 +74,7 @@
pidfile = os.path.join(directory, "gtg.pid")
if not os.path.exists(pidfile):
open(pidfile, "w").close()
- os.chmod(pidfile, 0600)
+ os.chmod(pidfile, 0o600)
# see if gtg is already running
pid = open(pidfile, "r").readline()
@@ -82,7 +82,7 @@
p = os.system("/bin/ps %s >/dev/null" % pid)
p_name = os.popen("/bin/ps -f %s" % pid).read()
if p == 0 and "gtg" in p_name:
- print _("gtg is already running!")
+ print(_("gtg is already running!"))
try:
d = dbus.SessionBus().get_object(CoreConfig.BUSNAME,
CoreConfig.BUSINTERFACE)
=== modified file 'GTG/gtk/__init__.py'
--- GTG/gtk/__init__.py 2012-11-25 19:19:44 +0000
+++ GTG/gtk/__init__.py 2013-09-25 16:29:12 +0000
@@ -17,14 +17,14 @@
# this program. If not, see <http://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------------
-""" Configuration for browser, it contains path to .glade files """
+""" Configuration for browser, it contains path to .ui files """
import os
-class ViewConfig:
+class ViewConfig(object):
current_rep = os.path.dirname(os.path.abspath(__file__))
- DELETE_GLADE_FILE = os.path.join(current_rep, "deletion.glade")
- PREFERENCES_GLADE_FILE = os.path.join(current_rep, "preferences.glade")
- PLUGINS_GLADE_FILE = os.path.join(current_rep, "plugins.glade")
- BACKENDS_GLADE_FILE = os.path.join(current_rep, "backends_dialog.glade")
+ DELETE_UI_FILE = os.path.join(current_rep, "deletion.ui")
+ PREFERENCES_UI_FILE = os.path.join(current_rep, "preferences.ui")
+ PLUGINS_UI_FILE = os.path.join(current_rep, "plugins.ui")
+ BACKENDS_UI_FILE = os.path.join(current_rep, "backends_dialog.ui")
=== 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 2013-09-25 16:29:12 +0000
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <requires lib="gtk+" version="2.16"/>
- <!-- interface-naming-policy project-wide -->
+ <!-- interface-requires gtk+ 3.0 -->
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">100</property>
<property name="step_increment">1</property>
@@ -11,7 +10,7 @@
<object class="GtkWindow" id="backends_dialog">
<property name="can_focus">False</property>
<property name="window_position">mouse</property>
- <signal name="delete-event" handler="on_BackendsDialog_delete_event" swapped="no"/>
+ <signal name="delete_event" handler="on_BackendsDialog_delete_event"/>
<child>
<object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
@@ -21,19 +20,21 @@
<property name="left_padding">10</property>
<property name="right_padding">10</property>
<child>
- <object class="GtkVBox" id="vbox1">
+ <object class="GtkBox" id="vbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">10</property>
+ <property name="orientation">vertical</property>
<child>
- <object class="GtkHBox" id="big_central_hbox">
+ <object class="GtkBox" id="big_central_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">10</property>
<child>
- <object class="GtkVBox" id="vbox2">
+ <object class="GtkBox" id="vbox2">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
<child>
<object class="GtkViewport" id="treeview_window">
<property name="height_request">400</property>
@@ -60,7 +61,7 @@
<property name="left_padding">10</property>
<property name="right_padding">10</property>
<child>
- <object class="GtkHButtonBox" id="hbuttonbox3">
+ <object class="GtkButtonBox" id="hbuttonbox3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">10</property>
@@ -145,7 +146,7 @@
</packing>
</child>
<child>
- <object class="GtkHButtonBox" id="hbuttonbox2">
+ <object class="GtkButtonBox" id="hbuttonbox2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">edge</property>
=== modified file 'GTG/gtk/backends_dialog/__init__.py'
--- GTG/gtk/backends_dialog/__init__.py 2013-02-25 08:29:31 +0000
+++ GTG/gtk/backends_dialog/__init__.py 2013-09-25 16:29:12 +0000
@@ -26,7 +26,7 @@
panel (these are called also "views" in this class)
'''
-import gtk
+from gi.repository import Gtk
from webbrowser import open as openurl
@@ -68,9 +68,8 @@
self.backends_tv = None
self.config_panel = None
self.add_panel = None
- # Load from Glade
- builder = gtk.Builder()
- self._load_widgets_from_glade(builder)
+ builder = Gtk.Builder()
+ self._load_widgets_from_builder(builder)
# Load and setup other widgets
self.dialog.set_title(_("Synchronization Services - %s" % info.NAME))
self._create_widgets_for_add_panel()
@@ -119,14 +118,14 @@
@param height: the height of the returned pixbuf
@param width: the width of the returned pixbuf
- @returns gtk.gdk.Pixbuf: a pixbuf containing the wanted icon, or None
+ @returns GdkPixbuf: a pixbuf containing the wanted icon, or None
(if the icon is not present)
'''
icon_info = self.icon_theme.lookup_icon(name, height, 0)
if icon_info is None:
return None
else:
- return gtk.icon_theme_get_default().load_icon(name, height, 0)
+ return Gtk.IconTheme.get_default().load_icon(name, height, 0)
def _show_panel(self, panel_name):
'''
@@ -147,7 +146,7 @@
Log.error("panel name unknown")
return
# Central pane
- # NOTE: self.central_pane is the gtk.Container in which we load panels
+ # NOTE: self.central_pane is the Gtk.Container in which we load panels
if panel_to_remove in self.central_pane:
self.central_pane.remove(panel_to_remove)
if not panel_to_add in self.central_pane:
@@ -167,13 +166,13 @@
########################################
### WIDGETS AND SIGNALS ################
########################################
- def _load_widgets_from_glade(self, builder):
+ def _load_widgets_from_builder(self, builder):
'''
- Loads widgets from the glade file
+ Loads widgets from the builder .ui file
- @param builder: a gtk.Builder
+ @param builder: a Gtk.Builder
'''
- builder.add_from_file(ViewConfig.BACKENDS_GLADE_FILE)
+ builder.add_from_file(ViewConfig.BACKENDS_UI_FILE)
widgets = {
'dialog': 'backends_dialog',
'treeview_window': 'treeview_window',
@@ -181,14 +180,14 @@
'add_button': 'add_button',
'remove_button': 'remove_button',
}
- for attr, widget in widgets.iteritems():
+ for attr, widget in widgets.items():
setattr(self, attr, builder.get_object(widget))
def _setup_signal_connections(self, builder):
'''
Creates some GTK signals connections
- @param builder: a gtk.Builder
+ @param builder: a Gtk.Builder
'''
signals = {
'on_add_button_clicked': self.on_add_button,
@@ -205,7 +204,7 @@
Inform gtk on the location of the backends icons (which is in
the GTG directory tree, and not in the default location for icons
'''
- self.icon_theme = gtk.icon_theme_get_default()
+ self.icon_theme = Gtk.IconTheme.get_default()
for directory in CoreConfig().get_icons_directories():
self.icon_theme.prepend_search_path(directory)
@@ -285,17 +284,17 @@
# no backend selected
return
backend = self.req.get_backend(backend_id)
- dialog = gtk.MessageDialog(
+ dialog = Gtk.MessageDialog(
parent=self.dialog,
- flags=gtk.DIALOG_DESTROY_WITH_PARENT,
- type=gtk.MESSAGE_QUESTION,
- buttons=gtk.BUTTONS_YES_NO,
+ flags=Gtk.DialogFlags.DESTROY_WITH_PARENT,
+ type=Gtk.MessageType.QUESTION,
+ buttons=Gtk.ButtonsType.YES_NO,
message_format=_("Do you really want to remove the '%s' "
"synchronization service?") %
backend.get_human_name())
response = dialog.run()
dialog.destroy()
- if response == gtk.RESPONSE_YES:
+ if response == Gtk.ResponseType.YES:
# delete the backend and remove it from the lateral treeview
self.req.remove_backend(backend_id)
self.backends_tv.remove_backend(backend_id)
=== modified file 'GTG/gtk/backends_dialog/addpanel.py'
--- GTG/gtk/backends_dialog/addpanel.py 2013-02-25 08:12:02 +0000
+++ GTG/gtk/backends_dialog/addpanel.py 2013-09-25 16:29:12 +0000
@@ -17,16 +17,18 @@
# this program. If not, see <http://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------------
-import gtk
+from gi.repository import Gtk
from GTG.gtk.backends_dialog.backendscombo import BackendsCombo
from GTG.backends import BackendFactory
from GTG import _, ngettext
-
-
-class AddPanel(gtk.VBox):
+from functools import reduce
+
+
+class AddPanel(Gtk.Box):
'''
- A VBox filled with gtk widgets to let the user choose a new backend.
+ A vertical Box filled with gtk widgets to let the user choose a new
+ backend.
'''
def __init__(self, backends_dialog):
@@ -36,7 +38,7 @@
@param backends_dialog: a reference to the dialog in which this is
loaded
'''
- super(AddPanel, self).__init__()
+ super(AddPanel, self).__init__(orientation=Gtk.Orientation.VERTICAL)
self.dialog = backends_dialog
self._create_widgets()
@@ -46,90 +48,90 @@
'''
# Division of the available space in three segments:
# top, middle and bottom.
- top = gtk.HBox()
+ top = Gtk.Box()
top.set_spacing(6)
- middle = gtk.HBox()
- bottom = gtk.HBox()
- self._fill_top_hbox(top)
- self._fill_middle_hbox(middle)
- self._fill_bottom_hbox(bottom)
- self.pack_start(top, False)
- self.pack_start(middle, True)
- self.pack_start(bottom, True)
+ middle = Gtk.Box()
+ bottom = Gtk.Box()
+ self._fill_top_box(top)
+ self._fill_middle_box(middle)
+ self._fill_bottom_box(bottom)
+ self.pack_start(top, False, True, 0)
+ self.pack_start(middle, True, True, 0)
+ self.pack_start(bottom, True, True, 0)
self.set_border_width(12)
- def _fill_top_hbox(self, hbox):
+ def _fill_top_box(self, box):
'''
- Helper function to fill and hbox with a combobox that lists the
- available backends and a gtk.Label.
+ Helper function to fill and box with a combobox that lists the
+ available backends and a Gtk.Label.
- @param hbox: the gtk.HBox to fill
+ @param box: the Gtk.Box to fill
'''
- label = gtk.Label(_("Select synchronization service:"))
+ label = Gtk.Label(label=_("Select synchronization service:"))
label.set_alignment(0, 0.5)
self.combo_types = BackendsCombo(self.dialog)
- self.combo_types.child.connect('changed', self.on_combo_changed)
- hbox.pack_start(label, False, True)
- hbox.pack_start(self.combo_types, False, True)
-
- def _fill_middle_hbox(self, hbox):
- '''
- Helper function to fill an hbox with a label describing the backend
- and a gtk.Image (that loads the backend image)
-
- @param hbox: the gtk.HBox to fill
- '''
- self.label_name = gtk.Label("name")
+ #FIXME
+ #self.combo_types.get_child().connect('changed', self.on_combo_changed)
+ self.combo_types.connect('changed', self.on_combo_changed)
+ box.pack_start(label, False, True, 0)
+ box.pack_start(self.combo_types, False, True, 0)
+
+ def _fill_middle_box(self, box):
+ '''
+ Helper function to fill an box with a label describing the backend
+ and a Gtk.Image (that loads the backend image)
+
+ @param box: the Gtk.Box to fill
+ '''
+ self.label_name = Gtk.Label(label="name")
self.label_name.set_alignment(xalign=0.5, yalign=1)
- self.label_description = gtk.Label()
- self.label_description.set_justify(gtk.JUSTIFY_FILL)
+ self.label_description = Gtk.Label()
+ self.label_description.set_justify(Gtk.Justification.FILL)
self.label_description.set_line_wrap(True)
self.label_description.set_size_request(300, -1)
self.label_description.set_alignment(xalign=0, yalign=0.5)
- self.label_author = gtk.Label("")
+ self.label_author = Gtk.Label(label="")
self.label_author.set_line_wrap(True)
self.label_author.set_alignment(xalign=0, yalign=0)
- self.label_modules = gtk.Label("")
+ self.label_modules = Gtk.Label(label="")
self.label_modules.set_line_wrap(True)
self.label_modules.set_alignment(xalign=0, yalign=0)
- self.image_icon = gtk.Image()
+ self.image_icon = Gtk.Image()
self.image_icon.set_size_request(128, 128)
- align_image = gtk.Alignment(xalign=1, yalign=0)
+ align_image = Gtk.Alignment.new(1, 0, 0, 0)
align_image.add(self.image_icon)
- labels_vbox = gtk.VBox()
- labels_vbox.pack_start(self.label_description, True, True, padding=10)
- labels_vbox.pack_start(self.label_author, True, True)
- labels_vbox.pack_start(self.label_modules, True, True)
- low_hbox = gtk.HBox()
- low_hbox.pack_start(labels_vbox, True, True)
- low_hbox.pack_start(align_image, True, True)
- vbox = gtk.VBox()
- vbox.pack_start(self.label_name, True, True)
- vbox.pack_start(low_hbox, True, True)
- hbox.pack_start(vbox, True, True)
+ labels_vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
+ labels_vbox.pack_start(self.label_description, True, True, 10)
+ labels_vbox.pack_start(self.label_author, True, True, 0)
+ labels_vbox.pack_start(self.label_modules, True, True, 0)
+ low_box = Gtk.Box()
+ low_box.pack_start(labels_vbox, True, True, 0)
+ low_box.pack_start(align_image, True, True, 0)
+ vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
+ vbox.pack_start(self.label_name, True, True, 0)
+ vbox.pack_start(low_box, True, True, 0)
+ box.pack_start(vbox, True, True, 0)
- def _fill_bottom_hbox(self, hbox):
+ def _fill_bottom_box(self, box):
'''
- Helper function to fill and hbox with a buttonbox, featuring
+ Helper function to fill and box with a buttonbox, featuring
and ok and cancel buttons.
- @param hbox: the gtk.HBox to fill
+ @param box: the Gtk.Box to fill
'''
- cancel_button = gtk.Button(stock=gtk.STOCK_CANCEL)
+ cancel_button = Gtk.Button(stock=Gtk.STOCK_CANCEL)
cancel_button.connect('clicked', self.on_cancel)
- self.ok_button = gtk.Button(stock=gtk.STOCK_OK)
+ self.ok_button = Gtk.Button(stock=Gtk.STOCK_OK)
self.ok_button.connect('clicked', self.on_confirm)
- align = gtk.Alignment(xalign=0.5,
- yalign=1,
- xscale=1)
+ align = Gtk.Alignment.new(0.5, 1, 1, 0)
align.set_padding(0, 10, 0, 0)
- buttonbox = gtk.HButtonBox()
- buttonbox.set_layout(gtk.BUTTONBOX_EDGE)
+ buttonbox = Gtk.ButtonBox()
+ buttonbox.set_layout(Gtk.ButtonBoxStyle.EDGE)
buttonbox.add(cancel_button)
buttonbox.set_child_secondary(cancel_button, False)
buttonbox.add(self.ok_button)
align.add(buttonbox)
- hbox.pack_start(align, True, True)
+ box.pack_start(align, True, True, 0)
def refresh_backends(self):
'''Populates the combo box containing the available backends'''
@@ -137,7 +139,7 @@
def on_confirm(self, widget=None):
'''
- Notifies the dialog holding this VBox that a backend has been
+ Notifies the dialog holding this Box that a backend has been
chosen
@param widget: just to make this function usable as a signal callback.
=== modified file 'GTG/gtk/backends_dialog/backendscombo.py'
--- GTG/gtk/backends_dialog/backendscombo.py 2013-02-25 07:35:07 +0000
+++ GTG/gtk/backends_dialog/backendscombo.py 2013-09-25 16:29:12 +0000
@@ -17,12 +17,13 @@
# this program. If not, see <http://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------------
-import gtk
+from gi.repository import Gtk
+from gi.repository import GdkPixbuf
from GTG.backends import BackendFactory
-class BackendsCombo(gtk.ComboBoxEntry):
+class BackendsCombo(Gtk.ComboBox):
'''
A combobox listing all the available backends types
'''
@@ -39,7 +40,7 @@
@param backends_dialog: reference to the dialog in which this combo is
loaded.
'''
- super(BackendsCombo, self).__init__()
+ Gtk.ComboBox.__init__(self)
self.dialog = backends_dialog
self._liststore_init()
self._renderers_init()
@@ -47,18 +48,18 @@
self.show_all()
def _liststore_init(self):
- '''Setup the gtk.ListStore'''
- self.liststore = gtk.ListStore(str, str, gtk.gdk.Pixbuf)
+ '''Setup the Gtk.ListStore'''
+ self.liststore = Gtk.ListStore(str, str, GdkPixbuf.Pixbuf)
self.set_model(self.liststore)
def _renderers_init(self):
'''Configure the cell renderers'''
# Text renderer
- text_cell = gtk.CellRendererText()
+ text_cell = Gtk.CellRendererText()
self.pack_start(text_cell, False)
- self.set_text_column(self.COLUMN_HUMAN_NAME)
+ self.add_attribute(text_cell, 'text', 1)
# Icon renderer
- pixbuf_cell = gtk.CellRendererPixbuf()
+ pixbuf_cell = Gtk.CellRendererPixbuf()
self.pack_start(pixbuf_cell, False)
self.add_attribute(pixbuf_cell, "pixbuf", self.COLUMN_ICON)
@@ -68,7 +69,7 @@
'''
self.liststore.clear()
backend_types = BackendFactory().get_all_backends()
- for name, module in backend_types.iteritems():
+ for name, module in backend_types.items():
# FIXME: Disable adding another localfile backend.
# It just produce many warnings, provides no use case
# See LP bug #940917 (Izidor)
=== modified file 'GTG/gtk/backends_dialog/backendstree.py'
--- GTG/gtk/backends_dialog/backendstree.py 2013-02-25 07:35:07 +0000
+++ GTG/gtk/backends_dialog/backendstree.py 2013-09-25 16:29:12 +0000
@@ -17,16 +17,17 @@
# this program. If not, see <http://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------------
-import gtk
+from gi.repository import Gtk
+from gi.repository import GdkPixbuf
from GTG.gtk.colors import get_colored_tags_markup
from GTG.backends.genericbackend import GenericBackend
from GTG.backends.backendsignals import BackendSignals
-class BackendsTree(gtk.TreeView):
+class BackendsTree(Gtk.TreeView):
'''
- gtk.TreeView that shows the currently loaded backends.
+ Gtk.TreeView that shows the currently loaded backends.
'''
COLUMN_BACKEND_ID = 0 # never shown, used for internal lookup.
@@ -50,7 +51,7 @@
self.refresh()
def refresh(self):
- '''refreshes the gtk.Liststore'''
+ '''refreshes the Gtk.Liststore'''
self.backendid_to_iter = {}
self.liststore.clear()
@@ -110,7 +111,6 @@
@param backend_id: the id of the backend to add
'''
if backend_id in self.backendid_to_iter:
- style = self.get_style()
b_iter = self.backendid_to_iter[backend_id]
b_path = self.liststore.get_path(b_iter)
backend = self.req.get_backend(backend_id)
@@ -118,7 +118,12 @@
if backend.is_enabled():
text = backend_name
else:
- color = str(style.text[gtk.STATE_INSENSITIVE])
+ #FIXME This snippet is on more than 2 places!!!
+ #FIXME create a function which takes a widget and
+ #flag and returns color as #RRGGBB
+ style_context = self.get_style_context()
+ color = style_context.get_color(Gtk.StateFlags.INSENSITIVE)
+ color = color.to_color().to_string()
text = "<span color='%s'>%s</span>" % \
(color, backend_name)
self.liststore[b_path][self.COLUMN_TEXT] = text
@@ -153,7 +158,7 @@
def _init_liststore(self):
'''Creates the liststore'''
- self.liststore = gtk.ListStore(object, gtk.gdk.Pixbuf, str, str)
+ self.liststore = Gtk.ListStore(object, GdkPixbuf.Pixbuf, str, str)
self.set_model(self.liststore)
def _init_renderers(self):
@@ -161,29 +166,29 @@
# We hide the columns headers
self.set_headers_visible(False)
# For the backend icon
- pixbuf_cell = gtk.CellRendererPixbuf()
- tvcolumn_pixbuf = gtk.TreeViewColumn('Icon', pixbuf_cell)
+ pixbuf_cell = Gtk.CellRendererPixbuf()
+ tvcolumn_pixbuf = Gtk.TreeViewColumn('Icon', pixbuf_cell)
tvcolumn_pixbuf.add_attribute(pixbuf_cell, 'pixbuf', self.COLUMN_ICON)
self.append_column(tvcolumn_pixbuf)
# For the backend name
- text_cell = gtk.CellRendererText()
- tvcolumn_text = gtk.TreeViewColumn('Name', text_cell)
+ text_cell = Gtk.CellRendererText()
+ tvcolumn_text = Gtk.TreeViewColumn('Name', text_cell)
tvcolumn_text.add_attribute(text_cell, 'markup', self.COLUMN_TEXT)
self.append_column(tvcolumn_text)
text_cell.connect('edited', self.cell_edited_callback)
text_cell.set_property('editable', True)
# For the backend tags
- tags_cell = gtk.CellRendererText()
- tvcolumn_tags = gtk.TreeViewColumn('Tags', tags_cell)
+ tags_cell = Gtk.CellRendererText()
+ tvcolumn_tags = Gtk.TreeViewColumn('Tags', tags_cell)
tvcolumn_tags.add_attribute(tags_cell, 'markup', self.COLUMN_TAGS)
self.append_column(tvcolumn_tags)
def cell_edited_callback(self, text_cell, path, new_text):
'''If a backend name is changed, it saves the changes in the Backend
- @param text_cell: not used. The gtk.CellRendererText that emitted the
+ @param text_cell: not used. The Gtk.CellRendererText that emitted the
signal. Only here because it's passed by the signal
- @param path: the gtk.TreePath of the edited cell
+ @param path: the Gtk.TreePath of the edited cell
@param new_text: the new name of the backend
'''
# we strip everything not permitted in backend names
@@ -218,7 +223,7 @@
'''
Helper function to get the selected path
- @return gtk.TreePath : returns exactly one path for the selected object
+ @return Gtk.TreePath : returns exactly one path for the selected object
or None
'''
selection = self.get_selection()
=== modified file 'GTG/gtk/backends_dialog/configurepanel.py'
--- GTG/gtk/backends_dialog/configurepanel.py 2013-02-25 08:12:02 +0000
+++ GTG/gtk/backends_dialog/configurepanel.py 2013-09-25 16:29:12 +0000
@@ -17,16 +17,16 @@
# this program. If not, see <http://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------------
-import gtk
+from gi.repository import Gtk
from GTG import _
from GTG.gtk.backends_dialog.parameters_ui import ParametersUI
from GTG.backends.backendsignals import BackendSignals
-class ConfigurePanel(gtk.VBox):
+class ConfigurePanel(Gtk.Box):
'''
- A VBox that lets you configure a backend
+ A vertical Box that lets you configure a backend
'''
def __init__(self, backends_dialog):
@@ -36,7 +36,8 @@
@param backends_dialog: a reference to the dialog in which this is
loaded
'''
- super(ConfigurePanel, self).__init__()
+ super(ConfigurePanel, self).__init__(
+ orientation=Gtk.Orientation.VERTICAL)
self.dialog = backends_dialog
self.should_spinner_be_shown = False
self.task_deleted_handle = None
@@ -56,61 +57,61 @@
def _create_widgets(self):
'''
- This function fills this Vbox with widgets
+ This function fills this box with widgets
'''
# Division of the available space in three segments:
# top, middle and bottom
- top = gtk.HBox()
- middle = gtk.HBox()
- self._fill_top_hbox(top)
- self._fill_middle_hbox(middle)
- self.pack_start(top, False)
- self.pack_start(middle, False)
- align = gtk.Alignment(xalign=0, yalign=0, xscale=1)
+ top = Gtk.Box()
+ middle = Gtk.Box()
+ self._fill_top_box(top)
+ self._fill_middle_box(middle)
+ self.pack_start(top, False, True, 0)
+ self.pack_start(middle, False, True, 0)
+ align = Gtk.Alignment.new(0, 0, 1, 0)
align.set_padding(10, 0, 0, 0)
self.parameters_ui = ParametersUI(self.req)
align.add(self.parameters_ui)
- self.pack_start(align, False)
+ self.pack_start(align, False, True, 0)
- def _fill_top_hbox(self, hbox):
+ def _fill_top_box(self, box):
""" Fill header with service's icon, name, and a spinner
for inidcation of work.
-
- @param hbox: the gtk.HBox to fill
"""
- self.image_icon = gtk.Image()
+ box.set_spacing(10)
+ self.image_icon = Gtk.Image()
self.image_icon.set_size_request(48, 48)
- self.human_name_label = gtk.Label()
+ self.human_name_label = Gtk.Label()
self.human_name_label.set_alignment(xalign=0, yalign=0.5)
+ #FIXME in the newer versions of GTK3 there always be Spinner!
try:
- self.spinner = gtk.Spinner()
+ self.spinner = Gtk.Spinner()
except AttributeError:
# worarkound for archlinux: bug #624204
- self.spinner = gtk.HBox()
+ self.spinner = Gtk.Box()
self.spinner.connect("show", self.on_spinner_show)
self.spinner.set_size_request(32, 32)
- align_spin = gtk.Alignment(xalign=1, yalign=0)
+ align_spin = Gtk.Alignment.new(1, 0, 0, 0)
align_spin.add(self.spinner)
- hbox.set_spacing(10)
- hbox.pack_start(self.image_icon, False)
- hbox.pack_start(self.human_name_label, True)
- hbox.pack_start(align_spin, False)
-
- def _fill_middle_hbox(self, hbox):
- '''
- Helper function to fill an hbox with a label and a button
-
- @param hbox: the gtk.HBox to fill
- '''
- self.sync_status_label = gtk.Label()
+ box.set_spacing(10)
+ box.pack_start(self.image_icon, False, True, 0)
+ box.pack_start(self.human_name_label, True, True, 0)
+ box.pack_start(align_spin, False, True, 0)
+
+ def _fill_middle_box(self, box):
+ '''
+ Helper function to fill an box with a label and a button
+
+ @param box: the Gtk.Box to fill
+ '''
+ self.sync_status_label = Gtk.Label()
self.sync_status_label.set_alignment(xalign=0.8, yalign=0.5)
- self.sync_button = gtk.Button()
+ self.sync_button = Gtk.Button()
self.sync_button.connect("clicked", self.on_sync_button_clicked)
- hbox.pack_start(self.sync_status_label, True)
- hbox.pack_start(self.sync_button, True)
+ box.pack_start(self.sync_status_label, True, True, 0)
+ box.pack_start(self.sync_button, True, True, 0)
def set_backend(self, backend_id):
'''Changes the backend to configure, refreshing this view.
@@ -149,7 +150,7 @@
def refresh_sync_status_label(self):
'''
- Refreshes the gtk.Label that shows the current state of this backend
+ Refreshes the Gtk.Label that shows the current state of this backend
'''
if self.backend.is_default():
label = _("This is the default synchronization service")
@@ -183,7 +184,7 @@
def on_sync_started(self, sender, backend_id):
'''
If the backend has started syncing tasks, update the state of the
- gtk.Spinner
+ Gtk.Spinner
@param sender: not used, here only for signal callback compatibility
@param backend_id: the id of the backend that emitted this signal
@@ -194,7 +195,7 @@
def on_sync_ended(self, sender, backend_id):
'''
If the backend has stopped syncing tasks, update the state of the
- gtk.Spinner
+ Gtk.Spinner
@param sender: not used, here only for signal callback compatibility
@param backend_id: the id of the backend that emitted this signal
@@ -216,17 +217,17 @@
def spinner_set_active(self, active):
'''
- Enables/disables the gtk.Spinner, while showing/hiding it at the same
+ Enables/disables the Gtk.Spinner, while showing/hiding it at the same
time
@param active: True if the spinner should spin
'''
self.should_spinner_be_shown = active
if active:
- if isinstance(self.spinner, gtk.Spinner):
+ if isinstance(self.spinner, Gtk.Spinner):
self.spinner.start()
self.spinner.show()
else:
self.spinner.hide()
- if isinstance(self.spinner, gtk.Spinner):
+ if isinstance(self.spinner, Gtk.Spinner):
self.spinner.stop()
=== modified file 'GTG/gtk/backends_dialog/parameters_ui/__init__.py'
--- GTG/gtk/backends_dialog/parameters_ui/__init__.py 2013-06-02 08:12:42 +0000
+++ GTG/gtk/backends_dialog/parameters_ui/__init__.py 2013-09-25 16:29:12 +0000
@@ -24,7 +24,7 @@
server and client
'''
-import gtk
+from gi.repository import Gtk
import functools
from GTG import _
@@ -37,9 +37,10 @@
from GTG.gtk.backends_dialog.parameters_ui.pathui import PathUI
-class ParametersUI(gtk.VBox):
+class ParametersUI(Gtk.Box):
'''
- Given a bakcend, this gtk.VBox populates itself with all the necessary
+ Given a bakcend, this vertical Gtk.Box populates itself with all the
+ necessary
widgets to view and edit a backend configuration
'''
@@ -50,7 +51,8 @@
@param requester: a GTG.core.requester.Requester object
'''
- super(ParametersUI, self).__init__(False)
+ super(ParametersUI, self).__init__(
+ False, orientation=Gtk.Orientation.VERTICAL)
self.req = requester
self.set_spacing(10)
@@ -98,7 +100,7 @@
})),
("tag-with-project-name", self.UI_generator(CheckBoxUI, {
"text": _("Tag your GTG tasks with the project "
- "targeted by the bug"),
+ "targeted by the bug"),
"parameter": "tag-with-project-name",
})),
)
@@ -127,9 +129,9 @@
@param backend: the backend that is being configured
'''
# remove the old parameters UIs
- def _remove_child(self, child):
+ def _remove_child(self, child, data=None):
self.remove(child)
- self.foreach(functools.partial(_remove_child, self))
+ self.foreach(functools.partial(_remove_child, self), None)
# add new widgets
backend_parameters = backend.get_parameters()
if backend_parameters[GenericBackend.KEY_DEFAULT_BACKEND]:
@@ -137,7 +139,8 @@
return
for parameter_name, widget in self.parameter_widgets:
if parameter_name in backend_parameters:
- self.pack_start(widget(backend), True)
+ #FIXME I am not 100% about this change
+ self.pack_start(widget(backend), True, True, 0)
self.show_all()
def commit_changes(self):
@@ -146,6 +149,6 @@
modified them)
'''
- def _commit_changes(child):
+ def _commit_changes(child, data=None):
child.commit_changes()
- self.foreach(_commit_changes)
+ self.foreach(_commit_changes, None)
=== modified file 'GTG/gtk/backends_dialog/parameters_ui/checkboxui.py'
--- GTG/gtk/backends_dialog/parameters_ui/checkboxui.py 2013-02-25 07:35:07 +0000
+++ GTG/gtk/backends_dialog/parameters_ui/checkboxui.py 2013-09-25 16:29:12 +0000
@@ -17,10 +17,10 @@
# this program. If not, see <http://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------------
-import gtk
-
-
-class CheckBoxUI(gtk.HBox):
+from gi.repository import Gtk
+
+
+class CheckBoxUI(Gtk.Box):
'''
It's a widget displaying a simple checkbox, with some text to explain its
meaning
@@ -46,13 +46,13 @@
def _populate_gtk(self, width):
'''Creates the checkbox and the related label
- @param width: the width of the gtk.Label object
+ @param width: the width of the Gtk.Label object
'''
- self.checkbutton = gtk.CheckButton(label=self.text)
+ self.checkbutton = Gtk.CheckButton(label=self.text)
backend_parameters = self.backend.get_parameters()[self.parameter]
self.checkbutton.set_active(backend_parameters)
self.checkbutton.connect("toggled", self.on_modified)
- self.pack_start(self.checkbutton, False)
+ self.pack_start(self.checkbutton, False, True, 0)
def commit_changes(self):
'''Saves the changes to the backend parameter'''
=== modified file 'GTG/gtk/backends_dialog/parameters_ui/importtagsui.py'
--- GTG/gtk/backends_dialog/parameters_ui/importtagsui.py 2013-02-25 07:35:07 +0000
+++ GTG/gtk/backends_dialog/parameters_ui/importtagsui.py 2013-09-25 16:29:12 +0000
@@ -17,12 +17,13 @@
# this program. If not, see <http://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------------
-import gtk
+from gi.repository import Gtk
from GTG.backends.genericbackend import GenericBackend
-
-
-class ImportTagsUI(gtk.VBox):
+from functools import reduce
+
+
+class ImportTagsUI(Gtk.Box):
'''
It's a widget displaying a couple of radio buttons, a label and a textbox
to let the user change the attached tags (or imported)
@@ -42,7 +43,8 @@
radio button
@param parameter_name: the backend parameter this widget should modify
'''
- super(ImportTagsUI, self).__init__()
+ super(ImportTagsUI, self).__init__(
+ orientation=Gtk.Orientation.VERTICAL)
self.backend = backend
self.req = req
self.title = title
@@ -59,26 +61,26 @@
@param width: the length of the radio buttons
'''
- title_label = gtk.Label()
+ title_label = Gtk.Label()
title_label.set_alignment(xalign=0, yalign=0)
title_label.set_markup("<big><b>%s</b></big>" % self.title)
- self.pack_start(title_label, True)
- align = gtk.Alignment(xalign=0, yalign=0, xscale=1)
+ self.pack_start(title_label, True, True, 0)
+ align = Gtk.Alignment.new(0, 0, 1, 0)
align.set_padding(0, 0, 10, 0)
- self.pack_start(align, True)
- vbox = gtk.VBox()
+ self.pack_start(align, True, True, 0)
+ vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
align.add(vbox)
- self.all_tags_radio = gtk.RadioButton(group=None,
+ self.all_tags_radio = Gtk.RadioButton(group=None,
label=self.anybox_text)
- vbox.pack_start(self.all_tags_radio, True)
- self.some_tags_radio = gtk.RadioButton(group=self.all_tags_radio,
+ vbox.pack_start(self.all_tags_radio, True, True, 0)
+ self.some_tags_radio = Gtk.RadioButton(group=self.all_tags_radio,
label=self.somebox_text)
self.some_tags_radio.set_size_request(width=width, height=-1)
- hbox = gtk.HBox()
- vbox.pack_start(hbox, True)
- hbox.pack_start(self.some_tags_radio, False)
- self.tags_entry = gtk.Entry()
- hbox.pack_start(self.tags_entry, True)
+ box = Gtk.Box()
+ vbox.pack_start(box, True, True, 0)
+ box.pack_start(self.some_tags_radio, False, True, 0)
+ self.tags_entry = Gtk.Entry()
+ box.pack_start(self.tags_entry, True, True, 0)
def on_changed(self, radio, data=None):
''' Signal callback, executed when the user modifies something.
@@ -99,9 +101,9 @@
else:
tags = self.tags_entry.get_text().split(",")
# stripping spaces
- tags = map(lambda t: t.strip(), tags)
+ tags = [t.strip() for t in tags]
# removing empty tags
- tags = filter(lambda t: t, tags)
+ tags = [t for t in tags if t]
self.backend.set_parameter(self.parameter_name, tags)
=== modified file 'GTG/gtk/backends_dialog/parameters_ui/passwordui.py'
--- GTG/gtk/backends_dialog/parameters_ui/passwordui.py 2013-02-25 07:35:07 +0000
+++ GTG/gtk/backends_dialog/parameters_ui/passwordui.py 2013-09-25 16:29:12 +0000
@@ -17,12 +17,12 @@
# this program. If not, see <http://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------------
-import gtk
+from gi.repository import Gtk
from GTG import _
-class PasswordUI(gtk.HBox):
+class PasswordUI(Gtk.Box):
'''Widget displaying a gtk.Label and a textbox to input a password'''
def __init__(self, req, backend, width):
@@ -31,7 +31,7 @@
@param req: a Requester
@param backend: a backend object
- @param width: the width of the gtk.Label object
+ @param width: the width of the Gtk.Label object
'''
super(PasswordUI, self).__init__()
self.backend = backend
@@ -43,16 +43,16 @@
def _populate_gtk(self, width):
'''Creates the text box and the related label
- @param width: the width of the gtk.Label object
+ @param width: the width of the Gtk.Label object
'''
- password_label = gtk.Label(_("Password:"))
+ password_label = Gtk.Label(label=_("Password:"))
password_label.set_alignment(xalign=0, yalign=0.5)
password_label.set_size_request(width=width, height=-1)
- self.pack_start(password_label, False)
- align = gtk.Alignment(xalign=0, yalign=0.5, xscale=1)
+ self.pack_start(password_label, False, True, 0)
+ align = Gtk.Alignment.new(0, 0.5, 1, 0)
align.set_padding(0, 0, 10, 0)
- self.pack_start(align, True)
- self.password_textbox = gtk.Entry()
+ self.pack_start(align, True, True, 0)
+ self.password_textbox = Gtk.Entry()
align.add(self.password_textbox)
def _load_password(self):
=== modified file 'GTG/gtk/backends_dialog/parameters_ui/pathui.py'
--- GTG/gtk/backends_dialog/parameters_ui/pathui.py 2013-02-25 07:35:07 +0000
+++ GTG/gtk/backends_dialog/parameters_ui/pathui.py 2013-09-25 16:29:12 +0000
@@ -17,13 +17,13 @@
# this program. If not, see <http://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------------
-import gtk
+from gi.repository import Gtk
import os.path
from GTG import _
-class PathUI(gtk.HBox):
+class PathUI(Gtk.Box):
'''Gtk widgets to show a path in a textbox, and a button to bring up a
filesystem explorer to modify that path (also, a label to describe those)
'''
@@ -34,7 +34,7 @@
@param req: a Requester
@param backend: a backend object
- @param width: the width of the gtk.Label object
+ @param width: the width of the Gtk.Label object
'''
super(PathUI, self).__init__()
self.backend = backend
@@ -42,25 +42,25 @@
self._populate_gtk(width)
def _populate_gtk(self, width):
- '''Creates the gtk.Label, the textbox and the button
+ '''Creates the Gtk.Label, the textbox and the button
- @param width: the width of the gtk.Label object
+ @param width: the width of the Gtk.Label object
'''
- label = gtk.Label(_("Filename:"))
+ label = Gtk.Label(label=_("Filename:"))
label.set_line_wrap(True)
label.set_alignment(xalign=0, yalign=0.5)
label.set_size_request(width=width, height=-1)
- self.pack_start(label, False)
- align = gtk.Alignment(xalign=0, yalign=0.5, xscale=1)
+ self.pack_start(label, False, True, 0)
+ align = Gtk.Alignment.new(0, 0.5, 1, 0)
align.set_padding(0, 0, 10, 0)
- self.pack_start(align, True)
- self.textbox = gtk.Entry()
+ self.pack_start(align, True, True, 0)
+ self.textbox = Gtk.Entry()
self.textbox.set_text(self.backend.get_parameters()['path'])
self.textbox.connect('changed', self.on_path_modified)
align.add(self.textbox)
- self.button = gtk.Button(stock=gtk.STOCK_EDIT)
+ self.button = Gtk.Button(stock=Gtk.STOCK_EDIT)
self.button.connect('clicked', self.on_button_clicked)
- self.pack_start(self.button, False)
+ self.pack_start(self.button, False, True, 0)
def commit_changes(self):
'''Saves the changes to the backend parameter'''
@@ -81,30 +81,30 @@
@param sender: not used, only here for signal compatibility
'''
- self.chooser = gtk.FileChooserDialog(
+ self.chooser = Gtk.FileChooserDialog(
title=None,
- action=gtk.FILE_CHOOSER_ACTION_SAVE,
- buttons=(gtk.STOCK_CANCEL,
- gtk.RESPONSE_CANCEL,
- gtk.STOCK_OK,
- gtk.RESPONSE_OK))
- self.chooser.set_default_response(gtk.RESPONSE_OK)
+ action=Gtk.FileChooserAction.SAVE,
+ buttons=(Gtk.STOCK_CANCEL,
+ Gtk.ResponseType.CANCEL,
+ Gtk.STOCK_OK,
+ Gtk.ResponseType.OK))
+ self.chooser.set_default_response(Gtk.ResponseType.OK)
# set default file as the current self.path
dirname, basename = os.path.split(self.textbox.get_text())
self.chooser.set_current_name(basename)
self.chosser.set_current_folder(dirname)
# filter files
- afilter = gtk.FileFilter()
+ afilter = Gtk.FileFilter()
afilter.set_name("All files")
afilter.add_pattern("*")
self.chooser.add_filter(afilter)
- afilter = gtk.FileFilter()
+ afilter = Gtk.FileFilter()
afilter.set_name("XML files")
afilter.add_mime_type("text/plain")
afilter.add_pattern("*.xml")
self.chooser.add_filter(afilter)
response = self.chooser.run()
- if response == gtk.RESPONSE_OK:
+ if response == Gtk.ResponseType.OK:
self.textbox.set_text(self.chooser.get_filename())
self.chooser.destroy()
=== modified file 'GTG/gtk/backends_dialog/parameters_ui/periodui.py'
--- GTG/gtk/backends_dialog/parameters_ui/periodui.py 2013-02-25 07:35:07 +0000
+++ GTG/gtk/backends_dialog/parameters_ui/periodui.py 2013-09-25 16:29:12 +0000
@@ -17,23 +17,23 @@
# this program. If not, see <http://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------------
-import gtk
+from gi.repository import Gtk
from GTG import _, ngettext
-class PeriodUI(gtk.HBox):
+class PeriodUI(Gtk.Box):
'''A widget to change the frequency of a backend synchronization
'''
def __init__(self, req, backend, width):
'''
- Creates the gtk.Adjustment and the related label. Loads the current
+ Creates the Gtk.Adjustment and the related label. Loads the current
period.
@param req: a Requester
@param backend: a backend object
- @param width: the width of the gtk.Label object
+ @param width: the width of the Gtk.Label object
'''
super(PeriodUI, self).__init__()
self.backend = backend
@@ -44,30 +44,30 @@
def _populate_gtk(self, width):
'''Creates the gtk widgets
- @param width: the width of the gtk.Label object
+ @param width: the width of the Gtk.Label object
'''
- period_label = gtk.Label(_("Check for new tasks every"))
+ period_label = Gtk.Label(label=_("Check for new tasks every"))
period_label.set_alignment(xalign=0, yalign=0.5)
period_label.set_line_wrap(True)
period_label.set_size_request(width=width, height=-1)
- self.pack_start(period_label, False)
- align = gtk.Alignment(xalign=0, yalign=0.5, xscale=1)
+ self.pack_start(period_label, False, True, 0)
+ align = Gtk.Alignment.new(0, 0.5, 1, 0)
align.set_padding(0, 0, 10, 0)
- self.pack_start(align, False)
+ self.pack_start(align, False, True, 0)
period = self.backend.get_parameters()['period']
- self.adjustment = gtk.Adjustment(value=period,
+ self.adjustment = Gtk.Adjustment(value=period,
lower=1,
upper=120,
step_incr=1,
page_incr=0,
page_size=0)
- self.period_spin = gtk.SpinButton(adjustment=self.adjustment,
+ self.period_spin = Gtk.SpinButton(adjustment=self.adjustment,
climb_rate=0.3,
digits=0)
- self.minutes_label = gtk.Label()
+ self.minutes_label = Gtk.Label()
self.update_minutes_label()
self.minutes_label.set_alignment(xalign=0, yalign=0.5)
- self.pack_start(self.minutes_label, False)
+ self.pack_start(self.minutes_label, False, True, 0)
align.add(self.period_spin)
self.show_all()
=== modified file 'GTG/gtk/backends_dialog/parameters_ui/textui.py'
--- GTG/gtk/backends_dialog/parameters_ui/textui.py 2013-02-25 07:35:07 +0000
+++ GTG/gtk/backends_dialog/parameters_ui/textui.py 2013-09-25 16:29:12 +0000
@@ -17,10 +17,10 @@
# this program. If not, see <http://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------------
-import gtk
-
-
-class TextUI(gtk.HBox):
+from gi.repository import Gtk
+
+
+class TextUI(Gtk.Box):
'''A widget to display a simple textbox and a label to describe its content
'''
@@ -31,7 +31,7 @@
@param req: a Requester
@param backend: a backend object
- @param width: the width of the gtk.Label object
+ @param width: the width of the Gtk.Label object
'''
super(TextUI, self).__init__()
self.backend = backend
@@ -43,17 +43,17 @@
def _populate_gtk(self, width):
'''Creates the gtk widgets
- @param width: the width of the gtk.Label object
+ @param width: the width of the Gtk.Label object
'''
- label = gtk.Label("%s:" % self.description)
+ label = Gtk.Label(label="%s:" % self.description)
label.set_line_wrap(True)
label.set_alignment(xalign=0, yalign=0.5)
label.set_size_request(width=width, height=-1)
- self.pack_start(label, False)
- align = gtk.Alignment(xalign=0, yalign=0.5, xscale=1)
+ self.pack_start(label, False, True, 0)
+ align = Gtk.Alignment.new(0, 0.5, 1, 0)
align.set_padding(0, 0, 10, 0)
- self.pack_start(align, True)
- self.textbox = gtk.Entry()
+ self.pack_start(align, True, True, 0)
+ self.textbox = Gtk.Entry()
backend_parameters = self.backend.get_parameters()[self.parameter_name]
self.textbox.set_text(backend_parameters)
self.textbox.connect('changed', self.on_text_modified)
=== modified file 'GTG/gtk/browser/CellRendererTags.py'
--- GTG/gtk/browser/CellRendererTags.py 2013-02-25 08:29:31 +0000
+++ GTG/gtk/browser/CellRendererTags.py 2013-09-25 16:29:12 +0000
@@ -20,23 +20,19 @@
#=== IMPORT ===================================================================
# system imports
-import pygtk
-pygtk.require('2.0')
-import gobject
-import glib
-import gtk
+from gi.repository import GObject, GLib, Gtk, Gdk
import cairo
from GTG.tools.logger import Log
#=== MAIN CLASS ===============================================================
-class CellRendererTags(gtk.GenericCellRenderer):
+class CellRendererTags(Gtk.CellRenderer):
__gproperties__ = {
- 'tag_list': (gobject.TYPE_PYOBJECT,
- "Tag list", "A list of tags", gobject.PARAM_READWRITE),
- 'tag': (gobject.TYPE_PYOBJECT, "Tag",
- "Tag", gobject.PARAM_READWRITE),
+ 'tag_list': (GObject.TYPE_PYOBJECT,
+ "Tag list", "A list of tags", GObject.PARAM_READWRITE),
+ 'tag': (GObject.TYPE_PYOBJECT, "Tag",
+ "Tag", GObject.PARAM_READWRITE),
}
# Private methods
@@ -81,7 +77,7 @@
# Class methods
def __init__(self):
- self.__gobject_init__()
+ Gtk.CellRenderer.__init__(self)
self.tag_list = None
self.tag = None
self.xpad = 1
@@ -100,8 +96,7 @@
else:
return getattr(self, pspec.name)
- def on_render(self, window, widget, background_area, cell_area,
- expose_area, flags):
+ def do_render(self, cr, widget, background_area, cell_area, flags):
vw_tags = self.__count_viewable_tags()
count = 0
@@ -115,8 +110,9 @@
return
# Drawing context
- cr = window.cairo_create()
- gdkcontext = gtk.gdk.CairoContext(cr)
+ #cr = window.cairo_create()
+ #gdkcontext = Gdk.CairoContext(cr)
+ gdkcontext = cr
gdkcontext.set_antialias(cairo.ANTIALIAS_NONE)
# Coordinates of the origin point
@@ -138,12 +134,13 @@
if my_tag_icon:
try:
- pixbuf = gtk.icon_theme_get_default().load_icon(
+ pixbuf = Gtk.IconTheme.get_default().load_icon(
my_tag_icon, 16, 0)
- gdkcontext.set_source_pixbuf(pixbuf, rect_x, rect_y)
+ Gdk.cairo_set_source_pixbuf(gdkcontext, pixbuf,
+ rect_x, rect_y)
gdkcontext.paint()
count = count + 1
- except glib.GError:
+ except GLib.GError:
# In some rare cases an icon could not be found
# (e.g. wrong set icon path, missing icon)
# Raising an exception breaks UI and signal catcher badly
@@ -152,14 +149,14 @@
elif my_tag_color:
# Draw rounded rectangle
- my_color = gtk.gdk.color_parse(my_tag_color)
- gdkcontext.set_source_color(my_color)
+ my_color = Gdk.color_parse(my_tag_color)
+ Gdk.cairo_set_source_color(gdkcontext, my_color)
self.__roundedrec(gdkcontext, rect_x, rect_y, 16, 16, 8)
gdkcontext.fill()
count = count + 1
# Outer line
- gdkcontext.set_source_rgba(0, 0, 0, 0.20)
+ Gdk.cairo_set_source_rgba(gdkcontext, Gdk.RGBA(0, 0, 0, 0.20))
gdkcontext.set_line_width(1.0)
self.__roundedrec(gdkcontext, rect_x, rect_y, 16, 16, 8)
gdkcontext.stroke()
@@ -171,18 +168,18 @@
if not my_tag_icon and not my_tag_color:
# Draw rounded rectangle
- gdkcontext.set_source_rgba(0.95, 0.95, 0.95, 1)
+ Gdk.cairo_set_source_rgba(gdkcontext,
+ Gdk.RGBA(0.95, 0.95, 0.95, 1))
self.__roundedrec(gdkcontext, rect_x, rect_y, 16, 16, 8)
gdkcontext.fill()
# Outer line
- gdkcontext.set_source_rgba(0, 0, 0, 0.20)
+ Gdk.cairo_set_source_rgba(gdkcontext, Gdk.RGBA(0, 0, 0, 0.20))
gdkcontext.set_line_width(1.0)
self.__roundedrec(gdkcontext, rect_x, rect_y, 16, 16, 8)
gdkcontext.stroke()
- def on_get_size(self, widget, cell_area=None):
-
+ def do_get_size(self, widget, cell_area=None):
count = self.__count_viewable_tags()
if count != 0:
@@ -192,4 +189,4 @@
else:
return (self.xpad, self.ypad, self.xpad * 2, self.ypad * 2)
-gobject.type_register(CellRendererTags)
+GObject.type_register(CellRendererTags)
=== modified file 'GTG/gtk/browser/__init__.py'
--- GTG/gtk/browser/__init__.py 2013-03-04 12:38:54 +0000
+++ GTG/gtk/browser/__init__.py 2013-09-25 16:29:12 +0000
@@ -29,6 +29,8 @@
class GnomeConfig:
current_rep = os.path.dirname(os.path.abspath(__file__))
+ BROWSER_UI_FILE = os.path.join(current_rep, "taskbrowser.ui")
+ MODIFYTAGS_UI_FILE = os.path.join(current_rep, "modifytags_dialog.ui")
GLADE_FILE = os.path.join(current_rep, "taskbrowser.glade")
MODIFYTAGS_GLADE_FILE = os.path.join(current_rep,
"modifytags_dialog.glade")
=== modified file 'GTG/gtk/browser/browser.py'
--- GTG/gtk/browser/browser.py 2013-09-04 20:26:46 +0000
+++ GTG/gtk/browser/browser.py 2013-09-25 16:29:12 +0000
@@ -25,10 +25,7 @@
import threading
from webbrowser import open as openurl
-import pygtk
-pygtk.require('2.0')
-import gobject
-import gtk
+from gi.repository import GObject, Gtk, Gdk
# our own imports
from GTG import _, info, ngettext
@@ -55,21 +52,21 @@
self.start = time.time()
def __exit__(self, *args):
- print "%s : %s" % (self.name, time.time() - self.start)
-
-
-class TaskBrowser(gobject.GObject):
+ print(("{0} : {1}".format(self.name, time.time() - self.start)))
+
+
+class TaskBrowser(GObject.GObject):
""" The UI for browsing open and closed tasks,
and listing tags in a tree """
- __string_signal__ = (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (str, ))
- __none_signal__ = (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, tuple())
+ __string_signal__ = (GObject.SignalFlags.RUN_FIRST, None, (str, ))
+ __none_signal__ = (GObject.SignalFlags.RUN_FIRST, None, tuple())
__gsignals__ = {'task-added-via-quick-add': __string_signal__,
'visibility-toggled': __none_signal__,
}
def __init__(self, requester, vmanager):
- gobject.GObject.__init__(self)
+ GObject.GObject.__init__(self)
# Object prime variables
self.req = requester
self.vmanager = vmanager
@@ -98,13 +95,13 @@
self.tagtreeview = None
# Load window tree
- self.builder = gtk.Builder()
- self.builder.add_from_file(GnomeConfig.GLADE_FILE)
+ self.builder = Gtk.Builder()
+ self.builder.add_from_file(GnomeConfig.BROWSER_UI_FILE)
# Define aliases for specific widgets
self._init_widget_aliases()
- # Init non-glade widgets
+ # Init non-GtkBuilder widgets
self._init_ui_widget()
# Set the tooltip for the toolbar buttons
@@ -142,8 +139,8 @@
"""
icon_dirs = CoreConfig().get_icons_directories()
for i in icon_dirs:
- gtk.icon_theme_get_default().prepend_search_path(i)
- gtk.window_set_default_icon_name("gtg")
+ Gtk.IconTheme.get_default().prepend_search_path(i)
+ Gtk.Window.set_default_icon_name("gtg")
def _init_widget_aliases(self):
"""
@@ -244,7 +241,6 @@
"""
Show the about dialog
"""
- gtk.about_dialog_set_url_hook(lambda dialog, url: openurl(url))
self.about.set_website(info.URL)
self.about.set_website_label(info.URL)
self.about.set_version(info.VERSION)
@@ -382,14 +378,15 @@
def _add_accelerator_for_widget(self, agr, name, accel):
widget = self.builder.get_object(name)
- key, mod = gtk.accelerator_parse(accel)
- widget.add_accelerator("activate", agr, key, mod, gtk.ACCEL_VISIBLE)
+ key, mod = Gtk.accelerator_parse(accel)
+ widget.add_accelerator("activate", agr, key, mod,
+ Gtk.AccelFlags.VISIBLE)
def _init_accelerators(self):
"""
initialize gtk accelerators for different interface elements
"""
- agr = gtk.AccelGroup()
+ agr = Gtk.AccelGroup()
self.builder.get_object("MainWindow").add_accel_group(agr)
self._add_accelerator_for_widget(agr, "view_sidebar", "F9")
@@ -407,9 +404,9 @@
self._add_accelerator_for_widget(agr, "help_contents", "F1")
quickadd_field = self.builder.get_object("quickadd_field")
- key, mod = gtk.accelerator_parse("<Control>l")
+ key, mod = Gtk.accelerator_parse("<Control>l")
quickadd_field.add_accelerator("grab-focus", agr, key, mod,
- gtk.ACCEL_VISIBLE)
+ Gtk.AccelFlags.VISIBLE)
### HELPER FUNCTIONS ########################################################
def open_preferences(self, widget):
@@ -429,11 +426,9 @@
and stores the state in self.config.max
This is used to check the window state afterwards
and maximize it if needed """
- mask = gtk.gdk.WINDOW_STATE_MAXIMIZED
- if widget.get_window().get_state() & mask == mask:
- self.config.set("max", True)
- else:
- self.config.set("max", False)
+ mask = Gdk.WindowState.MAXIMIZED
+ is_maximized = widget.get_window().get_state() & mask == mask
+ self.config.set("max", is_maximized)
def restore_state_from_conf(self):
@@ -531,7 +526,7 @@
return True
for t in self.config.get("opened_tasks"):
- gobject.idle_add(open_task, self.req, t)
+ GObject.idle_add(open_task, self.req, t)
def do_toggle_workview(self):
""" Switch between default and work view
@@ -616,7 +611,7 @@
def on_sort_column_changed(self, model):
sort_column, sort_order = model.get_sort_column_id()
- if sort_order == gtk.SORT_ASCENDING:
+ if sort_order == Gtk.SortType.ASCENDING:
sort_order = 0
else:
sort_order = 1
@@ -706,10 +701,10 @@
self.on_taskdone_cursor_changed)
ctree.apply_filter(self.get_selected_tags()[0], refresh=True)
if not self.closed_pane:
- self.closed_pane = gtk.ScrolledWindow()
+ self.closed_pane = Gtk.ScrolledWindow()
self.closed_pane.set_size_request(-1, 100)
- self.closed_pane.set_policy(gtk.POLICY_AUTOMATIC,
- gtk.POLICY_AUTOMATIC)
+ self.closed_pane.set_policy(Gtk.PolicyType.AUTOMATIC,
+ Gtk.PolicyType.AUTOMATIC)
self.closed_pane.add(self.vtree_panes['closed'])
elif self.accessory_notebook.page_num(self.closed_pane) != -1:
@@ -811,7 +806,7 @@
def on_quickadd_activate(self, widget):
""" Add a new task from quickadd toolbar """
- text = unicode(self.quickadd_entry.get_text())
+ text = str(self.quickadd_entry.get_text())
text = text.strip()
if text:
tags = self.get_selected_tags(nospecial=True)
@@ -840,7 +835,7 @@
selection.select_path(path)
# It cannot be another thread than the main gtk thread !
- gobject.idle_add(selecter, treemodelsort, path, iter, self)
+ GObject.idle_add(selecter, treemodelsort, path, iter, self)
# event that is set when the new task is created
self.__last_quick_added_tid_event = threading.Event()
self.__quick_add_select_handle = \
@@ -854,7 +849,7 @@
self.quickadd_entry.set_text('')
# signal the event for the plugins to catch
- gobject.idle_add(self.emit, "task-added-via-quick-add",
+ GObject.idle_add(self.emit, "task-added-via-quick-add",
task.get_id())
else:
# if no text is selected, we open the currently selected task
@@ -864,7 +859,7 @@
def on_quickadd_iconpress(self, widget, icon, event):
""" Clear the text in quickadd field by clicking on 'clear' icon """
- if icon == gtk.ENTRY_ICON_SECONDARY:
+ if icon == Gtk.EntryIconPosition.SECONDARY:
self.quickadd_entry.set_text('')
def on_tag_treeview_button_press_event(self, treeview, event):
@@ -897,38 +892,45 @@
selected_tags = self.get_selected_tags(nospecial=True)
selected_search = self.get_selected_search()
# popup menu for searches
+ # FIXME thos two branches could be simplified
+ # (there is no difference betweenn search and normal tag
if selected_search is not None:
my_tag = self.req.get_tag(selected_search)
self.tagpopup.set_tag(my_tag)
- self.tagpopup.popup(None, None, None, event.button, time)
+ self.tagpopup.popup(None, None, None, None, event.button,
+ time)
elif len(selected_tags) > 0:
# Then we are looking at single, normal tag rather than
# the special 'All tags' or 'Tasks without tags'. We only
# want to popup the menu for normal tags.
my_tag = self.req.get_tag(selected_tags[0])
self.tagpopup.set_tag(my_tag)
- self.tagpopup.popup(None, None, None, event.button, time)
+ self.tagpopup.popup(None, None, None, None, event.button,
+ time)
else:
self.reset_cursor()
return True
def on_tag_treeview_key_press_event(self, treeview, event):
- keyname = gtk.gdk.keyval_name(event.keyval)
+ keyname = Gdk.keyval_name(event.keyval)
is_shift_f10 = (keyname == "F10" and
- event.get_state() & gtk.gdk.SHIFT_MASK)
+ event.get_state() & Gdk.ModifierType.SHIFT_MASK)
if is_shift_f10 or keyname == "Menu":
selected_tags = self.get_selected_tags(nospecial=True)
selected_search = self.get_selected_search()
+ # FIXME thos two branches could be simplified (there is
+ # no difference betweenn search and normal tag
# popup menu for searches
if selected_search is not None:
- self.searchpopup.popup(None, None, None, 0, event.time)
+ self.tagpopup.set_tag(selected_search)
+ self.tagpopup.popup(None, None, None, 0, event.time)
elif len(selected_tags) > 0:
# Then we are looking at single, normal tag rather than
# the special 'All tags' or 'Tasks without tags'. We only
# want to popup the menu for normal tags.
selected_tag = self.req.get_tag(selected_tags[0])
self.tagpopup.set_tag(selected_tag)
- self.tagpopup.popup(None, None, None, 0, event.time)
+ self.tagpopup.popup(None, None, None, None, 0, event.time)
else:
self.reset_cursor()
return True
@@ -952,13 +954,14 @@
else:
treeview.set_cursor(path, col, 0)
treeview.grab_focus()
- self.taskpopup.popup(None, None, None, event.button, time)
+ self.taskpopup.popup(None, None, None, None, event.button,
+ time)
return True
def on_task_treeview_key_press_event(self, treeview, event):
- keyname = gtk.gdk.keyval_name(event.keyval)
+ keyname = Gdk.keyval_name(event.keyval)
is_shift_f10 = (keyname == "F10" and
- event.get_state() & gtk.gdk.SHIFT_MASK)
+ event.get_state() & Gdk.ModifierType.SHIFT_MASK)
if keyname == "Delete":
self.on_delete_tasks()
@@ -981,9 +984,9 @@
return True
def on_closed_task_treeview_key_press_event(self, treeview, event):
- keyname = gtk.gdk.keyval_name(event.keyval)
+ keyname = Gdk.keyval_name(event.keyval)
is_shift_f10 = (keyname == "F10" and
- event.get_state() & gtk.gdk.SHIFT_MASK)
+ event.get_state() & Gdk.ModifierType.SHIFT_MASK)
if keyname == "Delete":
self.on_delete_tasks()
@@ -1213,7 +1216,7 @@
button.set_label(settings["label"])
def update_menu_item(menu_item, settings):
- image = gtk.image_new_from_icon_name(settings["icon-name"], 16)
+ image = Gtk.Image.new_from_icon_name(settings["icon-name"], 16)
image.set_pixel_size(16)
image.show()
menu_item.set_image(image)
@@ -1366,8 +1369,8 @@
"""Adds a new page tab to the left panel. The tab will
be added as the last tab. Also causes the tabs to be
shown if they're not.
- @param icon: a gtk.Image picture to display on the tab
- @param page: gtk.Frame-based panel to be added
+ @param icon: a Gtk.Image picture to display on the tab
+ @param page: Gtk.Frame-based panel to be added
"""
return self._add_page(self.sidebar_notebook, icon, page)
@@ -1376,23 +1379,24 @@
will be added as the last tab. Also causes the tabs to be
shown.
@param title: Short text to use for the tab label
- @param page: gtk.Frame-based panel to be added
+ @param page: Gtk.Frame-based panel to be added
"""
- return self._add_page(self.main_notebook, gtk.Label(title), page)
+ return self._add_page(self.main_notebook, Gtk.Label(label=title), page)
def add_page_to_accessory_notebook(self, title, page):
"""Adds a new page tab to the lower right accessory panel. The
tab will be added as the last tab. Also causes the tabs to be
shown.
@param title: Short text to use for the tab label
- @param page: gtk.Frame-based panel to be added
+ @param page: Gtk.Frame-based panel to be added
"""
- return self._add_page(self.accessory_notebook, gtk.Label(title), page)
+ return self._add_page(self.accessory_notebook, Gtk.Label(label=title),
+ page)
def remove_page_from_sidebar_notebook(self, page):
"""Removes a new page tab from the left panel. If this leaves
only one tab in the notebook, the tab selector will be hidden.
- @param page: gtk.Frame-based panel to be removed
+ @param page: Gtk.Frame-based panel to be removed
"""
return self._remove_page(self.sidebar_notebook, page)
@@ -1400,7 +1404,7 @@
"""Removes a new page tab from the top right main panel. If
this leaves only one tab in the notebook, the tab selector will
be hidden.
- @param page: gtk.Frame-based panel to be removed
+ @param page: Gtk.Frame-based panel to be removed
"""
return self._remove_page(self.main_notebook, page)
@@ -1408,7 +1412,7 @@
"""Removes a new page tab from the lower right accessory panel.
If this leaves only one tab in the notebook, the tab selector
will be hidden.
- @param page: gtk.Frame-based panel to be removed
+ @param page: Gtk.Frame-based panel to be removed
"""
return self._remove_page(self.accessory_notebook, page)
@@ -1416,7 +1420,7 @@
""" Hides the task browser """
self.browser_shown = False
self.window.hide()
- gobject.idle_add(self.emit, "visibility-toggled")
+ GObject.idle_add(self.emit, "visibility-toggled")
def show(self):
""" Unhides the TaskBrowser """
@@ -1426,7 +1430,7 @@
self.window.present()
self.window.grab_focus()
self.quickadd_entry.grab_focus()
- gobject.idle_add(self.emit, "visibility-toggled")
+ GObject.idle_add(self.emit, "visibility-toggled")
def iconify(self):
""" Minimizes the TaskBrowser """
@@ -1468,7 +1472,7 @@
def on_backend_failed(self, sender, backend_id, error_code):
"""
Signal callback.
- When a backend fails to work, loads a gtk.Infobar to alert the user
+ When a backend fails to work, loads a Gtk.Infobar to alert the user
@param sender: not used, only here for signal compatibility
@param backend_id: the id of the failing backend
@@ -1483,7 +1487,7 @@
'''
Signal callback.
When a backend needs some kind of feedback from the user,
- loads a gtk.Infobar to alert the user.
+ loads a Gtk.Infobar to alert the user.
This is used, for example, to request confirmation after authenticating
via OAuth.
@@ -1501,10 +1505,10 @@
def __remove_backend_infobar(self, child, backend_id):
'''
- Helper function to remove an gtk.Infobar related to a backend
+ Helper function to remove an Gtk.Infobar related to a backend
- @param child: a gtk.Infobar
- @param backend_id: the id of the backend which gtk.Infobar should be
+ @param child: a Gtk.Infobar
+ @param backend_id: the id of the backend which Gtk.Infobar should be
removed.
'''
if isinstance(child, CustomInfoBar) and\
@@ -1515,10 +1519,10 @@
def remove_backend_infobar(self, sender, backend_id):
'''
Signal callback.
- Deletes the gtk.Infobars related to a backend
+ Deletes the Gtk.Infobars related to a backend
@param sender: not used, only here for signal compatibility
- @param backend_id: the id of the backend which gtk.Infobar should be
+ @param backend_id: the id of the backend which Gtk.Infobar should be
removed.
'''
backend = self.req.get_backend(backend_id)
@@ -1533,7 +1537,7 @@
Helper function to create a new infobar for a backend
@param backend_id: the backend for which we're creating the infobar
- @returns gtk.Infobar: the created infobar
+ @returns Gtk.Infobar: the created infobar
'''
# remove old infobar related to backend_id, if any
if not self.vbox_toolbars:
@@ -1541,7 +1545,7 @@
self.vbox_toolbars.foreach(self.__remove_backend_infobar, backend_id)
# add a new one
infobar = CustomInfoBar(self.req, self, self.vmanager, backend_id)
- self.vbox_toolbars.pack_start(infobar, True)
+ self.vbox_toolbars.pack_start(infobar, True, True, 0)
return infobar
#### SEARCH RELATED STUFF #####################################################
@@ -1569,7 +1573,7 @@
self.search_actions = []
- self.search_complete_store = gtk.ListStore(str)
+ self.search_complete_store = Gtk.ListStore(str)
for tagname in self.req.get_all_tags():
# only for regular tags
if tagname.startswith("@"):
=== modified file 'GTG/gtk/browser/custominfobar.py'
--- GTG/gtk/browser/custominfobar.py 2013-02-25 07:35:07 +0000
+++ GTG/gtk/browser/custominfobar.py 2013-09-25 16:29:12 +0000
@@ -17,7 +17,7 @@
# this program. If not, see <http://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------------
-import gtk
+from gi.repository import Gtk
import threading
from GTG import _
@@ -25,9 +25,9 @@
from GTG.tools.networkmanager import is_connection_up
-class CustomInfoBar(gtk.InfoBar):
+class CustomInfoBar(Gtk.InfoBar):
'''
- A gtk.InfoBar specialized for displaying errors and requests for
+ A Gtk.InfoBar specialized for displaying errors and requests for
interaction coming from the backends
'''
@@ -61,19 +61,19 @@
def get_backend_id(self):
'''
Getter function to return the id of the backend for which this
- gtk.InfoBar was created
+ Gtk.InfoBar was created
'''
return self.backend_id
def _populate(self):
'''Setting up gtk widgets'''
- content_hbox = self.get_content_area()
- content_hbox.set_homogeneous(False)
- self.label = gtk.Label()
+ content_box = self.get_content_area()
+ content_box.set_homogeneous(False)
+ self.label = Gtk.Label()
self.label.set_line_wrap(True)
self.label.set_alignment(0.5, 0.5)
- self.label.set_justify(gtk.JUSTIFY_FILL)
- content_hbox.pack_start(self.label, True, True)
+ self.label.set_justify(Gtk.Justification.FILL)
+ content_box.pack_start(self.label, True, True, 0)
def _on_error_response(self, widget, event):
'''
@@ -84,7 +84,7 @@
@param event: the code of the gtk response
'''
self.hide()
- if event == gtk.RESPONSE_ACCEPT:
+ if event == Gtk.ResponseType.ACCEPT:
self.vmanager.configure_backend(backend_id=self.backend_id)
def set_error_code(self, error_code):
@@ -99,24 +99,24 @@
backend_name = self.backend.get_human_name()
if error_code == BackendSignals.ERRNO_AUTHENTICATION:
- self.set_message_type(gtk.MESSAGE_ERROR)
+ self.set_message_type(Gtk.MessageType.ERROR)
self.label.set_markup(self.AUTHENTICATION_MESSAGE % backend_name)
self.add_button(_('Configure synchronization service'),
- gtk.RESPONSE_ACCEPT)
- self.add_button(_('Ignore'), gtk.RESPONSE_CLOSE)
+ Gtk.ResponseType.ACCEPT)
+ self.add_button(_('Ignore'), Gtk.ResponseType.CLOSE)
elif error_code == BackendSignals.ERRNO_NETWORK:
if not is_connection_up():
return
- self.set_message_type(gtk.MESSAGE_WARNING)
+ self.set_message_type(Gtk.MessageType.WARNING)
self.label.set_markup(self.NETWORK_MESSAGE % backend_name)
# FIXME: use gtk stock button instead
- self.add_button(_('Ok'), gtk.RESPONSE_CLOSE)
+ self.add_button(_('Ok'), Gtk.ResponseType.CLOSE)
elif error_code == BackendSignals.ERRNO_DBUS:
- self.set_message_type(gtk.MESSAGE_WARNING)
+ self.set_message_type(Gtk.MessageType.WARNING)
self.label.set_markup(self.DBUS_MESSAGE % backend_name)
- self.add_button(_('Ok'), gtk.RESPONSE_CLOSE)
+ self.add_button(_('Ok'), Gtk.ResponseType.CLOSE)
self.show_all()
@@ -132,14 +132,14 @@
'''
self._populate()
self.callback = callback
- self.set_message_type(gtk.MESSAGE_INFO)
+ self.set_message_type(Gtk.MessageType.INFO)
self.label.set_markup(description)
self.connect("response", self._on_interaction_response)
self.interaction_type = interaction_type
if interaction_type == BackendSignals().INTERACTION_CONFIRM:
- self.add_button(_('Confirm'), gtk.RESPONSE_ACCEPT)
+ self.add_button(_('Confirm'), Gtk.ResponseType.ACCEPT)
elif interaction_type == BackendSignals().INTERACTION_TEXT:
- self.add_button(_('Continue'), gtk.RESPONSE_ACCEPT)
+ self.add_button(_('Continue'), Gtk.ResponseType.ACCEPT)
self.show_all()
def _on_interaction_response(self, widget, event):
@@ -150,10 +150,10 @@
@param widget: not used, here for compatibility with signals callbacks
@param event: the code of the gtk response
'''
- if event == gtk.RESPONSE_ACCEPT:
+ if event == Gtk.ResponseType.ACCEPT:
if self.interaction_type == BackendSignals().INTERACTION_TEXT:
self._prepare_textual_interaction()
- print "done"
+ print("done")
elif self.interaction_type == BackendSignals().INTERACTION_CONFIRM:
self.hide()
threading.Thread(target=getattr(self.backend,
@@ -167,33 +167,33 @@
title, description\
= getattr(self.backend,
self.callback)("get_ui_dialog_text")
- self.dialog = gtk.Window() # type = gtk.WINDOW_POPUP)
+ self.dialog = Gtk.Window() # type = Gtk.WindowType.POPUP
self.dialog.set_title(title)
self.dialog.set_transient_for(self.browser.window)
self.dialog.set_destroy_with_parent(True)
- self.dialog.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
+ self.dialog.set_position(Gtk.WindowPosition.CENTER_ON_PARENT)
self.dialog.set_modal(True)
# self.dialog.set_size_request(300,170)
- vbox = gtk.VBox()
+ vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
self.dialog.add(vbox)
- description_label = gtk.Label()
- description_label.set_justify(gtk.JUSTIFY_FILL)
+ description_label = Gtk.Label()
+ description_label.set_justify(Gtk.Justification.FILL)
description_label.set_line_wrap(True)
description_label.set_markup(description)
- align = gtk.Alignment(0.5, 0.5, 1, 1)
+ align = Gtk.Alignment.new(0.5, 0.5, 1, 1)
align.set_padding(10, 0, 20, 20)
align.add(description_label)
- vbox.pack_start(align)
- self.text_box = gtk.Entry()
+ vbox.pack_start(align, True, True, 0)
+ self.text_box = Gtk.Entry()
self.text_box.set_size_request(-1, 40)
- align = gtk.Alignment(0.5, 0.5, 1, 1)
+ align = Gtk.Alignment.new(0.5, 0.5, 1, 1)
align.set_padding(20, 20, 20, 20)
align.add(self.text_box)
- vbox.pack_start(align)
- button = gtk.Button(stock=gtk.STOCK_OK)
+ vbox.pack_start(align, True, True, 0)
+ button = Gtk.Button(stock=Gtk.STOCK_OK)
button.connect("clicked", self._on_text_confirmed)
button.set_size_request(-1, 40)
- vbox.pack_start(button, False)
+ vbox.pack_start(button, False, True, 0)
self.dialog.show_all()
self.hide()
=== modified file 'GTG/gtk/browser/modifytags_dialog.py'
--- GTG/gtk/browser/modifytags_dialog.py 2013-02-25 07:35:07 +0000
+++ GTG/gtk/browser/modifytags_dialog.py 2013-09-25 16:29:12 +0000
@@ -17,15 +17,18 @@
# this program. If not, see <http://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------------
""" A dialog for batch adding/removal of tags """
-import gtk
+
+from gi.repository import Gtk
from GTG import _
from GTG.gtk.browser import GnomeConfig
from GTG.tools.tags import parse_tag_list
-class ModifyTagsDialog:
- """ Dialog for batch adding/removal of tags """
+class ModifyTagsDialog(object):
+ """
+ Dialog for batch adding/removal of tags
+ """
def __init__(self, tag_completion, req):
self.req = req
@@ -39,9 +42,9 @@
self.last_apply_to_subtasks = False
def _init_dialog(self):
- """ Init .glade file """
- builder = gtk.Builder()
- builder.add_from_file(GnomeConfig.MODIFYTAGS_GLADE_FILE)
+ """ Init GtkBuilder .ui file """
+ builder = Gtk.Builder()
+ builder.add_from_file(GnomeConfig.MODIFYTAGS_UI_FILE)
builder.connect_signals({
"on_modifytags_confirm":
self.on_confirm,
@@ -97,3 +100,5 @@
# Rember the last actions
self.last_tag_entry = self.tag_entry.get_text()
self.last_apply_to_subtasks = self.apply_to_subtasks.get_active()
+
+# -----------------------------------------------------------------------------
=== 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 2013-09-25 16:29:12 +0000
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <requires lib="gtk+" version="2.16"/>
+ <!-- interface-requires gtk+ 3.0 -->
<object class="GtkDialog" id="modifytags_dialog">
<property name="can_focus">False</property>
<property name="border_width">5</property>
@@ -11,6 +11,7 @@
<object class="GtkBox" id="modifytags_dialog_vbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area3">
=== modified file 'GTG/gtk/browser/simple_color_selector.py'
--- GTG/gtk/browser/simple_color_selector.py 2013-02-25 08:29:31 +0000
+++ GTG/gtk/browser/simple_color_selector.py 2013-09-25 16:29:12 +0000
@@ -22,10 +22,8 @@
from a palette. The widget also allows to define and add new colors.
"""
-import pygtk
-pygtk.require('2.0')
-import gobject
-import gtk
+from gi.repository import GObject, Gtk, Gdk
+
import math
from GTG import _
@@ -43,38 +41,42 @@
BUTTON_HEIGHT = 24
-class SimpleColorSelectorPaletteItem(gtk.DrawingArea):
+class SimpleColorSelectorPaletteItem(Gtk.DrawingArea):
"""An item of the color selecctor palette"""
def __init__(self, color=None):
- gtk.DrawingArea.__init__(self)
- self.__gobject_init__()
+ Gtk.DrawingArea.__init__(self)
self.color = color
self.selected = False
- self.add_events(gtk.gdk.BUTTON_PRESS_MASK)
+ self.add_events(Gdk.EventMask.BUTTON_PRESS_MASK)
# Connect callbacks
- self.connect("expose_event", self.on_expose)
+ #FIXME
+ #self.connect("expose-event", self.on_expose)
+ self.connect("draw", self.on_expose)
self.connect("configure_event", self.on_configure)
- def __draw(self):
+ def __draw(self, cr):
"""Draws the widget"""
alloc = self.get_allocation()
- alloc_w, alloc_h = alloc[2], alloc[3]
+ #FIXME - why to use a special variables?
+ alloc_w, alloc_h = alloc.width, alloc.height
# Drawing context
- cr_ctxt = self.window.cairo_create()
- gdkcontext = gtk.gdk.CairoContext(cr_ctxt)
+ #cr_ctxt = self.window.cairo_create() # pylint: disable-msg=E1101
+ #gdkcontext = Gdk.CairoContext(cr_ctxt)
+ #FIXME
+ gdkcontext = cr
# Draw rectangle
if self.color is not None:
- my_color = gtk.gdk.color_parse(self.color)
- gdkcontext.set_source_color(my_color)
+ my_color = Gdk.color_parse(self.color)
+ Gdk.cairo_set_source_color(gdkcontext, my_color)
else:
- gdkcontext.set_source_rgba(0, 0, 0, 0)
+ Gdk.cairo_set_source_rgba(gdkcontext, Gdk.RGBA(0, 0, 0, 0))
gdkcontext.rectangle(0, 0, alloc_w, alloc_h)
gdkcontext.fill()
# Outer line
- gdkcontext.set_source_rgba(0, 0, 0, 0.30)
+ Gdk.cairo_set_source_rgba(gdkcontext, Gdk.RGBA(0, 0, 0, 0.30))
gdkcontext.set_line_width(2.0)
gdkcontext.rectangle(0, 0, alloc_w, alloc_h)
gdkcontext.stroke()
@@ -84,16 +86,17 @@
size = alloc_h * 0.50 - 3
pos_x = math.floor((alloc_w - size) / 2)
pos_y = math.floor((alloc_h - size) / 2)
- gdkcontext.set_source_rgba(255, 255, 255, 0.80)
+ Gdk.cairo_set_source_rgba(gdkcontext,
+ Gdk.RGBA(255, 255, 255, 0.80))
gdkcontext.arc(
alloc_w / 2, alloc_h / 2, size / 2 + 3, 0, 2 * math.pi)
gdkcontext.fill()
gdkcontext.set_line_width(1.0)
- gdkcontext.set_source_rgba(0, 0, 0, 0.20)
+ Gdk.cairo_set_source_rgba(gdkcontext, Gdk.RGBA(0, 0, 0, 0.20))
gdkcontext.arc(
alloc_w / 2, alloc_h / 2, size / 2 + 3, 0, 2 * math.pi)
gdkcontext.stroke()
- gdkcontext.set_source_rgba(0, 0, 0, 0.50)
+ Gdk.cairo_set_source_rgba(gdkcontext, Gdk.RGBA(0, 0, 0, 0.50))
gdkcontext.set_line_width(3.0)
gdkcontext.move_to(pos_x, pos_y + size / 2)
gdkcontext.line_to(pos_x + size / 2, pos_y + size)
@@ -101,13 +104,14 @@
gdkcontext.stroke()
### callbacks ###
- def on_expose(self, widget, params):
+ def on_expose(self, widget, cr):
"""Callback: redraws the widget when it is exposed"""
- self.__draw()
+ self.__draw(cr)
def on_configure(self, widget, params):
"""Callback: redraws the widget when it is exposed"""
- self.__draw()
+ #FIXME - missing cairo context
+ #self.__draw(cr)
### PUBLIC IF ###
def set_color(self, color):
@@ -124,13 +128,12 @@
return self.selected
-class SimpleColorSelector(gtk.VBox):
+class SimpleColorSelector(Gtk.Box):
"""Widget displaying a palette of colors, possibly with a button allowing
to define new colors."""
def __init__(self, width=9, colors=None, custom_colors=None):
- gtk.VBox.__init__(self)
- self.__gobject_init__()
+ Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL)
self.width = width
# widget model
if colors is None:
@@ -168,16 +171,16 @@
"""Draws the palette of colors"""
self.__reset_palette()
# (re-)create the palette widget
- self.palette = gtk.Alignment()
- self.pack_start(self.palette)
+ self.palette = Gtk.Alignment()
+ self.pack_start(self.palette, True, True, 0)
# Draw the palette
- vbox = gtk.VBox()
+ vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
self.palette.add(vbox)
vbox.set_spacing(4)
- for i in xrange(len(self.colors)):
+ for i in range(len(self.colors)):
if i % self.width == 0:
- cur_hbox = gtk.HBox()
- vbox.pack_start(cur_hbox)
+ cur_box = Gtk.Box()
+ vbox.pack_start(cur_box, True, True, 0)
# add the color box
img = SimpleColorSelectorPaletteItem()
img.set_size_request(
@@ -186,8 +189,8 @@
img.set_color(self.colors[i])
self.buttons_lookup[self.colors[i]] = img
self.buttons.append(img)
- cur_hbox.pack_start(img, expand=False, fill=False)
- cur_hbox.set_spacing(4)
+ cur_box.pack_start(img, False, False, 0)
+ cur_box.set_spacing(4)
# make palette visible
self.palette.show_all()
@@ -207,16 +210,16 @@
"""Draws the palette of custom colors"""
self.__reset_custom_palette()
# (re-)create the palette widget
- self.custom_palette = gtk.Alignment(xscale=1.0)
+ self.custom_palette = Gtk.Alignment.new(0, 0, 1, 0)
self.custom_palette.set_padding(10, 0, 0, 0)
- self.pack_start(self.custom_palette)
+ self.pack_start(self.custom_palette, True, True, 0)
# Draw the previous color palette: only one line
- cc_vbox = gtk.VBox()
+ cc_vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
self.custom_palette.add(cc_vbox)
cc_vbox.set_spacing(4)
- cc_hbox = gtk.HBox()
- cc_vbox.pack_start(cc_hbox)
- for i in xrange(len(self.custom_colors)):
+ cc_box = Gtk.Box()
+ cc_vbox.pack_start(cc_box, True, True, 0)
+ for i in range(len(self.custom_colors)):
# add the color box
img = SimpleColorSelectorPaletteItem()
img.set_size_request(
@@ -225,16 +228,16 @@
if i < len(self.custom_colors):
img.set_color(self.custom_colors[i])
self.buttons_lookup[self.custom_colors[i]] = img
- cc_hbox.pack_start(img, expand=False, fill=False)
- cc_hbox.set_spacing(4)
+ cc_box.pack_start(img, False, False, 0)
+ cc_box.set_spacing(4)
self.cc_buttons.append(img)
# Draw the add button
- img = gtk.Image()
- img.set_from_stock(gtk.STOCK_ADD, gtk.ICON_SIZE_BUTTON)
- self.add_button = gtk.Button()
+ img = Gtk.Image()
+ img.set_from_stock(Gtk.STOCK_ADD, Gtk.IconSize.BUTTON)
+ self.add_button = Gtk.Button()
self.add_button.set_image(img)
self.add_button.set_label(_("Add custom color"))
- cc_vbox.pack_start(self.add_button, expand=True, fill=True)
+ cc_vbox.pack_start(self.add_button, True, True, 0)
self.add_button.connect("clicked", self.on_color_add)
# hide the custom palette if no custom color is defined
if len(self.custom_colors) == 0:
@@ -261,16 +264,19 @@
def on_color_add(self, widget):
"""Callback: when adding a new color, show the color definition
window, update the model, notifies the parent."""
- color_dialog = gtk.ColorSelectionDialog(_('Choose a color'))
- colorsel = color_dialog.colorsel
+ color_dialog = Gtk.ColorSelectionDialog(_('Choose a color'))
+#FIXME
+ colorsel = color_dialog.get_color_selection()
if self.selected_col is not None:
- color = gtk.gdk.color_parse(self.selected_col.color)
+ color = Gdk.color_parse(self.selected_col.color)
colorsel.set_current_color(color)
response = color_dialog.run()
new_color = colorsel.get_current_color()
# Check response_id and set color if required
- if response == gtk.RESPONSE_OK and new_color:
- strcolor = gtk.color_selection_palette_to_string([new_color])
+ if response == Gtk.ResponseType.OK and new_color:
+#FIXME
+ #strcolor = Gtk.color_selection_palette_to_string([new_color])
+ strcolor = new_color.to_string()
# Add the color to the palette and notify
if strcolor not in self.colors:
self.add_custom_color(strcolor)
@@ -330,9 +336,8 @@
self.selected_col.set_selected(False)
self.selected_col = None
-
-gobject.type_register(SimpleColorSelector)
-gobject.signal_new("color-changed", SimpleColorSelector,
- gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ())
-gobject.signal_new("color-added", SimpleColorSelector,
- gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ())
+GObject.type_register(SimpleColorSelector)
+GObject.signal_new("color-changed", SimpleColorSelector,
+ GObject.SignalFlags.RUN_FIRST, None, ())
+GObject.signal_new("color-added", SimpleColorSelector,
+ GObject.SignalFlags.RUN_FIRST, None, ())
=== modified file 'GTG/gtk/browser/tag_context_menu.py'
--- GTG/gtk/browser/tag_context_menu.py 2013-02-25 08:29:31 +0000
+++ GTG/gtk/browser/tag_context_menu.py 2013-09-25 16:29:12 +0000
@@ -26,19 +26,16 @@
like a color picker)
"""
-import pygtk
-pygtk.require('2.0')
-import gtk
+from gi.repository import Gtk
from GTG import _
-class TagContextMenu(gtk.Menu):
+class TagContextMenu(Gtk.Menu):
"""Context menu fo the tag i the sidebar"""
def __init__(self, req, vmanager, tag=None):
- self.__gobject_init__()
- gtk.Menu.__init__(self)
+ Gtk.Menu.__init__(self)
self.req = req
self.vmanager = vmanager
self.tag = tag
@@ -54,12 +51,12 @@
i.destroy()
if self.tag is not None:
# Color chooser FIXME: SHOULD BECOME A COLOR PICKER
- self.mi_cc = gtk.MenuItem()
+ self.mi_cc = Gtk.MenuItem()
self.mi_cc.set_label(_("Edit Tag..."))
self.append(self.mi_cc)
self.mi_cc.connect('activate', self.on_mi_cc_activate)
if self.tag.is_search_tag():
- self.mi_del = gtk.MenuItem()
+ self.mi_del = Gtk.MenuItem()
self.mi_del.set_label(_("Delete"))
self.append(self.mi_del)
self.mi_del.connect('activate', self.on_mi_del_activate)
=== modified file 'GTG/gtk/browser/tag_editor.py'
--- GTG/gtk/browser/tag_editor.py 2013-08-20 09:07:15 +0000
+++ GTG/gtk/browser/tag_editor.py 2013-09-25 16:29:12 +0000
@@ -27,45 +27,45 @@
for a tag.
"""
-import pygtk
-pygtk.require('2.0')
-import gobject
-import gtk
-import gtk.gdk as gdk
+from gi.repository import GObject, Gtk, Gdk, GdkPixbuf
from GTG import _
from GTG.tools.logger import Log
-from GTG.gtk.browser.simple_color_selector import SimpleColorSelector
-
-
-class TagIconSelector(gtk.Window):
+
+
+class TagIconSelector(Gtk.Window):
"""
TagIconSelector is intended as a floating window that allows to select
an icon for a tag. It display a list of icon in a popup window.
"""
def __init__(self):
- self.__gobject_init__(type=gtk.WINDOW_POPUP)
- gtk.Window.__init__(self)
+ # FIXME
+ #self.__gobject_init__(type=Gtk.WindowType.POPUP)
+ #GObject.GObject.__init__(self)
+ Gtk.Window.__init__(self)
+
self.loaded = False
self.selected_icon = None
self.symbol_model = None
# Build up the window
self.__build_window()
# Make it visible
- self.hide_all()
+ #self.hide_all()
+ # FIXME
+ self.hide()
def __build_window(self):
"""Build up the widget"""
- self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_POPUP_MENU)
- vbox = gtk.VBox()
+ self.set_type_hint(Gdk.WindowTypeHint.POPUP_MENU)
+ vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
self.add(vbox)
# icon list
- scld_win = gtk.ScrolledWindow()
- scld_win.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
- scld_win.set_shadow_type(gtk.SHADOW_ETCHED_IN)
- vbox.pack_start(scld_win, expand=True, fill=True)
- self.symbol_iv = gtk.IconView()
+ scld_win = Gtk.ScrolledWindow()
+ scld_win.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.ALWAYS)
+ scld_win.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
+ vbox.pack_start(scld_win, True, True, 0)
+ self.symbol_iv = Gtk.IconView()
self.symbol_iv.set_pixbuf_column(0)
self.symbol_iv.set_property("columns", 7)
self.symbol_iv.set_property("item-width", 32)
@@ -80,19 +80,19 @@
self.symbol_iv.set_size_request(40 * 7 + 12, 38 * 4)
scld_win.add(self.symbol_iv)
# icon remove button
- img = gtk.Image()
- img.set_from_stock(gtk.STOCK_REMOVE, gtk.ICON_SIZE_BUTTON)
- self.remove_bt = gtk.Button()
+ img = Gtk.Image()
+ img.set_from_stock(Gtk.STOCK_REMOVE, Gtk.IconSize.BUTTON)
+ self.remove_bt = Gtk.Button()
self.remove_bt.set_image(img)
self.remove_bt.set_label(_("Remove selected icon"))
- vbox.pack_start(self.remove_bt, fill=False, expand=False)
+ vbox.pack_start(self.remove_bt, False, False, 0)
# set the callbacks
self.symbol_iv.connect("selection-changed", self.on_selection_changed)
self.remove_bt.connect("clicked", self.on_remove_bt_clicked)
def __focus_out(self, widget, event):
"""Hides the window if the user clicks out of it"""
- win_ptr = self.window.get_pointer()
+ win_ptr = self.get_window().get_pointer()
win_size = self.get_size()
if not(0 <= win_ptr[0] <= win_size[0] and
0 <= win_ptr[1] <= win_size[1]):
@@ -106,12 +106,12 @@
libraries, e.g. bug #1079587. Gracefuly degradate and skip
the loading of a corrupted icon.
"""
- self.symbol_model = gtk.ListStore(gtk.gdk.Pixbuf, str)
- for icon in gtk.icon_theme_get_default().list_icons(context="Emblems"):
+ self.symbol_model = Gtk.ListStore(GdkPixbuf.Pixbuf, str)
+ for icon in Gtk.IconTheme.get_default().list_icons(context="Emblems"):
try:
- img = gtk.icon_theme_get_default().load_icon(icon, 16, 0)
+ img = Gtk.IconTheme.get_default().load_icon(icon, 16, 0)
self.symbol_model.append([img, icon])
- except gobject.GError:
+ except GObject.GError:
Log.error("Failed to load icon '%s'" % icon)
self.symbol_iv.set_model(self.symbol_model)
self.loaded = True
@@ -152,14 +152,22 @@
self.move(pos_x, pos_y)
self.grab_add()
# We grab the pointer in the calendar
- gdk.pointer_grab(self.window, True,
- gdk.BUTTON1_MASK | gdk.MOD2_MASK)
+# FIXME THIS DOES NOT WORK!!!!!!!
+ Gdk.pointer_grab(self.get_window(), True,
+ # Gdk.ModifierType.BUTTON1_MASK |
+ # Gdk.ModifierType.MOD2_MASK,
+ # FIXME!!!! JUST GUESSING THE TYPE
+ Gdk.EventMask.ALL_EVENTS_MASK,
+ None,
+ None,
+ 0,)
self.connect('button-press-event', self.__focus_out)
def close_selector(self):
"""Hides the window"""
self.hide()
- gtk.gdk.pointer_ungrab()
+#FIXME!!!
+ Gdk.pointer_ungrab(0)
self.grab_remove()
def get_selected_icon(self):
@@ -171,17 +179,17 @@
self.symbol_iv.unselect_all()
-gobject.type_register(TagIconSelector)
-gobject.signal_new("selection-changed", TagIconSelector,
- gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ())
-
-
-class TagEditor(gtk.Window):
+GObject.type_register(TagIconSelector)
+GObject.signal_new("selection-changed", TagIconSelector,
+ GObject.SignalFlags.RUN_FIRST, None, ())
+
+
+class TagEditor(Gtk.Window):
"""Window allowing to edit a tag's properties."""
def __init__(self, req, vmanager, tag=None):
- gtk.Window.__init__(self)
- self.__gobject_init__()
+ Gtk.Window.__init__(self)
+
self.req = req
self.vmanager = vmanager
self.tag = tag
@@ -193,7 +201,7 @@
self.tis_selection_changed_hid = None
self.tag_icon_selector = None
# Build up the window
- self.set_position(gtk.WIN_POS_CENTER)
+ self.set_position(Gtk.WindowPosition.CENTER)
self.set_title('Edit tag')
self.set_border_width(10)
self.set_resizable(False)
@@ -206,57 +214,59 @@
def __build_window(self):
"""Build up the widget"""
# toplevel widget
- self.top_vbox = gtk.VBox()
+ self.top_vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
self.add(self.top_vbox)
- # header line: icon, table with name and "hide in wv"
- self.hdr_align = gtk.Alignment()
- self.top_vbox.pack_start(self.hdr_align)
+ # header line: icon, grid with name and "hide in wv"
+ #FIXME
+ self.hdr_align = Gtk.Alignment()
+ self.top_vbox.pack_start(self.hdr_align, True, True, 0)
self.hdr_align.set_padding(0, 25, 0, 0)
- self.hdr_hbox = gtk.HBox()
- self.hdr_align.add(self.hdr_hbox)
- self.hdr_hbox.set_spacing(10)
+ self.hdr_box = Gtk.Box()
+ self.hdr_align.add(self.hdr_box)
+ self.hdr_box.set_spacing(10)
# Button to tag icon selector
- self.ti_bt = gtk.Button()
- self.ti_bt_label = gtk.Label()
+ self.ti_bt = Gtk.Button()
+ self.ti_bt_label = Gtk.Label()
self.ti_bt.add(self.ti_bt_label)
- self.hdr_hbox.pack_start(self.ti_bt)
+ self.hdr_box.pack_start(self.ti_bt, True, True, 0)
self.ti_bt.set_size_request(64, 64)
- self.ti_bt.set_relief(gtk.RELIEF_HALF)
+ self.ti_bt.set_relief(Gtk.ReliefStyle.HALF)
# vbox for tag name and hid in WV
- self.tp_table = gtk.Table(2, 2)
- self.hdr_hbox.pack_start(self.tp_table)
- self.tp_table.set_col_spacing(0, 5)
- self.tn_entry_lbl_align = gtk.Alignment(0, 0.5)
- self.tp_table.attach(self.tn_entry_lbl_align, 0, 1, 0, 1)
- self.tn_entry_lbl = gtk.Label()
+ self.tp_grid = Gtk.Grid()
+ self.hdr_box.pack_start(self.tp_grid, True, True, 0)
+ self.tp_grid.set_column_spacing(5)
+ self.tn_entry_lbl_align = Gtk.Alignment.new(0, 0.5, 0, 0)
+ self.tp_grid.add(self.tn_entry_lbl_align)
+ self.tn_entry_lbl = Gtk.Label()
self.tn_entry_lbl.set_markup("<span weight='bold'>%s</span>"
% _("Name : "))
self.tn_entry_lbl_align.add(self.tn_entry_lbl)
- self.tn_entry = gtk.Entry()
- self.tp_table.attach(self.tn_entry, 1, 2, 0, 1)
+ self.tn_entry = Gtk.Entry()
self.tn_entry.set_width_chars(20)
- self.tn_cb_lbl_align = gtk.Alignment(0, 0.5)
- self.tp_table.attach(self.tn_cb_lbl_align, 0, 1, 1, 2)
- self.tn_cb_lbl = gtk.Label(_("Show Tag in Work View :"))
+ self.tp_grid.attach(self.tn_entry, 1, 0, 1, 1)
+ self.tn_cb_lbl_align = Gtk.Alignment.new(0, 0.5, 0, 0)
+ self.tp_grid.attach(self.tn_cb_lbl_align, 0, 1, 1, 1)
+ self.tn_cb_lbl = Gtk.Label(label=_("Show Tag in Work View :"))
self.tn_cb_lbl_align.add(self.tn_cb_lbl)
- self.tn_cb = gtk.CheckButton()
- self.tp_table.attach(self.tn_cb, 1, 2, 1, 2)
+ self.tn_cb = Gtk.CheckButton()
+ self.tp_grid.attach(self.tn_cb, 1, 1, 1, 1)
# Tag color
- self.tc_vbox = gtk.VBox()
- self.top_vbox.pack_start(self.tc_vbox)
- self.tc_label_align = gtk.Alignment()
- self.tc_vbox.pack_start(self.tc_label_align)
+ self.tc_vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
+ self.top_vbox.pack_start(self.tc_vbox, True, True, 0)
+ self.tc_label_align = Gtk.Alignment()
+ self.tc_vbox.pack_start(self.tc_label_align, True, True, 0)
self.tc_label_align.set_padding(0, 0, 0, 0)
- self.tc_label = gtk.Label()
+ self.tc_label = Gtk.Label()
self.tc_label_align.add(self.tc_label)
self.tc_label.set_markup(
"<span weight='bold'>%s</span>" % _("Select Tag Color:"))
self.tc_label.set_alignment(0, 0.5)
# Tag color chooser
- self.tc_cc_align = gtk.Alignment(0.5, 0.5, 0, 0)
- self.tc_vbox.pack_start(self.tc_cc_align)
+ self.tc_cc_align = Gtk.Alignment.new(0.5, 0.5, 0, 0)
+ self.tc_vbox.pack_start(self.tc_cc_align, True, True, 0)
self.tc_cc_align.set_padding(15, 15, 10, 10)
- self.tc_cc_colsel = SimpleColorSelector()
+ #self.tc_cc_colsel = SimpleColorSelector()
+ self.tc_cc_colsel = Gtk.ColorChooserWidget()
self.tc_cc_align.add(self.tc_cc_colsel)
# Icon selector
self.tag_icon_selector = TagIconSelector()
@@ -272,15 +282,21 @@
self.tn_entry.connect('changed', self.on_tn_entry_changed)
self.tn_cb_clicked_hid = self.tn_cb.connect('clicked',
self.on_tn_cb_clicked)
- self.tc_cc_colsel.connect('color-changed', self.on_tc_colsel_changed)
- self.tc_cc_colsel.connect('color-added', self.on_tc_colsel_added)
+ #FIXME
+ #self.tc_cc_colsel.connect('color-changed', self.on_tc_colsel_changed)
+ #self.tc_cc_colsel.connect('color-added', self.on_tc_colsel_added)
+ self.tc_cc_colsel.connect('color-activated',
+ self.on_tc_colsel_activated)
self.connect('delete-event', self.on_close)
# allow fast closing by Escape key
- agr = gtk.AccelGroup()
+ #FIXME
+ '''
+ agr = Gtk.AccelGroup()
self.add_accel_group(agr)
- key, modifier = gtk.accelerator_parse('Escape')
- agr.connect_group(key, modifier, gtk.ACCEL_VISIBLE, self.on_close)
+ key, modifier = Gtk.accelerator_parse('Escape')
+ agr.connect_group(key, modifier, Gtk.AccelFlags.VISIBLE, self.on_close)
+ '''
def __set_default_values(self):
"""Configure the widget components with their initial default values"""
@@ -291,7 +307,7 @@
self.tag_icon_selector.handler_block(self.tis_selection_changed_hid)
# Default icon
markup = "<span size='small'>%s</span>" % _("Click To\nSet Icon")
- self.ti_bt_label.set_justify(gtk.JUSTIFY_CENTER)
+ self.ti_bt_label.set_justify(Gtk.Justification.CENTER)
self.ti_bt_label.set_markup(markup)
self.ti_bt_label.show()
self.__set_icon(None)
@@ -301,9 +317,13 @@
self.tn_cb.set_active(True)
# Name entry
self.tn_entry.set_text(_("Enter tag name here"))
- self.tn_entry.set_icon_from_stock(gtk.ENTRY_ICON_SECONDARY, None)
+ self.tn_entry.set_icon_from_stock(Gtk.EntryIconPosition.SECONDARY,
+ None)
# Color selection
- self.tc_cc_colsel.unselect_color()
+ #FIXME
+ #self.tc_cc_colsel.unselect_color()
+ self.tc_cc_colsel.set_use_alpha(False)
+ #self.tc_cc_colsel.set_rgba(self.tc_cc_colsel, None)
# Custom colors
self.custom_colors = self.config.get('custom_colors')
if len(self.custom_colors) > 0:
@@ -321,8 +341,8 @@
if icon is not None:
for i in self.ti_bt:
self.ti_bt.remove(i)
- ti_bt_img = gtk.image_new_from_icon_name(icon,
- gtk.ICON_SIZE_BUTTON)
+ ti_bt_img = Gtk.Image.new_from_icon_name(icon,
+ Gtk.IconSize.BUTTON)
ti_bt_img.show()
self.ti_bt.add(ti_bt_img)
else:
@@ -401,8 +421,11 @@
"""Callback: displays the tag icon selector widget next
to the button."""
rect = self.ti_bt.get_allocation()
- pos_x, pos_y = \
- self.ti_bt.window.get_origin()
+ # print self.ti_bt.get_window().get_origin()
+#FIXME
+ result, pos_x, pos_y = \
+ self.ti_bt.get_window().get_origin()
+ # self.ti_bt.window.get_origin()
self.tag_icon_selector.show_at_position(
pos_x + rect.x + rect.width + 2,
pos_y + rect.y)
@@ -417,17 +440,18 @@
self.tn_entry_last_recorded_value = self.tn_entry.get_text()
# check validity
if self.tn_entry_last_recorded_value.strip() == "":
- self.tn_entry.set_icon_from_stock(gtk.ENTRY_ICON_SECONDARY,
- gtk.STOCK_DIALOG_ERROR)
+ self.tn_entry.set_icon_from_stock(Gtk.EntryIconPosition.SECONDARY,
+ Gtk.STOCK_DIALOG_ERROR)
else:
- self.tn_entry.set_icon_from_stock(gtk.ENTRY_ICON_SECONDARY, None)
+ self.tn_entry.set_icon_from_stock(
+ Gtk.EntryIconPosition.SECONDARY, None)
# filter out change requests to reduce commit overhead
if self.tn_entry_watch_id is None:
# There is no watchers for the text entry. Register one.
# Also, wait 1 second before commiting the change in order to
# reduce rename requests
tn_entry_changes = self.watch_tn_entry_changes
- self.tn_entry_watch_id = gobject.timeout_add(1000,
+ self.tn_entry_watch_id = GObject.timeout_add(1000,
tn_entry_changes)
def on_tn_cb_clicked(self, widget):
@@ -448,6 +472,19 @@
else:
self.tag.del_attribute('color')
+ def on_tc_colsel_activated(self, widget, color):
+ """Callback: update the tag color depending on the current color
+ selection"""
+ print("activated", widget, color, " <--- ignoring for now")
+ return
+ #color = self.tc_cc_colsel.get_rgba().to_color()
+ color = color.to_color()
+ if self.tag is not None:
+ if color is not None:
+ self.tag.set_attribute('color', color)
+ else:
+ self.tag.del_attribute('color')
+
def on_tc_colsel_added(self, widget):
"""Callback: if a new color is added, we register it in the
configuration"""
=== renamed file 'GTG/gtk/browser/taskbrowser.glade' => 'GTG/gtk/browser/taskbrowser.ui'
--- GTG/gtk/browser/taskbrowser.glade 2012-08-08 22:24:05 +0000
+++ GTG/gtk/browser/taskbrowser.ui 2013-09-25 16:29:12 +0000
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <requires lib="gtk+" version="2.16"/>
- <!-- interface-naming-policy toplevel-contextual -->
+ <!-- interface-requires gtk+ 3.0 -->
<object class="GtkWindow" id="MainWindow">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Getting Things GNOME!</property>
@@ -10,9 +9,10 @@
<signal name="configure-event" handler="on_move" swapped="no"/>
<signal name="size-allocate" handler="on_size_allocate" swapped="no"/>
<child>
- <object class="GtkVBox" id="master_vbox">
+ <object class="GtkBox" id="master_vbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
<child>
<object class="GtkMenuBar" id="browser_menu">
<property name="visible">True</property>
@@ -21,7 +21,6 @@
<object class="GtkMenuItem" id="bm_task">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="label" translatable="yes">_Tasks</property>
<property name="use_underline">True</property>
<child type="submenu">
@@ -34,7 +33,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Create a new task</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="image">bm_img_task</property>
<property name="use_stock">False</property>
@@ -48,7 +46,6 @@
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="image">bm_img_subtask</property>
<property name="use_stock">False</property>
@@ -62,7 +59,6 @@
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<property name="accel_group">accelgroup1</property>
@@ -81,7 +77,6 @@
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="image">bm_img_done</property>
<property name="use_stock">False</property>
@@ -95,7 +90,6 @@
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="image">bm_img_dismiss</property>
<property name="use_stock">False</property>
@@ -109,7 +103,6 @@
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<property name="accel_group">accelgroup1</property>
@@ -127,7 +120,6 @@
<property name="label">gtk-quit</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<property name="accel_group">accelgroup1</property>
@@ -142,7 +134,6 @@
<object class="GtkMenuItem" id="bm_edit">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="label" translatable="yes">_Edit</property>
<property name="use_underline">True</property>
<child type="submenu">
@@ -153,7 +144,6 @@
<object class="GtkImageMenuItem" id="edit_undo">
<property name="label">gtk-undo</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<property name="accel_group">accelgroup1</property>
@@ -163,7 +153,6 @@
<object class="GtkImageMenuItem" id="edit_redo">
<property name="label">gtk-redo</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<property name="accel_group">accelgroup1</property>
@@ -178,7 +167,6 @@
<object class="GtkMenuItem" id="plugins_mi">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="label">P_lugins</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_edit_plugins_activate" swapped="no"/>
@@ -188,7 +176,6 @@
<object class="GtkMenuItem" id="backends_mi">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="label">_Synchronization Services</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_edit_backends_activate" swapped="no"/>
@@ -205,7 +192,6 @@
<property name="label">gtk-preferences</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<property name="accel_group">accelgroup1</property>
@@ -220,7 +206,6 @@
<object class="GtkMenuItem" id="menu_view">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="label" translatable="yes">_View</property>
<property name="use_underline">True</property>
<child type="submenu">
@@ -231,7 +216,6 @@
<object class="GtkCheckMenuItem" id="view_workview">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="label" translatable="yes">_Work View</property>
<property name="use_underline">True</property>
<signal name="toggled" handler="on_view_workview_toggled" swapped="no"/>
@@ -247,7 +231,6 @@
<object class="GtkCheckMenuItem" id="view_sidebar">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="label" translatable="yes">_Tags Sidebar</property>
<property name="use_underline">True</property>
<signal name="toggled" handler="on_view_sidebar_toggled" swapped="no"/>
@@ -257,7 +240,6 @@
<object class="GtkCheckMenuItem" id="view_closed">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="label" translatable="yes">_Closed Tasks Pane</property>
<property name="use_underline">True</property>
<signal name="toggled" handler="on_view_closed_toggled" swapped="no"/>
@@ -267,7 +249,6 @@
<object class="GtkCheckMenuItem" id="view_toolbar">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="label" translatable="yes">T_oolbar</property>
<property name="use_underline">True</property>
<signal name="toggled" handler="on_view_toolbar_toggled" swapped="no"/>
@@ -277,7 +258,6 @@
<object class="GtkCheckMenuItem" id="view_quickadd">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="label" translatable="yes">_Quick Add Entry</property>
<property name="use_underline">True</property>
<signal name="toggled" handler="on_view_quickadd_toggled" swapped="no"/>
@@ -290,7 +270,6 @@
<child>
<object class="GtkMenuItem" id="plugin_mi">
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="label" translatable="yes">_Plugins</property>
<property name="use_underline">True</property>
<child type="submenu">
@@ -305,7 +284,6 @@
<object class="GtkMenuItem" id="help_mi">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="label" translatable="yes">_Help</property>
<property name="use_underline">True</property>
<child type="submenu">
@@ -318,7 +296,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Open GTG help</property>
- <property name="use_action_appearance">False</property>
<property name="image">image7</property>
<property name="use_stock">False</property>
<property name="accel_group">accelgroup1</property>
@@ -337,7 +314,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Help to translate GTG into your language</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<property name="accel_group">accelgroup1</property>
@@ -350,7 +326,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Report a problem to GTG developers</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<property name="accel_group">accelgroup1</property>
@@ -368,7 +343,6 @@
<property name="label">gtk-about</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<property name="accel_group">accelgroup1</property>
@@ -387,9 +361,10 @@
</packing>
</child>
<child>
- <object class="GtkVBox" id="vbox_toolbars">
+ <object class="GtkBox" id="vbox_toolbars">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
<child>
<object class="GtkToolbar" id="task_toolbar">
<property name="visible">True</property>
@@ -398,7 +373,6 @@
<object class="GtkToolButton" id="new_task_b">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="is_important">True</property>
<property name="label" translatable="yes">New Task</property>
<property name="icon_name">gtg-task-new</property>
@@ -412,7 +386,6 @@
<child>
<object class="GtkToolButton" id="new_subtask_b">
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="label" translatable="yes">New Subtask</property>
<property name="icon_name">gtg-task-new</property>
<signal name="clicked" handler="on_add_subtask" swapped="no"/>
@@ -426,7 +399,6 @@
<object class="GtkToolButton" id="edit_b">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="visible_horizontal">False</property>
<property name="visible_vertical">False</property>
<property name="label" translatable="yes">Edit</property>
@@ -450,7 +422,6 @@
<child>
<object class="GtkToolButton" id="Undo">
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="label" translatable="yes">Undo</property>
<property name="stock_id">gtk-undo</property>
</object>
@@ -462,7 +433,6 @@
<child>
<object class="GtkToolButton" id="Redo">
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="label" translatable="yes">Redo</property>
<property name="stock_id">gtk-redo</property>
</object>
@@ -486,7 +456,6 @@
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="is_important">True</property>
<property name="label" translatable="yes">Mark as Done</property>
<property name="icon_name">gtg-task-done</property>
@@ -502,7 +471,6 @@
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="label" translatable="yes">Dismiss</property>
<property name="icon_name">gtg-task-dismiss</property>
<signal name="clicked" handler="on_dismiss_task" swapped="no"/>
@@ -516,7 +484,6 @@
<object class="GtkToolButton" id="delete_b">
<property name="sensitive">False</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="label" translatable="yes">Delete</property>
<property name="icon_name">edit-delete</property>
<signal name="clicked" handler="on_delete_task" swapped="no"/>
@@ -540,7 +507,6 @@
<object class="GtkToggleToolButton" id="workview_toggle">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="is_important">True</property>
<property name="label" translatable="yes">Work View</property>
<property name="stock_id">gtk-index</property>
@@ -566,15 +532,16 @@
</packing>
</child>
<child>
- <object class="GtkHPaned" id="hpaned1">
+ <object class="GtkPaned" id="hpaned1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
- <object class="GtkVBox" id="sidebar_vbox">
+ <object class="GtkBox" id="sidebar_vbox">
<property name="width_request">75</property>
<property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
<child>
- <object class="GtkHBox" id="hbox4">
+ <object class="GtkBox" id="box4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
@@ -608,7 +575,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="use_action_appearance">False</property>
<property name="relief">none</property>
<signal name="clicked" handler="on_view_sidebar_toggled" swapped="no"/>
<child>
@@ -643,8 +609,6 @@
<object class="GtkScrolledWindow" id="sidebar-scroll">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="hscrollbar_policy">automatic</property>
- <property name="vscrollbar_policy">automatic</property>
<property name="shadow_type">in</property>
<child>
<placeholder/>
@@ -675,11 +639,12 @@
</packing>
</child>
<child>
- <object class="GtkVBox" id="main_vbox">
+ <object class="GtkBox" id="main_vbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
<child>
- <object class="GtkHBox" id="quickadd_pane">
+ <object class="GtkBox" id="quickadd_pane">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
@@ -692,9 +657,6 @@
<property name="invisible_char">●</property>
<property name="secondary_icon_stock">gtk-clear</property>
<property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">True</property>
- <property name="primary_icon_sensitive">True</property>
- <property name="secondary_icon_sensitive">True</property>
<signal name="changed" handler="on_quickadd_field_changed" swapped="no"/>
<signal name="activate" handler="on_quickadd_field_activate" swapped="no"/>
<signal name="icon-press" handler="on_quickadd_field_icon_press" swapped="no"/>
@@ -714,9 +676,10 @@
</packing>
</child>
<child>
- <object class="GtkVPaned" id="vpaned1">
+ <object class="GtkPaned" id="vpaned1">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="orientation">vertical</property>
<child>
<object class="GtkNotebook" id="main_notebook">
<property name="visible">True</property>
@@ -728,7 +691,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">never</property>
- <property name="vscrollbar_policy">automatic</property>
<child>
<placeholder/>
</child>
@@ -794,9 +756,10 @@
<property name="resizable">False</property>
<property name="window_position">center-on-parent</property>
<property name="type_hint">dialog</property>
- <property name="program_name" translatable="yes">Getting Things GNOME!</property>
+ <property name="program_name">Getting Things GNOME!</property>
<property name="copyright" translatable="yes">Copyright © 2008-2012 Lionel Dricot, Bertrand Rousseau</property>
- <property name="comments" translatable="yes">GTG is a personal tasks and TODO-list items organizer for the GNOME desktop environment.</property>
+ <property name="comments" translatable="yes">GTG is a personal tasks and TODO-list items
+organizer for the GNOME desktop environment.</property>
<property name="website_label" translatable="yes">GTG website</property>
<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.
@@ -810,12 +773,13 @@
<signal name="delete-event" handler="on_about_delete" swapped="no"/>
<signal name="response" handler="on_about_close" swapped="no"/>
<child internal-child="vbox">
- <object class="GtkVBox" id="about_dialog_vbox">
+ <object class="GtkBox" id="about_dialog_vbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
- <object class="GtkHButtonBox" id="dialog-action_area2">
+ <object class="GtkButtonBox" id="dialog-action_area2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
@@ -863,7 +827,6 @@
<property name="label">gtk-edit</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<property name="accel_group">accelgroup1</property>
@@ -881,7 +844,6 @@
<property name="label" translatable="yes">Mark as Not Done</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="image">ctcm_img_mark_not_done</property>
<property name="use_stock">False</property>
@@ -894,7 +856,6 @@
<property name="label" translatable="yes">Und_ismiss</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="image">tcm_img_undismiss</property>
<property name="use_stock">False</property>
@@ -907,7 +868,6 @@
<property name="label">gtk-delete</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<property name="accel_group">accelgroup1</property>
@@ -972,7 +932,6 @@
<property name="label" translatable="yes">Add a subtask</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="image">tcm_img_add_subtask</property>
<property name="use_stock">False</property>
@@ -985,7 +944,6 @@
<property name="label">gtk-edit</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<property name="accel_group">accelgroup1</property>
@@ -1003,7 +961,6 @@
<property name="label" translatable="yes">Mark as _Done</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="image">tcm_img_mark_done</property>
<property name="use_stock">False</property>
@@ -1016,7 +973,6 @@
<property name="label" translatable="yes">D_ismiss</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="image">tcm_img_dismiss</property>
<property name="use_stock">False</property>
@@ -1029,7 +985,6 @@
<property name="label">gtk-delete</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<property name="accel_group">accelgroup1</property>
@@ -1047,7 +1002,6 @@
<property name="label" translatable="yes">_Set Start Date</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">False</property>
<child type="submenu">
@@ -1059,7 +1013,6 @@
<property name="label" translatable="yes">T_oday</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">False</property>
<signal name="activate" handler="on_mark_as_started" swapped="no"/>
@@ -1070,7 +1023,6 @@
<property name="label" translatable="yes">_Tomorrow</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">False</property>
<signal name="activate" handler="on_start_for_tomorrow" swapped="no"/>
@@ -1081,7 +1033,6 @@
<property name="label" translatable="yes">Next _Week</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">False</property>
<signal name="activate" handler="on_start_for_next_week" swapped="no"/>
@@ -1092,7 +1043,6 @@
<property name="label" translatable="yes">Next _Month</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">False</property>
<signal name="activate" handler="on_start_for_next_month" swapped="no"/>
@@ -1103,7 +1053,6 @@
<property name="label" translatable="yes">Next _Year</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">False</property>
<signal name="activate" handler="on_start_for_next_year" swapped="no"/>
@@ -1120,7 +1069,6 @@
<property name="label" translatable="yes">_Clear Start Date</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">False</property>
<signal name="activate" handler="on_start_clear" swapped="no"/>
@@ -1135,7 +1083,6 @@
<property name="label" translatable="yes">Set Due Date</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">False</property>
<child type="submenu">
@@ -1147,7 +1094,6 @@
<property name="label" translatable="yes">T_oday</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">False</property>
<signal name="activate" handler="on_set_due_today" swapped="no"/>
@@ -1158,7 +1104,6 @@
<property name="label" translatable="yes">_Tomorrow</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">False</property>
<signal name="activate" handler="on_set_due_tomorrow" swapped="no"/>
@@ -1169,7 +1114,6 @@
<property name="label" translatable="yes">Next _Week</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">False</property>
<signal name="activate" handler="on_set_due_next_week" swapped="no"/>
@@ -1180,7 +1124,6 @@
<property name="label" translatable="yes">Next _Month</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">False</property>
<signal name="activate" handler="on_set_due_next_month" swapped="no"/>
@@ -1191,7 +1134,6 @@
<property name="label" translatable="yes">Next _Year</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">False</property>
<signal name="activate" handler="on_set_due_next_year" swapped="no"/>
@@ -1208,7 +1150,6 @@
<property name="label" translatable="yes">_Now</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">False</property>
<signal name="activate" handler="on_set_due_now" swapped="no"/>
@@ -1219,7 +1160,6 @@
<property name="label" translatable="yes">_Soon</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">False</property>
<signal name="activate" handler="on_set_due_soon" swapped="no"/>
@@ -1230,7 +1170,6 @@
<property name="label" translatable="yes">_Someday</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">False</property>
<signal name="activate" handler="on_set_due_someday" swapped="no"/>
@@ -1247,7 +1186,6 @@
<property name="label" translatable="yes">_Clear Due Date</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">False</property>
<signal name="activate" handler="on_set_due_clear" swapped="no"/>
@@ -1268,7 +1206,6 @@
<property name="label" translatable="yes">Modify Tags...</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="image">image3</property>
<property name="use_stock">False</property>
<signal name="activate" handler="on_modify_tags" swapped="no"/>
=== modified file 'GTG/gtk/browser/treeview_factory.py'
--- GTG/gtk/browser/treeview_factory.py 2013-05-16 09:10:54 +0000
+++ GTG/gtk/browser/treeview_factory.py 2013-09-25 16:29:12 +0000
@@ -17,9 +17,7 @@
# this program. If not, see <http://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------------
-import gtk
-import gobject
-import pango
+from gi.repository import GObject, Gtk, Pango
import xml.sax.saxutils as saxutils
import locale
@@ -150,7 +148,9 @@
return sort
def title_sorting(self, task1, task2, order):
- return cmp(task1.get_title(), task2.get_title())
+ t1 = task1.get_title()
+ t2 = task2.get_title()
+ return (t1 > t2) - (t1 < t2)
def __date_comp(self, task1, task2, para, order):
'''This is a quite complex method to sort tasks by date,
@@ -174,15 +174,15 @@
else:
raise ValueError(
'invalid date comparison parameter: %s') % para
- sort = cmp(t2, t1)
+ sort = (t2 > t1) - (t2 < t1)
else:
sort = 0
# local function
def reverse_if_descending(s):
- """Make a cmp() result relative to the top instead of following
+ """Make a cmpare result relative to the top instead of following
user-specified sort direction"""
- if order == gtk.SORT_ASCENDING:
+ if order == Gtk.SortType.ASCENDING:
return s
else:
return -1 * s
@@ -193,14 +193,16 @@
t1_tags.sort()
t2_tags = task2.get_tags_name()
t2_tags.sort()
- sort = reverse_if_descending(cmp(t1_tags, t2_tags))
+ cmp_tags = (t1_tags > t2_tags) - (t1_tags < t2_tags)
+ sort = reverse_if_descending(cmp_tags)
if sort == 0: # Break ties by sorting by title
t1_title = task1.get_title()
t2_title = task2.get_title()
t1_title = locale.strxfrm(t1_title)
t2_title = locale.strxfrm(t2_title)
- sort = reverse_if_descending(cmp(t1_title, t2_title))
+ cmp_title = (t1_title > t2_title) - (t1_title < t2_title)
+ sort = reverse_if_descending(cmp_title)
return sort
@@ -234,7 +236,7 @@
t1_name = locale.strxfrm(t1.get_name())
t2_name = locale.strxfrm(t2.get_name())
if not t1_sp and not t2_sp:
- return cmp(t1_name, t2_name)
+ return (t1_name > t2_name) - (t1_name < t2_name)
elif not t1_sp and t2_sp:
return 1
elif t1_sp and not t2_sp:
@@ -242,7 +244,7 @@
else:
t1_order = t1.get_attribute("order")
t2_order = t2.get_attribute("order")
- return cmp(t1_order, t2_order)
+ return (t1_order > t2_order) - (t1_order < t2_order)
def ontag_task_dnd(self, source, target):
task = self.req.get_task(source)
@@ -262,7 +264,7 @@
# Tag id
col_name = 'tag_id'
col = {}
- col['renderer'] = ['markup', gtk.CellRendererText()]
+ col['renderer'] = ['markup', Gtk.CellRendererText()]
col['value'] = [str, lambda node: node.get_id()]
col['visible'] = False
col['order'] = 0
@@ -276,7 +278,7 @@
render_tags.set_property('ypad', 3)
col['title'] = _("Tags")
col['renderer'] = ['tag', render_tags]
- col['value'] = [gobject.TYPE_PYOBJECT, lambda node: node]
+ col['value'] = [GObject.TYPE_PYOBJECT, lambda node: node]
col['expandable'] = False
col['resizable'] = False
col['order'] = 1
@@ -285,7 +287,7 @@
# Tag names
col_name = 'tagname'
col = {}
- render_text = gtk.CellRendererText()
+ render_text = Gtk.CellRendererText()
render_text.set_property('ypad', 3)
col['renderer'] = ['markup', render_text]
col['value'] = [str, self.tag_name]
@@ -297,7 +299,7 @@
# Tag count
col_name = 'tagcount'
col = {}
- render_text = gtk.CellRendererText()
+ render_text = Gtk.CellRendererText()
render_text.set_property('xpad', 3)
render_text.set_property('ypad', 3)
render_text.set_property('xalign', 1.0)
@@ -369,7 +371,7 @@
# invisible 'task_id' column
col_name = 'task_id'
col = {}
- col['renderer'] = ['markup', gtk.CellRendererText()]
+ col['renderer'] = ['markup', Gtk.CellRendererText()]
col['value'] = [str, lambda node: node.get_id()]
col['visible'] = False
col['order'] = 0
@@ -385,8 +387,8 @@
# invisible 'title' column
col_name = 'title'
col = {}
- render_text = gtk.CellRendererText()
- render_text.set_property("ellipsize", pango.ELLIPSIZE_END)
+ render_text = Gtk.CellRendererText()
+ render_text.set_property("ellipsize", Pango.EllipsizeMode.END)
col['renderer'] = ['markup', render_text]
col['value'] = [str, self.task_title_column]
col['visible'] = False
@@ -400,7 +402,7 @@
render_tags = CellRendererTags()
render_tags.set_property('xalign', 0.0)
col['renderer'] = ['tag_list', render_tags]
- col['value'] = [gobject.TYPE_PYOBJECT, self.task_tags_column]
+ col['value'] = [GObject.TYPE_PYOBJECT, self.task_tags_column]
col['expandable'] = False
col['resizable'] = False
col['order'] = 1
@@ -410,8 +412,8 @@
col_name = 'label'
col = {}
col['title'] = _("Title")
- render_text = gtk.CellRendererText()
- render_text.set_property("ellipsize", pango.ELLIPSIZE_END)
+ render_text = Gtk.CellRendererText()
+ render_text.set_property("ellipsize", Pango.EllipsizeMode.END)
col['renderer'] = ['markup', render_text]
col['value'] = [str, self.task_label_column]
col['expandable'] = True
@@ -434,8 +436,10 @@
treeview.set_rules_hint(False)
treeview.set_multiple_selection(True)
# Updating the unactive color (same for everyone)
- self.unactive_color = \
- treeview.style.text[gtk.STATE_INSENSITIVE].to_string()
+ color = treeview.get_style_context().get_color(
+ Gtk.StateFlags.INSENSITIVE)
+ # Convert color into #RRRGGGBBB
+ self.unactive_color = color.to_color().to_string()
return treeview
def build_tag_treeview(self, tree, desc):
@@ -448,8 +452,11 @@
treeview.set_dnd_name('gtg/tag-iter-str')
treeview.set_dnd_external('gtg/task-iter-str', self.ontag_task_dnd)
# Updating the unactive color (same for everyone)
- self.unactive_color = \
- treeview.style.text[gtk.STATE_INSENSITIVE].to_string()
+ color = treeview.get_style_context().get_color(
+ Gtk.StateFlags.INSENSITIVE)
+ # Convert color into #RRRGGGBBB
+ self.unactive_color = color.to_color().to_string()
+
treeview.set_sort_column('tag_id')
self.tags_view = treeview
return treeview
=== modified file 'GTG/gtk/colors.py'
--- GTG/gtk/colors.py 2013-02-25 07:35:07 +0000
+++ GTG/gtk/colors.py 2013-09-25 16:29:12 +0000
@@ -17,7 +17,8 @@
# this program. If not, see <http://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------------
-import gtk
+from gi.repository import Gdk
+from functools import reduce
# Take list of Tags and give the background color that should be applied
# The returned color might be None (in which case, the default is used)
@@ -25,7 +26,7 @@
def background_color(tags, bgcolor=None):
if not bgcolor:
- bgcolor = gtk.gdk.color_parse("#FFFFFF")
+ bgcolor = Gdk.color_parse("#FFFFFF")
# Compute color
my_color = None
color_count = 0.0
@@ -35,7 +36,7 @@
for my_tag in tags:
my_color_str = my_tag.get_attribute("color")
if my_color_str:
- my_color = gtk.gdk.color_parse(my_color_str)
+ my_color = Gdk.color_parse(my_color_str)
color_count = color_count + 1
red = red + my_color.red
green = green + my_color.green
@@ -52,7 +53,7 @@
green = int(green * alpha + bgcolor.green * (1 - alpha))
blue = int(blue * alpha + bgcolor.blue * (1 - alpha))
- my_color = gtk.gdk.Color(red, green, blue).to_string()
+ my_color = Gdk.Color(red, green, blue).to_string()
return my_color
@@ -82,9 +83,11 @@
'''
Calls get_colored_tag_markup for each tag_name in tag_names
'''
- tag_markups = map(lambda t: get_colored_tag_markup(req, t), tag_names)
+ tag_markups = [get_colored_tag_markup(req, t) for t in tag_names]
tags_txt = ""
if tag_markups:
# reduce crashes if applied to an empty list
tags_txt = reduce(lambda a, b: a + ", " + b, tag_markups)
return tags_txt
+
+# -----------------------------------------------------------------------------
=== modified file 'GTG/gtk/crashhandler.py'
--- GTG/gtk/crashhandler.py 2013-02-25 07:35:07 +0000
+++ GTG/gtk/crashhandler.py 2013-09-25 16:29:12 +0000
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
# Copyright 2010 David D. Lowe
# All rights reserved.
#
@@ -23,9 +23,9 @@
"""GTK except hook for your applications.
To use, simply import this module and call gtkcrashhandler.initialize().
-Import this module before calling gtk.main().
+Import this module before calling Gtk.main().
-If gtkcrashhandler cannot import gtk, pygtk, pango or gobject,
+If gtkcrashhandler cannot import Gtk, Pango or GObject,
gtkcrashhandler will print a warning and use the default excepthook.
If you're using multiple threads, use gtkcrashhandler_thread decorator."""
@@ -34,24 +34,22 @@
import os
import time
import signal
+import traceback
+import threading
from contextlib import contextmanager
from GTG import info
try:
- import pygtk
- pygtk.require("2.0") # not tested on earlier versions
- import gtk
- import pango
- import gobject
- _gtk_initialized = True
+ from gi.repository import GObject, Gtk, Pango
except Exception:
- print >> sys.stderr, "gtkcrashhandler could not load GTK 2.0"
+ print("gtkcrashhandler could not load GTK 3.0", file=sys.stderr)
_gtk_initialized = False
-import traceback
+else:
+ _gtk_initialized = True
+
from gettext import gettext as _
-import threading
APP_NAME = None
MESSAGE = _("We're terribly sorry. Could you help us fix the problem by "
@@ -99,7 +97,7 @@
if thread:
if not isinstance(thread, threading._MainThread):
tb = "Exception in thread %s:\n%s" % (thread.getName(), tb)
- print >> sys.stderr, tb
+ print(tb, file=sys.stderr)
# determine whether to add a "Report problem..." button
add_apport_button = False
@@ -109,7 +107,7 @@
try:
from apport.fileutils import likely_packaged
try:
- filename = os.path.realpath(os.path.join(os.getcwdu(),
+ filename = os.path.realpath(os.path.join(os.getcwd(),
sys.argv[0]))
except:
filename = os.path.realpath("/proc/%i/exe" % os.getpid())
@@ -176,17 +174,17 @@
if dialog is not None:
return 1
- dialog = gtk.Dialog(title)
+ dialog = Gtk.Dialog(title)
# title Label
- label = gtk.Label()
+ label = Gtk.Label()
label.set_markup("<b>%s</b>" % _("It looks like an error has occurred."))
label.set_alignment(0, 0.5)
- dialog.get_content_area().pack_start(label, False)
+ dialog.get_content_area().pack_start(label, False, True, 0)
# message Label
global MESSAGE
- text_label = gtk.Label()
+ text_label = Gtk.Label()
text_label.set_markup(MESSAGE)
text_label.set_alignment(0, 0.5)
text_label.set_line_wrap(True)
@@ -197,36 +195,36 @@
text_label.connect("size-allocate", text_label_size_allocate)
if not MESSAGE == "":
- dialog.get_content_area().pack_start(text_label, False)
+ dialog.get_content_area().pack_start(text_label, False, True, 0)
# TextView with error_string
- buffer = gtk.TextBuffer()
+ buffer = Gtk.TextBuffer()
buffer.set_text(error_string)
- textview = gtk.TextView()
+ textview = Gtk.TextView()
textview.set_buffer(buffer)
textview.set_editable(False)
try:
- textview.modify_font(pango.FontDescription("monospace 8"))
+ textview.override_font(Pango.FontDescription("monospace 8"))
except Exception:
- print >> sys.stderr, "gtkcrashhandler: modify_font raised an exception"
+ print("gtkcrashhandler: override_font raised an exception", file=sys.stderr)
# allow scrolling of textview
- scrolled = gtk.ScrolledWindow()
- scrolled.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
+ scrolled = Gtk.ScrolledWindow()
+ scrolled.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
scrolled.add_with_viewport(textview)
# hide the textview in an Expander widget
- expander = gtk.expander_new_with_mnemonic(_("_Details"))
+ expander = Gtk.expander_new_with_mnemonic(_("_Details"))
expander.add(scrolled)
expander.connect('activate', on_expanded)
- dialog.get_content_area().pack_start(expander, True)
+ dialog.get_content_area().pack_start(expander, True, True, 0)
# add buttons
if add_apport_button:
dialog.add_button(_("_Report this problem..."), 3)
# If we're have multiple threads, or if we're in a GTK callback,
# execution can continue normally in other threads, so add button
- if gtk.main_level() > 0 or threading.activeCount() > 1:
+ if Gtk.main_level() > 0 or threading.activeCount() > 1:
dialog.add_button(_("_Ignore the error"), 1)
dialog.add_button(("_Close the program"), 2)
dialog.set_default_response(2)
@@ -275,28 +273,28 @@
def gtkcrashhandler_wrapped_run(*args, **kwargs):
try:
run(*args, **kwargs)
- except Exception, ee:
+ except Exception as ee:
lock = threading.Lock()
lock.acquire()
tb = sys.exc_info()[2]
- if gtk.main_level() > 0:
- gobject.idle_add(
+ if Gtk.main_level() > 0:
+ GObject.idle_add(
lambda ee=ee, tb=tb, thread=threading.currentThread():
_replacement_excepthook(ee.__class__, ee, tb,
thread=thread))
else:
time.sleep(0.1) # ugly hack, seems like threads that are
- # started before running gtk.main() cause
+ # started before running Gtk.main() cause
# this one to crash.
- # This delay allows gtk.main() to initialize
+ # This delay allows Gtk.main() to initialize
# properly.
- # My advice: run gtk.main() before starting
- # any threads or don't run gtk.main() at all
+ # My advice: run Gtk.main() before starting
+ # any threads or don't run Gtk.main() at all
_replacement_excepthook(ee.__class__, ee, tb,
thread=threading.currentThread())
lock.release()
- # return wrapped run if gtkcrashhandler has been initialized
+ # return wrapped run if Gtkcrashhandler has been initialized
global _gtk_initialized, _old_sys_excepthook
if _gtk_initialized and _old_sys_excepthook:
return gtkcrashhandler_wrapped_run
@@ -307,7 +305,7 @@
# throw test exception
initialize(app_name="gtkcrashhandler", message="Don't worry, though. This "
"is just a test. To use the code properly, call "
- "gtkcrashhandler.initialize() in your PyGTK app to "
+ "gtkcrashhandler.initialize() in your GTK app to "
"automatically catch any Python exceptions like this.")
class DoNotRunException(Exception):
=== modified file 'GTG/gtk/dbuswrapper.py'
--- GTG/gtk/dbuswrapper.py 2013-02-25 08:29:31 +0000
+++ GTG/gtk/dbuswrapper.py 2013-09-25 16:29:12 +0000
@@ -38,7 +38,7 @@
so these need to be converted into blank values D-Bus accepts.
@return: Cleaned up dictionary
"""
- for k, v in data.items():
+ for k, v in list(data.items()):
# Manually specify an arbitrary content type for empty Python arrays
# because D-Bus can't handle the type conversion for empty arrays
if not v and isinstance(v, list):
=== modified file 'GTG/gtk/delete_dialog.py'
--- GTG/gtk/delete_dialog.py 2013-02-25 08:29:31 +0000
+++ GTG/gtk/delete_dialog.py 2013-09-25 16:29:12 +0000
@@ -18,7 +18,7 @@
# -----------------------------------------------------------------------------
-import gtk
+from gi.repository import Gtk
from GTG import _, ngettext
from GTG.gtk import ViewConfig
@@ -34,8 +34,8 @@
# Tags which must be updated
self.update_tags = []
# Load window tree
- self.builder = gtk.Builder()
- self.builder.add_from_file(ViewConfig.DELETE_GLADE_FILE)
+ self.builder = Gtk.Builder()
+ self.builder.add_from_file(ViewConfig.DELETE_UI_FILE)
signals = {"on_delete_confirm": self.on_delete_confirm,
"on_delete_cancel": lambda x: x.hide, }
self.builder.connect_signals(signals)
=== 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 2013-09-25 16:29:12 +0000
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <requires lib="gtk+" version="2.16"/>
+ <!-- interface-requires gtk+ 3.0 -->
<object class="GtkDialog" id="confirm_delete">
<property name="can_focus">False</property>
<property name="border_width">5</property>
@@ -28,7 +28,7 @@
<property name="use_action_appearance">False</property>
<signal name="released" handler="on_delete_cancel" swapped="no"/>
<child>
- <object class="GtkHBox" id="cd-hbox2">
+ <object class="GtkBox" id="cd-box2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
@@ -75,7 +75,7 @@
<signal name="activate" handler="on_delete_confirm" swapped="no"/>
<signal name="released" handler="on_delete_confirm" swapped="no"/>
<child>
- <object class="GtkHBox" id="cd-hbox3">
+ <object class="GtkBox" id="cd-box3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
@@ -120,7 +120,7 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="cd-hbox1">
+ <object class="GtkBox" id="cd-box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
@@ -139,10 +139,11 @@
</packing>
</child>
<child>
- <object class="GtkVBox" id="cd-vbox2">
+ <object class="GtkBox" id="cd-vbox2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">16</property>
+ <property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="cd-label2">
<property name="visible">True</property>
=== modified file 'GTG/gtk/editor/__init__.py'
--- GTG/gtk/editor/__init__.py 2013-02-25 07:35:07 +0000
+++ GTG/gtk/editor/__init__.py 2013-09-25 16:29:12 +0000
@@ -26,7 +26,7 @@
class GnomeConfig:
current_rep = os.path.dirname(os.path.abspath(__file__))
- GLADE_FILE = os.path.join(current_rep, "taskeditor.glade")
+ EDITOR_UI_FILE = os.path.join(current_rep, "taskeditor.ui")
MARK_DONE = _("Mark as Done")
MARK_UNDONE = _("Mark as not Done")
=== modified file 'GTG/gtk/editor/calendar.py'
--- GTG/gtk/editor/calendar.py 2013-02-25 07:35:07 +0000
+++ GTG/gtk/editor/calendar.py 2013-09-25 16:29:12 +0000
@@ -19,31 +19,29 @@
import datetime
-import gobject
-import gtk
-from gtk import gdk
+from gi.repository import GObject, Gdk
from GTG.tools.dates import Date
-class GTGCalendar(gobject.GObject):
- """ Wrapper around gtk.Calendar object """
+class GTGCalendar(GObject.GObject):
+ """ Wrapper around Gtk.Calendar object """
# CONSTANTS
DATE_KIND_DUE = "due"
DATE_KIND_START = "start"
DATE_KIND_CLOSED = "closed"
- # Gobject signal description
- __signal_type__ = (gobject.SIGNAL_RUN_FIRST,
- gobject.TYPE_NONE,
+ #Gobject signal description
+ __signal_type__ = (GObject.SignalFlags.RUN_FIRST,
+ None,
[])
__gsignals__ = {'date-changed': __signal_type__, }
- def __init__(self, gtk_builder):
+ def __init__(self, Gtk_builder):
super(GTGCalendar, self).__init__()
- self.__builder = gtk_builder
+ self.__builder = Gtk_builder
self.__date_kind = None
self.__date = Date.no_date()
self.__init_gtk__()
@@ -106,13 +104,13 @@
else:
# If marked day is 31th, and the next month does not have 31th day,
# unmark_day raises a warning. Clear_marks() is clever way how
- # to let PyGTK solve it's bussiness.
+ # to let GTK solve it's bussiness.
self.__calendar.clear_marks()
def move_calendar_inside(self, width, height, x, y):
""" This method moves the calender inside the screen whenever part of
it is displayed outside the screen """
- screen_width = gtk.gdk.screen_width()
+ screen_width = Gdk.Screen.width()
# To display calendar inside the screen when editor window is
# outside leftside of the screen
if x < width:
@@ -132,32 +130,49 @@
# ones? question by invernizzi)
self.move_calendar_inside(width, height, x, y)
self.__window.grab_add()
- # We grab the pointer in the calendar
- gdk.pointer_grab(self.__window.window, True,
- gdk.BUTTON1_MASK | gdk.MOD2_MASK)
+
+ #We grab the pointer in the calendar
+ #Gdk.pointer_grab(
+ #self.__window.get_window(),
+ #True,
+ #Gdk.ModifierType.BUTTON1_MASK | Gdk.ModifierType.MOD2_MASK
+ #)
+#FIXME THIS DOES NOT WORK!!!!!!!
+ Gdk.pointer_grab(
+ self.get_window(),
+ True,
+ #Gdk.ModifierType.BUTTON1_MASK | Gdk.ModifierType.MOD2_MASK,
+#FIXME!!!! JUST GUESSING THE TYPE
+ Gdk.EventMask.ALL_EVENTS_MASK,
+ None,
+ None,
+ 0,
+ )
+
self.__window.connect('button-press-event', self.__focus_out)
self.__sigid = self.__calendar.connect("day-selected",
self.__day_selected,
- "RealDate")
+ "RealDate",)
+
self.__sigid_month = self.__calendar.connect("month-changed",
self.__month_changed)
- # Problem: gtk.Calendar does not tell you directly if the
- # "day-selected" signal was caused by the user clicking on
- # a date, or just browsing the calendar.
+ # Problem: Gtk.Calendar does not tell you directly if the
+ # "day-selected" signal was caused by the user clicking on
+ # a date, or just browsing the calendar.
# Solution: we track that in a variable
self.__is_user_just_browsing_the_calendar = False
self.__mark_today_in_bold()
def __focus_out(self, w=None, e=None):
# We should only close if the pointer click is out of the calendar !
- p = self.__window.window.get_pointer()
+ p = self.__window.get_window().get_pointer()
s = self.__window.get_size()
if not(0 <= p[0] <= s[0] and 0 <= p[1] <= s[1]):
self.close_calendar()
def close_calendar(self, widget=None, e=None):
self.__window.hide()
- gtk.gdk.pointer_ungrab()
+ Gdk.pointer_ungrab(0)
self.__window.grab_remove()
if self.__sigid is not None:
self.__calendar.disconnect(self.__sigid)
@@ -181,11 +196,11 @@
else:
# inform the Editor that the date has changed
self.close_calendar()
- gobject.idle_add(self.emit, "date-changed")
+ GObject.idle_add(self.emit, "date-changed")
def __from_calendar_date_to_datetime(self, calendar_date):
'''
- gtk.Calendar uses a 0-based convention for counting months.
+ Gtk.Calendar uses a 0-based convention for counting months.
The rest of the world, including the datetime module, starts from 1.
This is a converter between the two. GTG follows the datetime
convention.
=== modified file 'GTG/gtk/editor/editor.py'
--- GTG/gtk/editor/editor.py 2013-08-25 20:07:47 +0000
+++ GTG/gtk/editor/editor.py 2013-09-25 16:29:12 +0000
@@ -25,8 +25,7 @@
"""
import time
-import pango
-import gtk
+from gi.repository import Gtk, Gdk, Pango
from GTG import _, ngettext
from GTG.gtk.editor import GnomeConfig
@@ -38,7 +37,7 @@
from GTG.gtk.editor.calendar import GTGCalendar
-class TaskEditor:
+class TaskEditor(object):
def __init__(self,
requester,
@@ -59,8 +58,8 @@
self.config = taskconfig
self.time = None
self.clipboard = clipboard
- self.builder = gtk.Builder()
- self.builder.add_from_file(GnomeConfig.GLADE_FILE)
+ self.builder = Gtk.Builder()
+ self.builder.add_from_file(GnomeConfig.EDITOR_UI_FILE)
self.donebutton = self.builder.get_object("mark_as_done_editor")
self.dismissbutton = self.builder.get_object("dismiss_editor")
self.deletebutton = self.builder.get_object("delete_editor")
@@ -75,25 +74,25 @@
"mark_as_done_clicked": self.change_status,
"on_dismiss": self.dismiss,
"delete_clicked": self.delete_task,
- "on_duedate_pressed": (self.on_date_pressed,
- GTGCalendar.DATE_KIND_DUE),
- "on_startdate_pressed": (self.on_date_pressed,
- GTGCalendar.DATE_KIND_START),
- "on_closeddate_pressed": (self.on_date_pressed,
- GTGCalendar.DATE_KIND_CLOSED),
+ "on_duedate_pressed": lambda w: self.on_date_pressed(
+ w, GTGCalendar.DATE_KIND_DUE),
+ "on_startdate_pressed": lambda w: self.on_date_pressed(
+ w, GTGCalendar.DATE_KIND_START),
+ "on_closeddate_pressed": lambda w: self.on_date_pressed(
+ w, GTGCalendar.DATE_KIND_CLOSED),
"close_clicked": self.close,
- "duedate_changed": (self.date_changed,
- GTGCalendar.DATE_KIND_DUE),
- "duedate_focus_out": (self.date_focus_out,
- GTGCalendar.DATE_KIND_DUE),
- "startingdate_changed": (self.date_changed,
- GTGCalendar.DATE_KIND_START),
- "startdate_focus_out": (self.date_focus_out,
- GTGCalendar.DATE_KIND_START),
- "closeddate_changed": (self.date_changed,
- GTGCalendar.DATE_KIND_CLOSED),
- "closeddate_focus_out": (self.date_focus_out,
- GTGCalendar.DATE_KIND_CLOSED),
+ "duedate_changed": lambda w: self.date_changed(
+ w, GTGCalendar.DATE_KIND_DUE),
+ "duedate_focus_out": lambda w, e: self.date_focus_out(
+ w, e, GTGCalendar.DATE_KIND_DUE),
+ "startingdate_changed": lambda w: self.date_changed(
+ w, GTGCalendar.DATE_KIND_START),
+ "startdate_focus_out": lambda w, e: self.date_focus_out(
+ w, e, GTGCalendar.DATE_KIND_START),
+ "closeddate_changed": lambda w: self.date_changed(
+ w, GTGCalendar.DATE_KIND_CLOSED),
+ "closeddate_focus_out": lambda w, e: self.date_focus_out(
+ w, e, GTGCalendar.DATE_KIND_CLOSED),
"on_insert_subtask_clicked": self.insert_subtask,
"on_inserttag_clicked": self.inserttag_clicked,
"on_move": self.on_move,
@@ -115,7 +114,7 @@
scrolled.add(self.textview)
conf_font_value = self.browser_config.get("font_name")
if conf_font_value != "":
- self.textview.modify_font(pango.FontDescription(conf_font_value))
+ self.textview.override_font(Pango.FontDescription(conf_font_value))
# Voila! it's done
self.calendar = GTGCalendar(self.builder)
self.duedate_widget = self.builder.get_object("duedate_entry")
@@ -189,38 +188,38 @@
# Define accelerator-keys for this dialog
# TODO: undo/redo
def init_accelerators(self):
- agr = gtk.AccelGroup()
+ agr = Gtk.AccelGroup()
self.window.add_accel_group(agr)
# Escape and Ctrl-W close the dialog. It's faster to call close
# directly, rather than use the close button widget
- key, modifier = gtk.accelerator_parse('Escape')
- agr.connect_group(key, modifier, gtk.ACCEL_VISIBLE, self.close)
+ key, modifier = Gtk.accelerator_parse('Escape')
+ agr.connect(key, modifier, Gtk.AccelFlags.VISIBLE, self.close)
- key, modifier = gtk.accelerator_parse('<Control>w')
- agr.connect_group(key, modifier, gtk.ACCEL_VISIBLE, self.close)
+ key, modifier = Gtk.accelerator_parse('<Control>w')
+ agr.connect(key, modifier, Gtk.AccelFlags.VISIBLE, self.close)
# Ctrl-N creates a new task
- key, modifier = gtk.accelerator_parse('<Control>n')
- agr.connect_group(key, modifier, gtk.ACCEL_VISIBLE, self.new_task)
+ key, modifier = Gtk.accelerator_parse('<Control>n')
+ agr.connect(key, modifier, Gtk.AccelFlags.VISIBLE, self.new_task)
# Ctrl-Shift-N creates a new subtask
insert_subtask = self.builder.get_object("insert_subtask")
- key, mod = gtk.accelerator_parse("<Control><Shift>n")
+ key, mod = Gtk.accelerator_parse("<Control><Shift>n")
insert_subtask.add_accelerator('clicked', agr, key, mod,
- gtk.ACCEL_VISIBLE)
+ Gtk.AccelFlags.VISIBLE)
# Ctrl-D marks task as done
mark_as_done_editor = self.builder.get_object('mark_as_done_editor')
- key, mod = gtk.accelerator_parse('<Control>d')
+ key, mod = Gtk.accelerator_parse('<Control>d')
mark_as_done_editor.add_accelerator('clicked', agr, key, mod,
- gtk.ACCEL_VISIBLE)
+ Gtk.AccelFlags.VISIBLE)
# Ctrl-I marks task as dismissed
dismiss_editor = self.builder.get_object('dismiss_editor')
- key, mod = gtk.accelerator_parse('<Control>i')
+ key, mod = Gtk.accelerator_parse('<Control>i')
dismiss_editor.add_accelerator('clicked', agr, key, mod,
- gtk.ACCEL_VISIBLE)
+ Gtk.AccelFlags.VISIBLE)
# Can be called at any time to reflect the status of the Task
# Refresh should never interfere with the TaskView.
@@ -268,14 +267,14 @@
# Refreshing the status bar labels and date boxes
if status in [Task.STA_DISMISSED, Task.STA_DONE]:
self.builder.get_object("label2").hide()
- self.builder.get_object("hbox1").hide()
+ self.builder.get_object("box1").hide()
self.builder.get_object("label4").show()
- self.builder.get_object("hbox4").show()
+ self.builder.get_object("box4").show()
else:
self.builder.get_object("label4").hide()
- self.builder.get_object("hbox4").hide()
+ self.builder.get_object("box4").hide()
self.builder.get_object("label2").show()
- self.builder.get_object("hbox1").show()
+ self.builder.get_object("box1").show()
# refreshing the start date field
startdate = self.task.get_start_date()
@@ -338,21 +337,22 @@
abs_result = abs(result)
txt = ngettext("Due yesterday!", "Was %(days)d days ago",
abs_result) % {'days': abs_result}
- window_style = self.window.get_style()
- color = str(window_style.text[gtk.STATE_INSENSITIVE])
+
+ style_context = self.window.get_style_context()
+ color = style_context.get_color(Gtk.StateFlags.INSENSITIVE).to_color()
self.dayleft_label.set_markup(
- "<span color='" + color + "'>" + txt + "</span>")
+ "<span color='%s'>%s</span>" % (color.to_string(), txt))
# Refreshing the tag list in the insert tag button
taglist = self.req.get_used_tags()
- menu = gtk.Menu()
+ menu = Gtk.Menu()
tag_count = 0
for tagname in taglist:
tag_object = self.req.get_tag(tagname)
if not tag_object.is_special() and \
not self.task.has_tags(tag_list=[tagname]):
tag_count += 1
- mi = gtk.MenuItem(label=tagname, use_underline=False)
+ mi = Gtk.MenuItem(label=tagname, use_underline=False)
mi.connect("activate", self.inserttag, tagname)
mi.show()
menu.append(mi)
@@ -374,25 +374,30 @@
if valid:
# If the date is valid, we write with default color in the widget
# "none" will set the default color.
- widget.modify_text(gtk.STATE_NORMAL, None)
- widget.modify_base(gtk.STATE_NORMAL, None)
+ widget.override_color(Gtk.StateType.NORMAL, None)
+ widget.override_background_color(Gtk.StateType.NORMAL, None)
else:
- # We should write in red in the entry if the date is not valid
- widget.modify_text(gtk.STATE_NORMAL, gtk.gdk.color_parse("#F00"))
- widget.modify_base(gtk.STATE_NORMAL, gtk.gdk.color_parse("#F88"))
-
- def date_focus_out(self, widget, event, data):
+ #We should write in red in the entry if the date is not valid
+ text_color = Gdk.RGBA()
+ text_color.parse("#F00")
+ widget.override_color(Gtk.StateType.NORMAL, text_color)
+
+ bg_color = Gdk.RGBA()
+ bg_color.parse("#F88")
+ widget.override_background_color(Gtk.StateType.NORMAL, bg_color)
+
+ def date_focus_out(self, widget, event, date_kind):
try:
datetoset = Date.parse(widget.get_text())
except ValueError:
datetoset = None
if datetoset is not None:
- if data == "start":
+ if date_kind == GTGCalendar.DATE_KIND_START:
self.task.set_start_date(datetoset)
- elif data == "due":
+ elif date_kind == GTGCalendar.DATE_KIND_DUE:
self.task.set_due_date(datetoset)
- elif data == "closed":
+ elif date_kind == GTGCalendar.DATE_KIND_CLOSED:
self.task.set_closed_date(datetoset)
self.refresh_editor()
@@ -410,7 +415,7 @@
self.calendar.set_date(date, date_kind)
# we show the calendar at the right position
rect = widget.get_allocation()
- x, y = widget.window.get_origin()
+ result, x, y = widget.get_window().get_origin()
self.calendar.show_at_position(x + rect.x + rect.width,
y + rect.y)
@@ -582,3 +587,5 @@
def get_window(self):
return self.window
+
+# -----------------------------------------------------------------------------
=== renamed file 'GTG/gtk/editor/taskeditor.glade' => 'GTG/gtk/editor/taskeditor.ui'
--- GTG/gtk/editor/taskeditor.glade 2013-02-11 10:48:10 +0000
+++ GTG/gtk/editor/taskeditor.ui 2013-09-25 16:29:12 +0000
@@ -1,26 +1,29 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <requires lib="gtk+" version="2.16"/>
- <!-- interface-naming-policy toplevel-contextual -->
+ <!-- interface-requires gtk+ 3.0 -->
<object class="GtkWindow" id="TaskEditor">
+ <property name="can_focus">False</property>
<property name="title" translatable="yes">Task</property>
<property name="default_width">450</property>
<property name="default_height">400</property>
- <signal name="configure_event" handler="on_move"/>
+ <signal name="configure-event" handler="on_move" swapped="no"/>
<child>
- <object class="GtkVBox" id="vbox4">
+ <object class="GtkBox" id="vbox4">
<property name="visible">True</property>
- <property name="extension_events">cursor</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
<child>
<object class="GtkToolbar" id="task_tb1">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
<object class="GtkToolButton" id="mark_as_done_editor">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="is_important">True</property>
<property name="label" translatable="yes">Mark Done</property>
<property name="icon_name">gtg-task-done</property>
- <signal name="clicked" handler="mark_as_done_clicked"/>
+ <signal name="clicked" handler="mark_as_done_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@@ -30,9 +33,10 @@
<child>
<object class="GtkToolButton" id="dismiss_editor">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="label" translatable="yes">Dismiss</property>
<property name="icon_name">gtg-task-dismiss</property>
- <signal name="clicked" handler="on_dismiss"/>
+ <signal name="clicked" handler="on_dismiss" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@@ -42,9 +46,10 @@
<child>
<object class="GtkToolButton" id="delete_editor">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="label" translatable="yes">Delete</property>
<property name="icon_name">edit-delete</property>
- <signal name="clicked" handler="delete_clicked"/>
+ <signal name="clicked" handler="delete_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@@ -54,6 +59,7 @@
<child>
<object class="GtkSeparatorToolItem" id="toolbutton1">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
@@ -63,9 +69,10 @@
<child>
<object class="GtkToolButton" id="insert_subtask">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="label" translatable="yes">Insert subtask</property>
<property name="stock_id">gtk-indent</property>
- <signal name="clicked" handler="on_insert_subtask_clicked"/>
+ <signal name="clicked" handler="on_insert_subtask_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@@ -75,9 +82,10 @@
<child>
<object class="GtkMenuToolButton" id="inserttag">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="label" translatable="yes">Insert tag</property>
<property name="icon_name">gtg-tag-new</property>
- <signal name="clicked" handler="on_inserttag_clicked"/>
+ <signal name="clicked" handler="on_inserttag_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@@ -87,6 +95,7 @@
<child>
<object class="GtkSeparatorToolItem" id="separator_note">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
@@ -96,20 +105,20 @@
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox3">
+ <object class="GtkBox" id="box3">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
<object class="GtkScrolledWindow" id="scrolledtask">
<property name="width_request">400</property>
<property name="height_request">300</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="hscrollbar_policy">automatic</property>
- <property name="vscrollbar_policy">automatic</property>
<child>
<object class="GtkTextView" id="textview">
<property name="visible">True</property>
@@ -122,17 +131,22 @@
</child>
</object>
<packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
- <object class="GtkHSeparator" id="hseparator1">
+ <object class="GtkSeparator" id="hseparator1">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
@@ -141,11 +155,13 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="tasksidebar">
+ <object class="GtkBox" id="tasksidebar">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Starting on</property>
<attributes>
@@ -154,20 +170,22 @@
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
<property name="padding">10</property>
<property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox1">
+ <object class="GtkBox" id="box1">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
<object class="GtkEntry" id="startdate_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="invisible_char">●</property>
+ <property name="invisible_char">●</property>
<property name="width_chars">10</property>
- <signal name="changed" handler="startingdate_changed"/>
+ <signal name="changed" handler="startingdate_changed" swapped="no"/>
<signal name="focus-out-event" handler="startdate_focus_out"/>
</object>
<packing>
@@ -181,28 +199,32 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <signal name="clicked" handler="on_startdate_pressed"/>
+ <signal name="clicked" handler="on_startdate_pressed" swapped="no"/>
<child>
<object class="GtkArrow" id="arrow2">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="arrow_type">up</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Due for</property>
<attributes>
@@ -217,15 +239,16 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox2">
+ <object class="GtkBox" id="box2">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
<object class="GtkEntry" id="duedate_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="invisible_char">●</property>
+ <property name="invisible_char">●</property>
<property name="width_chars">10</property>
- <signal name="changed" handler="duedate_changed"/>
+ <signal name="changed" handler="duedate_changed" swapped="no"/>
<signal name="focus-out-event" handler="duedate_focus_out"/>
</object>
<packing>
@@ -239,28 +262,32 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <signal name="clicked" handler="on_duedate_pressed"/>
+ <signal name="clicked" handler="on_duedate_pressed" swapped="no"/>
<child>
<object class="GtkArrow" id="arrow1">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="arrow_type">up</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Closed on</property>
<attributes>
@@ -275,15 +302,16 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox4">
+ <object class="GtkBox" id="box4">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
<object class="GtkEntry" id="closeddate_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="invisible_char">●</property>
+ <property name="invisible_char">●</property>
<property name="width_chars">10</property>
- <signal name="changed" handler="closeddate_changed"/>
+ <signal name="changed" handler="closeddate_changed" swapped="no"/>
<signal name="focus-out-event" handler="closeddate_focus_out"/>
</object>
<packing>
@@ -297,28 +325,32 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <signal name="clicked" handler="on_closeddate_pressed"/>
+ <signal name="clicked" handler="on_closeddate_pressed" swapped="no"/>
<child>
<object class="GtkArrow" id="arrow3">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="arrow_type">up</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">5</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="dayleft">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="use_markup">True</property>
<property name="justify">right</property>
@@ -326,6 +358,7 @@
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
<property name="padding">10</property>
<property name="position">6</property>
</packing>
@@ -333,6 +366,7 @@
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
@@ -340,6 +374,7 @@
</child>
</object>
<object class="GtkWindow" id="calendar">
+ <property name="can_focus">False</property>
<property name="events">GDK_STRUCTURE_MASK | GDK_PROXIMITY_OUT_MASK</property>
<property name="type">popup</property>
<property name="resizable">False</property>
@@ -350,20 +385,25 @@
<property name="skip_pager_hint">True</property>
<property name="transient_for">TaskEditor</property>
<child>
- <object class="GtkVBox" id="vbox5">
+ <object class="GtkBox" id="vbox5">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
<child>
<object class="GtkCalendar" id="calendar1">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
<packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkHBox" id="fuzzydate_btns">
+ <object class="GtkBox" id="fuzzydate_btns">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="homogeneous">True</property>
<child>
<object class="GtkButton" id="button_now">
@@ -373,6 +413,8 @@
<property name="receives_default">True</property>
</object>
<packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
@@ -384,6 +426,8 @@
<property name="receives_default">True</property>
</object>
<packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
@@ -395,11 +439,15 @@
<property name="receives_default">True</property>
</object>
<packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
=== modified file 'GTG/gtk/editor/taskview.py'
--- GTG/gtk/editor/taskview.py 2013-02-25 08:29:31 +0000
+++ GTG/gtk/editor/taskview.py 2013-09-25 16:29:12 +0000
@@ -17,10 +17,10 @@
# this program. If not, see <http://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------------
"""
-This class implements a gtk.TextView but with many other features
+This class implements a Gtk.TextView but with many other features
like hyperlink and other stuff special for GTG
-For your information, a gtkTextView always contains a gtk.TextBuffer which
+For your information, a GtkTextView always contains a Gtk.TextBuffer which
Contains the text. Ours is called self.buff (how original !)
This is a class taken originally from
@@ -28,13 +28,12 @@
It was in Japanese and I didn't understand anything but the code.
"""
-import gtk
-from gtk import gdk
-import gobject
-import pango
+
import os
+
+from gi.repository import GObject, Gtk, Gdk, Pango
+
from webbrowser import open as openurl
-
from GTG.gtk.editor import taskviewserial
from GTG.tools import urlregex
@@ -47,26 +46,26 @@
bullet1_rtl = '←'
-class TaskView(gtk.TextView):
+class TaskView(Gtk.TextView):
__gtype_name__ = 'HyperTextView'
- __gsignals__ = {'anchor-clicked': (gobject.SIGNAL_RUN_LAST,
+ __gsignals__ = {'anchor-clicked': (GObject.SignalFlags.RUN_LAST,
None, (str, str, int))}
__gproperties__ = {
- 'link': (gobject.TYPE_PYOBJECT, 'link color',
- 'link color of TextView', gobject.PARAM_READWRITE),
- 'failedlink': (gobject.TYPE_PYOBJECT, 'failed link color',
+ 'link': (GObject.TYPE_PYOBJECT, 'link color',
+ 'link color of TextView', GObject.PARAM_READWRITE),
+ 'failedlink': (GObject.TYPE_PYOBJECT, 'failed link color',
'failed link color of TextView',
- gobject.PARAM_READWRITE),
- 'active': (gobject.TYPE_PYOBJECT, 'active color',
- 'active color of TextView', gobject.PARAM_READWRITE),
- 'hover': (gobject.TYPE_PYOBJECT, 'link:hover color',
- 'link:hover color of TextView', gobject.PARAM_READWRITE),
- 'tag': (gobject.TYPE_PYOBJECT, 'tag color',
- 'tag color of TextView', gobject.PARAM_READWRITE),
- 'done': (gobject.TYPE_PYOBJECT, 'link color',
- 'link color of TextView', gobject.PARAM_READWRITE),
- 'indent': (gobject.TYPE_PYOBJECT, 'indent color',
- 'indent color of TextView', gobject.PARAM_READWRITE),
+ GObject.PARAM_READWRITE),
+ 'active': (GObject.TYPE_PYOBJECT, 'active color',
+ 'active color of TextView', GObject.PARAM_READWRITE),
+ 'hover': (GObject.TYPE_PYOBJECT, 'link:hover color',
+ 'link:hover color of TextView', GObject.PARAM_READWRITE),
+ 'tag': (GObject.TYPE_PYOBJECT, 'tag color',
+ 'tag color of TextView', GObject.PARAM_READWRITE),
+ 'done': (GObject.TYPE_PYOBJECT, 'link color',
+ 'link color of TextView', GObject.PARAM_READWRITE),
+ 'indent': (GObject.TYPE_PYOBJECT, 'indent color',
+ 'indent color of TextView', GObject.PARAM_READWRITE),
}
def do_get_property(self, prop):
@@ -76,28 +75,27 @@
raise AttributeError('unknown property %s' % prop.name)
def do_set_property(self, prop, val):
- if prop.name in self.__gproperties__.keys():
+ if prop.name in list(self.__gproperties__.keys()):
setattr(self, prop.name, val)
else:
raise AttributeError('unknown property %s' % prop.name)
- # Yes, we want to redefine the buffer.
- def __init__(self, requester, clipboard, buffer=None):
-
- gtk.TextView.__init__(self, buffer)
+ # Yes, we want to redefine the buffer. Disabling pylint on that error.
+ def __init__(self, requester, clipboard):
+ Gtk.TextView.__init__(self)
self.buff = self.get_buffer()
self.req = requester
# Buffer init
self.link = {'background': 'white', 'foreground': '#007bff',
- 'underline': pango.UNDERLINE_SINGLE,
+ 'underline': Pango.Underline.SINGLE,
'strikethrough': False}
self.failedlink = {'background': 'white', 'foreground': '#ff5454',
- 'underline': pango.UNDERLINE_NONE,
+ 'underline': Pango.Underline.NONE,
'strikethrough': False}
self.done = {'background': 'white', 'foreground': 'gray',
'strikethrough': True}
self.active = {'background': 'light gray', 'foreground': '#ff1e00',
- 'underline': pango.UNDERLINE_SINGLE}
+ 'underline': Pango.Underline.SINGLE}
self.hover = {'background': 'light gray'}
self.tag = {'background': "#FFea00", 'foreground': 'black'}
self.indent = {'scale': 1.4, 'editable': False, 'left-margin': 10,
@@ -139,19 +137,22 @@
self.connect('drag-data-received', self.drag_receive)
# All the typical properties of our textview
- self.set_wrap_mode(gtk.WRAP_WORD)
+ self.set_wrap_mode(Gtk.WrapMode.WORD)
self.set_editable(True)
self.set_cursor_visible(True)
self.buff.set_modified(False)
# Let's try with serializing
- self.mime_type = 'application/x-gtg-task'
serializer = taskviewserial.Serializer()
+ self.serializer = serializer
unserializer = taskviewserial.Unserializer(self)
- self.buff.register_serialize_format(self.mime_type,
- serializer.serialize, None)
- self.buff.register_deserialize_format(self.mime_type,
- unserializer.unserialize, None)
+ self.unserializer = unserializer
+ # FIXME after discussion with Lionel remove those functions
+ # and simplify the code
+ # self.serialize_format = self.buff.register_serialize_format(
+ # mime_type, serializer.serialize, None)
+ # self.deserialize_format = self.buff.register_deserialize_format(
+ # mime_type, unserializer.unserialize, None)
# The list of callbacks we have to set
self.remove_tag_callback = None
@@ -171,7 +172,7 @@
self.tobe_refreshed = False
self.clipboard = clipboard
- if self.get_direction() == gtk.TEXT_DIR_RTL:
+ if self.get_direction() == Gtk.TextDirection.RTL:
self.bullet1 = bullet1_rtl
else:
self.bullet1 = bullet1_ltr
@@ -271,7 +272,10 @@
reconnect_modified = True
# deserialize
- self.buff.deserialize(self.buff, self.mime_type, _iter, text)
+ # self.buff.deserialize(self.buff, self.deserialize_format, _iter,
+ # text)
+ self.unserializer.unserialize(
+ self.buff, self.buff, _iter, 0, text, None, None)
# reconnect
if reconnect_insert:
@@ -332,10 +336,10 @@
linktype = 'failedlink'
tag = b.create_tag(None, **self.get_property(linktype))
- tag.set_data('is_anchor', True)
- tag.set_data('link', anchor)
+ tag.is_anchor = True
+ tag.link = anchor
if typ:
- tag.set_data('type', typ)
+ tag.type = typ
tag.connect('event', self._tag_event, text, anchor, typ)
self.__tags.append(tag)
return tag
@@ -349,15 +353,15 @@
texttag = None
already = False
for t in t_list:
- if t.get_data('is_tag') and t.get_data('tagname') == tag:
+ if hasattr(t, 'is_tag') and t.tagname == tag:
texttag = t
if ss.begins_tag(t) and ee.ends_tag(t):
already = True
if not texttag:
texttag = buff.create_tag(None, **self.get_property('tag'))
- texttag.set_data('is_tag', True)
- texttag.set_data('tagname', tag)
+ texttag.is_tag = True
+ texttag.tagname = tag
# This one is for marks
if not already:
self.__apply_tag_to_mark(s, e, tag=texttag)
@@ -367,20 +371,20 @@
def apply_subtask_tag(self, buff, subtask, s, e):
i_s = buff.get_iter_at_mark(s)
i_e = buff.get_iter_at_mark(e)
- tex = buff.get_text(i_s, i_e)
+ tex = buff.get_text(i_s, i_e, True)
# we don't accept \n in a subtask title
if "\n" in tex:
i_e = i_s.copy()
while i_e.get_char() != "\n":
i_e.forward_char()
buff.move_mark(e, i_e)
- tex = buff.get_text(i_s, i_e)
+ tex = buff.get_text(i_s, i_e, True)
if len(tex) > 0:
self.req.get_task(subtask).set_title(tex)
texttag = self.create_anchor_tag(buff, subtask, text=tex,
typ="subtask")
- texttag.set_data('is_subtask', True)
- texttag.set_data('child', subtask)
+ texttag.is_subtask = True
+ texttag.child = subtask
# This one is for marks
self.__apply_tag_to_mark(s, e, tag=texttag)
else:
@@ -391,8 +395,8 @@
def create_indent_tag(self, buff, level):
tag = buff.create_tag(None, **self.get_property('indent'))
- tag.set_data('is_indent', True)
- tag.set_data('indent_level', level)
+ tag.is_indent = True
+ tag.indent_level = level
return tag
# Insert a list of subtasks at the end of the buffer
@@ -414,7 +418,7 @@
firstline = self.buff.get_iter_at_line(1)
newline = True
for tt in firstline.get_tags():
- if tt.get_data('is_tag'):
+ if hasattr(tt, 'is_tag'):
newline = False
firstline.forward_to_line_end()
# Now we should check if the current char is
@@ -479,7 +483,8 @@
# we go to the next line, just after the title
start.forward_line()
end = self.buff.get_end_iter()
- texte = self.buff.serialize(self.buff, self.mime_type, start, end)
+ texte = self.serializer.serialize(
+ self.buff, self.buff, start, end, 1, None)
return texte
# Get the title of the task (aka the first line of the buffer)
@@ -496,7 +501,7 @@
conti = end.forward_to_line_end()
# We don't want to deserialize the title
# Let's get the pure text directly
- title = unicode(self.buff.get_text(start, end))
+ title = str(self.buff.get_text(start, end, True))
# Let's strip blank lines
stripped = title.strip(' \n\t')
return stripped
@@ -548,10 +553,10 @@
tag_list = []
def subfunc(texttag, data=None):
- if texttag.get_data('is_subtask'):
+ if hasattr(texttag, 'is_subtask'):
tag_list.append(texttag)
- table.foreach(subfunc)
+ table.foreach(subfunc, None)
start, end = buff.get_bounds()
for t in tag_list:
buff.remove_tag(t, start, end)
@@ -594,10 +599,10 @@
table = buff.get_tag_table()
def subfunc(texttag, data=None):
- if texttag.get_data('is_anchor'):
+ if hasattr(texttag, 'is_anchor'):
tag_list.append(texttag)
- table.foreach(subfunc)
+ table.foreach(subfunc, None)
for t in tag_list:
buff.remove_tag(t, start, end)
# Now we add the tag URL
@@ -607,10 +612,10 @@
it.forward_word_end()
prev = it.copy()
prev.backward_word_start()
- text = buff.get_text(prev, it)
+ text = buff.get_text(prev, it, True)
if text in ["http", "https", "www", "file"]:
- isurl = buff.get_text(prev, buff.get_end_iter())
+ isurl = buff.get_text(prev, buff.get_end_iter(), True)
m = urlregex.match(isurl)
if m is not None:
url = isurl[:m.end()]
@@ -630,7 +635,7 @@
it.forward_char()
while it.get_char().isdigit() and (it.get_char() != '\0'):
it.forward_char()
- url = buff.get_text(prev, it)
+ url = buff.get_text(prev, it, True)
nbr = url.split("#")[1]
topoint = None
if url.startswith("bug #") or url.startswith("lp #"):
@@ -665,8 +670,8 @@
tags = it.get_toggled_tags(True)
for ta in tags:
# removing deleted tags
- if ta.get_data('is_tag'):
- tagname = ta.get_data('tagname')
+ if hasattr(ta, 'is_tag'):
+ tagname = ta.tagname
old_tags.append(tagname)
buff.remove_tag(ta, start, end)
table.remove(ta)
@@ -698,7 +703,7 @@
# Iterate over characters of the line to get words
while char_end.compare(end) <= 0:
do_word_check = False
- my_char = buff.get_text(char_start, char_end)
+ my_char = buff.get_text(char_start, char_end, True)
if my_char not in separators:
last_char = my_char
word_end = char_end.copy()
@@ -718,7 +723,7 @@
# We have a new word
if do_word_check:
if (word_end.compare(word_start) > 0):
- my_word = buff.get_text(word_start, word_end)
+ my_word = buff.get_text(word_start, word_end, True)
# We do something about it
# We want a tag bigger than the simple "@"
# and it shouldn't start with @@ (bug 531553)
@@ -761,7 +766,8 @@
elif self.title_tag in itera.get_tags():
to_return = True
# else, we look if there's something between us and buffer start
- elif not buff.get_text(buff.get_start_iter(), itera).strip('\n\t '):
+ elif not buff.get_text(buff.get_start_iter(), itera, True) \
+ .strip('\n\t '):
to_return = True
return to_return
@@ -778,7 +784,7 @@
# We want to start at the begining
tags = start.get_tags() + start.get_toggled_tags(False)
for ta in tags:
- if (ta.get_data('is_indent')):
+ if (hasattr(ta, 'is_indent')):
line = start.get_line()
start = self.buff.get_iter_at_line(line)
# #it = self.buff.get_iter_at_line(line)
@@ -788,24 +794,24 @@
# buff.remove_tag(ta, start, endindent)
# Now we delete all, char after char
it = start.copy()
- while it.get_offset() <= end.get_offset() and it.get_char() != '\0':
+ while it.get_offset() < end.get_offset() and it.get_char() != '\0':
if it.begins_tag():
tags = it.get_tags()
for ta in tags:
# removing deleted subtasks
- if ta.get_data('is_subtask') and it.begins_tag(ta):
- target = ta.get_data('child')
+ if hasattr(ta, 'is_subtask') and it.begins_tag(ta):
+ target = ta.child
# print "removing task %s" %target
self.remove_subtask(target)
# removing deleted tags
- if ta.get_data('is_tag') and it.begins_tag(ta):
- tagname = ta.get_data('tagname')
+ if hasattr(ta, 'is_tag') and it.begins_tag(ta):
+ tagname = ta.tagname
self.remove_tag_callback(tagname)
if buff.get_mark(tagname):
buff.delete_mark_by_name(tagname)
if buff.get_mark("/%s" % tagname):
buff.delete_mark_by_name("/%s" % tagname)
- if ta.get_data('is_indent'):
+ if hasattr(ta, 'is_indent'):
# Because the indent tag is read only
# we will remove it
endtag = it.copy()
@@ -853,14 +859,16 @@
# Applying title on the first line
title_end = buff.get_iter_at_line(line_nbr - 1)
title_end.forward_to_line_end()
- stripped = buff.get_text(title_start, title_end).strip('\n\t ')
+ stripped = buff.get_text(title_start, title_end, True)
+ stripped = stripped.strip('\n\t ')
# Here we ignore lines that are blank
# Title is the first written line
while line_nbr <= linecount and not stripped:
line_nbr += 1
title_end = buff.get_iter_at_line(line_nbr - 1)
title_end.forward_to_line_end()
- stripped = buff.get_text(title_start, title_end).strip('\n\t ')
+ stripped = buff.get_text(title_start, title_end, True)
+ stripped = stripped.strip('\n\t ')
# Or to all the buffer if there is only one line
else:
title_end = end.copy()
@@ -868,7 +876,9 @@
buff.remove_tag_by_name('title', title_end, end)
# Refresh title of the window
if refresheditor:
- self.refresh(buff.get_text(title_start, title_end).strip('\n\t'))
+ stripped = buff.get_text(title_start, title_end, True)
+ stripped = stripped.strip('\n\t')
+ self.refresh(stripped)
return title_end
def __newsubtask(self, buff, title, line_nbr, level=1):
@@ -947,7 +957,7 @@
while not itera:
found = True
for t in startl.get_tags():
- if t.get_data('is_indent'):
+ if hasattr(t, 'is_indent'):
line += 1
startl = self.buff.get_iter_at_line(line)
if line < self.buff.get_line_count():
@@ -985,17 +995,17 @@
list_stag = start_i.get_toggled_tags(False)
stag = None
for t in list_stag:
- if t.get_data('is_subtask'):
+ if hasattr(t, 'is_subtask'):
stag = t
# maybe the tag was not toggled off here but we were in the middle
if not stag:
list_stag = start_i.get_tags()
for t in list_stag:
- if t.get_data('is_subtask'):
+ if hasattr(t, 'is_subtask'):
stag = t
if stag:
# We will remove the tag from the whole text
- subtid = stag.get_data('child')
+ subtid = stag.child
# We move the end_subtask mark to here
# We have to create a temporary mark with left gravity
# It will be later replaced by the good one with right gravity
@@ -1057,14 +1067,14 @@
tags = start_line.get_tags()
current_indent = 0
for ta in tags:
- if ta.get_data('is_indent'):
- current_indent = ta.get_data('indent_level')
+ if hasattr(ta, 'is_indent'):
+ current_indent = ta.indent_level
return current_indent
# Method called on copy and cut actions
# param is either "cut" or "copy"
def copy_clipboard(self, widget, param=None):
- clip = gtk.clipboard_get(gdk.SELECTION_CLIPBOARD)
+ clip = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
# First, we analyse the selection to put in our own
# GTG clipboard a selection with description of subtasks
@@ -1075,7 +1085,8 @@
self.clipboard.copy(start, stop, bullet=self.bullet1)
- clip.set_text(self.clipboard.paste_text())
+ text = self.clipboard.paste_text()
+ clip.set_text(text, len(text))
clip.store()
if param == "cut":
@@ -1086,7 +1097,7 @@
# Called on paste.
def paste_clipboard(self, widget, param=None):
- clip = gtk.clipboard_get(gdk.SELECTION_CLIPBOARD)
+ clip = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
# if the clipboard text is the same are our own internal
# clipboard text, it means that we can paste from our own clipboard
# else, that we can empty it.
@@ -1136,13 +1147,13 @@
current_indent = self._get_indent_level(itera)
tags = itera.get_tags()
for ta in tags:
- if ta.get_data('is_subtask'):
- subtask_nbr = ta.get_data('child')
+ if hasattr(ta, 'is_subtask'):
+ subtask_nbr = ta.child
# Maybe we are simply at the end of the tag
if not subtask_nbr and itera.ends_tag():
for ta in itera.get_toggled_tags(False):
- if ta.get_data('is_subtask'):
- subtask_nbr = ta.get_data('child')
+ if hasattr(ta, 'is_subtask'):
+ subtask_nbr = ta.child
# New line: the user pressed enter !
# If the line begins with "-", it's a new subtask !
@@ -1158,11 +1169,11 @@
else:
list_stag = itera.get_tags()
for t in list_stag:
- if t.get_data('is_tag'):
- closed_tag = t.get_data('tagname')
- elif t.get_data('is_subtask'):
+ if hasattr(t, 'is_tag'):
+ closed_tag = t.tagname
+ elif hasattr(t, 'is_subtask'):
cutting_subtask = True
- closed_tag = t.get_data('child')
+ closed_tag = t.child
# We add a bullet list but not on the first line
# Because it's the title
if line_nbr > 0:
@@ -1240,7 +1251,7 @@
endl = cursor.copy()
if not endl.ends_line():
endl.forward_to_line_end()
- text = self.buff.get_text(cursor, endl)
+ text = self.buff.get_text(cursor, endl, True)
anchor = self.new_subtask_callback(text)
self.buff.create_mark(anchor, cursor, True)
self.buff.create_mark("/%s" % anchor, endl, False)
@@ -1272,16 +1283,16 @@
def _keypress(self, widget, event):
# Check for Ctrl-Return/Enter
- if event.state & gtk.gdk.CONTROL_MASK and \
- event.keyval in (gtk.keysyms.Return, gtk.keysyms.KP_Enter):
+ if event.get_state() & Gdk.ModifierType.CONTROL_MASK and \
+ event.keyval in (Gdk.KEY_Return, Gdk.KEY_KP_Enter):
buff = self.buff
cursor_mark = buff.get_insert()
cursor_iter = buff.get_iter_at_mark(cursor_mark)
local_start = cursor_iter.copy()
for tag in local_start.get_tags():
- anchor = tag.get_data('link')
- typ = tag.get_data('type')
+ anchor = tag.link
+ typ = tag.type
if(anchor):
if typ == "subtask":
self.open_task(anchor)
@@ -1297,14 +1308,14 @@
startline = self.buff.get_iter_at_line(line)
if newlevel < 0:
for t in itera.get_toggled_tags(False):
- if t.get_data('is_indent'):
- newlevel = t.get_data('indent_level')
+ if hasattr(t, 'is_indent'):
+ newlevel = t.indent_level
if newlevel > 0:
newlevel -= 1
# If it's still < 0
if newlevel < 0:
- print "bug: no is_indent tag on that line"
+ print("bug: no is_indent tag on that line")
# startline.backward_char()
# We make a temp mark where we should insert the new indent
# tempm = self.buff.create_mark("temp", startline)
@@ -1325,7 +1336,7 @@
# All this crap to find if we are at the end of an indent tag
if insert_iter.ends_tag():
for t in insert_iter.get_toggled_tags(False):
- if t.get_data('is_indent'):
+ if hasattr(t, 'is_indent'):
self.deindent(insert_iter)
tv.emit_stop_by_name('backspace')
# we stopped the signal, don't forget to erase
@@ -1338,15 +1349,16 @@
# link
def _motion(self, view, ev):
window = ev.window
- x, y, _ = window.get_pointer()
- x, y = view.window_to_buffer_coords(gtk.TEXT_WINDOW_TEXT, x, y)
+ _, x, y, _ = window.get_pointer()
+ x, y = view.window_to_buffer_coords(Gtk.TextWindowType.TEXT, x, y)
tags = view.get_iter_at_location(x, y).get_tags()
for tag in tags:
- if tag.get_data('is_anchor'):
+ if hasattr(tag, 'is_anchor'):
for t in set(self.__tags) - set([tag]):
self.__tag_reset(t, window)
- self.__set_anchor(window, tag, gtk.gdk.Cursor(gtk.gdk.HAND2),
- self.get_property('hover'))
+ self.__set_anchor(
+ window, tag, Gdk.Cursor.new(Gdk.CursorType.HAND2),
+ self.get_property('hover'))
break
else:
tag_table = self.buff.get_tag_table()
@@ -1358,12 +1370,13 @@
"""
_type = ev.type
- if _type == gtk.gdk.MOTION_NOTIFY:
+ if _type == Gdk.EventType.MOTION_NOTIFY:
return
- elif _type in [gtk.gdk.BUTTON_PRESS, gtk.gdk.BUTTON_RELEASE]:
+ elif _type in [Gdk.EventType.BUTTON_PRESS,
+ Gdk.EventType.BUTTON_RELEASE]:
button = ev.button
- cursor = gtk.gdk.Cursor(gtk.gdk.HAND2)
- if _type == gtk.gdk.BUTTON_RELEASE:
+ cursor = Gdk.Cursor.new(Gdk.CursorType.HAND2)
+ if _type == Gdk.EventType.BUTTON_RELEASE:
if typ == "subtask":
self.open_task(anchor)
elif typ == "http":
@@ -1371,7 +1384,7 @@
not self.buff.get_has_selection():
openurl(anchor)
else:
- print "Unknown link type for %s" % anchor
+ print("Unknown link type for %s" % anchor)
self.emit('anchor-clicked', text, anchor, button)
self.__set_anchor(ev.window, tag, cursor,
self.get_property('hover'))
@@ -1380,14 +1393,13 @@
self.get_property('active'))
def __tag_reset(self, tag, window):
- if tag.get_data('is_anchor'):
+ if hasattr(tag, 'is_anchor'):
# We need to get the normal cursor back
- editing_cursor = gtk.gdk.Cursor(gtk.gdk.XTERM)
+ editing_cursor = Gdk.Cursor.new(Gdk.CursorType.XTERM)
if tag.get_property('strikethrough'):
linktype = 'done'
else:
- anchor = tag.get_data('link')
- if self.check_link(anchor):
+ if self.check_link(tag.link):
linktype = 'link'
else:
linktype = 'failedlink'
@@ -1396,8 +1408,8 @@
def __set_anchor(self, window, tag, cursor, prop):
window.set_cursor(cursor)
- for key, val in prop.iteritems():
+ for key, val in prop.items():
tag.set_property(key, val)
-gobject.type_register(TaskView)
+GObject.type_register(TaskView)
=== modified file 'GTG/gtk/editor/taskviewserial.py'
--- GTG/gtk/editor/taskviewserial.py 2013-02-25 08:29:31 +0000
+++ GTG/gtk/editor/taskviewserial.py 2013-09-25 16:29:12 +0000
@@ -20,15 +20,16 @@
import xml.dom.minidom
-# The following functions are used by the gtk.TextBuffer to serialize
+# The following functions are used by the Gtk.TextBuffer to serialize
# the content of the task
########### Serializing functions ##############
### Serialize the task : transform it's content in something
# we can store. This function signature is defined in PyGTK
-class Serializer:
- def serialize(self, register_buf, content_buf, start, end, udata):
+class Serializer(object):
+ # Disabling pylint argument usage since we know we are not using all args
+ def serialize(self, register_buf, content_buf, start, end, length, udata):
# Currently we serialize in XML
its = start.copy()
ite = end.copy()
@@ -41,8 +42,8 @@
# we only take the first node (the "content" one)
node = doc.firstChild
# print "********************"
- # print node.toxml().encode("utf-8")
- return node.toxml().encode("utf-8")
+ # print node.toxml()
+ return node.toxml()
def parse_buffer(self, buff, start, end, parent, doc, done=[]):
"""
@@ -56,11 +57,11 @@
def is_know_tag(tag):
"""
- Return True if "tag" is a know tag. "tag" must be a gtk.TextTag.
+ Return True if "tag" is a know tag. "tag" must be a Gtk.TextTag.
"""
know_tags = ["is_subtask", "is_indent", "is_tag"]
for know in know_tags:
- if tag.get_data(know):
+ if hasattr(tag, know):
return True
return False
it = start.copy()
@@ -79,7 +80,6 @@
if it.begins_tag(ta) and ta not in done and \
is_know_tag(ta):
tags.append(ta)
- # print ta.get_data("tagname")
if it.begins_tag() and len(tags) > 0:
# We enter in a tag context
tag = tags.pop()
@@ -88,7 +88,7 @@
else:
# We stay out of a tag context
# We write the char in the xml node
- if it.get_char() != "\0":
+ if it.get_char() != "":
parent.appendChild(doc.createTextNode(it.get_char()))
else:
# We are in a tag context
@@ -97,25 +97,25 @@
# We process the tag
end_it = it.copy()
end_it.backward_char()
- if tag.get_data("is_tag"):
+ if hasattr(tag, 'is_tag'):
# The current gtkTextTag is a tag
# Recursive call
nparent = doc.createElement("tag")
child = self.parse_buffer(buff, start_it, end_it,
nparent, doc, done=done)
parent.appendChild(child)
- elif ta.get_data('is_subtask'):
+ elif hasattr(ta, 'is_subtask'):
# The current gtkTextTag is a subtask
tagname = "subtask"
subt = doc.createElement(tagname)
- target = ta.get_data('child')
+ target = ta.child
subt.appendChild(doc.createTextNode(target))
parent.appendChild(subt)
parent.appendChild(doc.createTextNode("\n"))
it.forward_line()
- elif ta.get_data('is_indent'):
+ elif hasattr(ta, 'is_indent'):
# The current gtkTextTag is a indent
- indent = buff.get_text(start_it, end_it)
+ indent = buff.get_text(start_it, end_it, True)
if '\n' in indent:
parent.appendChild(doc.createTextNode('\n'))
it = end_it
@@ -151,8 +151,9 @@
# Not very pretty but convenient
self.tv = taskview
- def unserialize(self, register_buf, content_buf, ite, data,
- cr_tags, udata):
+ # Disabling pylint argument usage since we know we are not using all args
+ def unserialize(self, register_buf, content_buf, ite, length,
+ data, cr_tags, udata):
if data:
element = xml.dom.minidom.parseString(data)
success = self.parsexml(content_buf, ite, element.firstChild)
@@ -166,7 +167,7 @@
end_end = buff.get_end_iter()
end_line = end_end.get_line()
start_end = buff.get_iter_at_line(end_line)
- if buff.get_text(start_end, end_end).strip():
+ if buff.get_text(start_end, end_end, True).strip():
end_line += 1
for tid in st_list:
self.tv.write_subtask(buff, end_line, tid)
=== modified file 'GTG/gtk/manager.py'
--- GTG/gtk/manager.py 2013-08-20 09:07:15 +0000
+++ GTG/gtk/manager.py 2013-09-25 16:29:12 +0000
@@ -19,15 +19,9 @@
"""
Manager loads the prefs and launches the gtk main loop
"""
-try:
- import pygtk
- pygtk.require('2.0')
-except:
- raise SystemExit(1)
-import gtk
-import gobject
-import ConfigParser
+from gi.repository import GObject, Gtk
+import configparser
import GTG
from GTG.gtk.delete_dialog import DeletionUI
@@ -103,7 +97,7 @@
# checks the conf for user settings
try:
plugins_enabled = self.plugins_config.get("enabled")
- except ConfigParser.Error:
+ except configparser.Error:
plugins_enabled = []
for plugin in self.pengine.get_plugins():
plugin.enabled = plugin.module_name in plugins_enabled
@@ -273,19 +267,19 @@
uri_list)
else:
self.open_browser()
- gobject.threads_init()
+ GObject.threads_init()
if not self.gtk_terminate:
if once_thru:
- gtk.main_iteration()
+ Gtk.main_iteration()
else:
- gtk.main()
+ Gtk.main()
return 0
def quit(self, sender=None):
- gtk.main_quit()
+ Gtk.main_quit()
# save opened tasks and their positions.
open_task = []
- for otid in self.opened_task.keys():
+ for otid in list(self.opened_task.keys()):
open_task.append(otid)
self.opened_task[otid].close()
self.browser_config.set("opened_tasks", open_task)
=== modified file 'GTG/gtk/plugins.py'
--- GTG/gtk/plugins.py 2013-08-20 09:07:15 +0000
+++ GTG/gtk/plugins.py 2013-09-25 16:29:12 +0000
@@ -17,10 +17,9 @@
# this program. If not, see <http://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------------
-""" Dialog for configuring plugins """
+""" Dialog for loading plugins """
-import gtk
-import pango
+from gi.repository import Gtk, Pango
from GTG import _
from GTG import info
@@ -36,7 +35,7 @@
PLUGINS_COL_ACTIVATABLE = 4
-def plugin_icon(column, cell, store, iterator):
+def plugin_icon(column, cell, store, iterator, data):
""" Callback to set the content of a PluginTree cell.
See PluginsDialog._init_plugin_tree().
@@ -135,8 +134,8 @@
def __init__(self, config_obj):
self.config_obj = config_obj
self.config = self.config_obj.get_subconfig("plugins")
- builder = gtk.Builder()
- builder.add_from_file(ViewConfig.PLUGINS_GLADE_FILE)
+ builder = Gtk.Builder()
+ builder.add_from_file(ViewConfig.PLUGINS_UI_FILE)
self.dialog = builder.get_object("PluginsDialog")
self.dialog.set_title(_("Plugins - %s" % info.NAME))
@@ -154,7 +153,7 @@
[p.module_name for p in self.pengine.get_plugins("enabled")])
# see constants PLUGINS_COL_* for column meanings
- self.plugin_store = gtk.ListStore(str, bool, str, str, bool)
+ self.plugin_store = Gtk.ListStore(str, bool, str, str, bool)
builder.connect_signals({
'on_plugins_help':
@@ -174,37 +173,37 @@
})
def _init_plugin_tree(self):
- """ Initialize the PluginTree gtk.TreeView.
+ """ Initialize the PluginTree Gtk.TreeView.
The format is modelled after the one used in gedit; see
http://git.gnome.org/browse/gedit/tree/gedit/gedit-plugin-mapnager.c
"""
- # force creation of the gtk.ListStore so we can reference it
+ # force creation of the Gtk.ListStore so we can reference it
self._refresh_plugin_store()
# renderer for the toggle column
- renderer = gtk.CellRendererToggle()
+ renderer = Gtk.CellRendererToggle()
renderer.set_property('xpad', 6)
renderer.connect('toggled', self.on_plugin_toggle)
# toggle column
- column = gtk.TreeViewColumn(None, renderer, active=PLUGINS_COL_ENABLED,
+ column = Gtk.TreeViewColumn(None, renderer, active=PLUGINS_COL_ENABLED,
activatable=PLUGINS_COL_ACTIVATABLE,
sensitive=PLUGINS_COL_ACTIVATABLE)
self.plugin_tree.append_column(column)
# plugin name column
- column = gtk.TreeViewColumn()
+ column = Gtk.TreeViewColumn()
column.set_spacing(6)
# icon renderer for the plugin name column
- icon_renderer = gtk.CellRendererPixbuf()
- icon_renderer.set_property('stock-size', gtk.ICON_SIZE_SMALL_TOOLBAR)
+ icon_renderer = Gtk.CellRendererPixbuf()
+ icon_renderer.set_property('stock-size', Gtk.IconSize.SMALL_TOOLBAR)
icon_renderer.set_property('xpad', 3)
- column.pack_start(icon_renderer, expand=False)
+ column.pack_start(icon_renderer, False)
column.set_cell_data_func(icon_renderer, plugin_icon)
# text renderer for the plugin name column
- name_renderer = gtk.CellRendererText()
- name_renderer.set_property('ellipsize', pango.ELLIPSIZE_END)
- column.pack_start(name_renderer)
+ name_renderer = Gtk.CellRendererText()
+ name_renderer.set_property('ellipsize', Pango.EllipsizeMode.END)
+ column.pack_start(name_renderer, True)
column.set_cell_data_func(name_renderer, plugin_markup, self)
self.plugin_tree.append_column(column)
@@ -214,10 +213,10 @@
self.plugin_tree.set_search_column(2)
def _refresh_plugin_store(self):
- """ Refresh status of plugins and put it in a gtk.ListStore """
+ """ Refresh status of plugins and put it in a Gtk.ListStore """
self.plugin_store.clear()
self.pengine.recheck_plugin_errors(True)
- for name, plugin in self.pengine.plugins.iteritems():
+ for name, plugin in self.pengine.plugins.items():
# activateable if there is no error
self.plugin_store.append((name, plugin.enabled, plugin.full_name,
plugin.short_description,
@@ -300,7 +299,12 @@
plugin_id = self.plugin_store.get_value(iterator, PLUGINS_COL_ID)
plugin = self.pengine.get_plugin(plugin_id)
- self.plugin_about.set_name(plugin.full_name)
+ #FIXME About plugin dialog looks much more different than
+ #it is in the current trunk
+ #FIXME repair it!
+ #FIXME Author is not usually set and is preserved from
+ #previous plugin... :/
+ self.plugin_about.set_program_name(plugin.full_name)
self.plugin_about.set_version(plugin.version)
authors = plugin.authors
if isinstance(authors, str):
=== renamed file 'GTG/gtk/plugins.glade' => 'GTG/gtk/plugins.ui'
--- GTG/gtk/plugins.glade 2012-06-07 15:25:05 +0000
+++ GTG/gtk/plugins.ui 2013-09-25 16:29:12 +0000
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <requires lib="gtk+" version="2.16"/>
- <!-- interface-naming-policy toplevel-contextual -->
+ <!-- interface-requires gtk+ 3.0 -->
<object class="GtkAboutDialog" id="PluginAboutDialog">
<property name="can_focus">False</property>
<property name="border_width">5</property>
@@ -11,12 +10,13 @@
<signal name="delete-event" handler="on_PluginAboutDialog_close" swapped="no"/>
<signal name="response" handler="on_PluginAboutDialog_close" swapped="no"/>
<child internal-child="vbox">
- <object class="GtkVBox" id="pa-vbox1">
+ <object class="GtkBox" id="pa-vbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">2</property>
+ <property name="orientation">vertical</property>
<child internal-child="action_area">
- <object class="GtkHButtonBox" id="pa-action_area1">
+ <object class="GtkButtonBox" id="pa-action_area1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
@@ -75,11 +75,12 @@
<property name="type_hint">dialog</property>
<signal name="delete-event" handler="on_PluginsDialog_delete_event" swapped="no"/>
<child internal-child="vbox">
- <object class="GtkVBox" id="dialog-vbox5">
+ <object class="GtkBox" id="dialog-vbox5">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
<child internal-child="action_area">
- <object class="GtkHButtonBox" id="dialog-action_area5">
+ <object class="GtkButtonBox" id="dialog-action_area5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
@@ -124,10 +125,11 @@
</packing>
</child>
<child>
- <object class="GtkVBox" id="plugins-vbox6">
+ <object class="GtkBox" id="plugins-vbox6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
+ <property name="orientation">vertical</property>
<child>
<object class="GtkScrolledWindow" id="plugins-scrolledwindow2">
<property name="width_request">240</property>
@@ -154,7 +156,7 @@
</packing>
</child>
<child>
- <object class="GtkHButtonBox" id="plugins-hbuttonbox1">
+ <object class="GtkButtonBox" id="plugins-hbuttonbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">8</property>
=== modified file 'GTG/gtk/preferences.py'
--- GTG/gtk/preferences.py 2013-03-09 16:59:30 +0000
+++ GTG/gtk/preferences.py 2013-09-25 16:29:12 +0000
@@ -22,15 +22,15 @@
import os
import shutil
-import gtk
+from gi.repository import Gtk
from xdg.BaseDirectory import xdg_config_home
from GTG import _
from GTG import info
from GTG.gtk import ViewConfig
-from GTG.tools.shortcut import get_saved_binding, \
- check_invalidity, \
- save_new_binding
+from GTG.tools.shortcut import get_saved_binding
+from GTG.tools.shortcut import check_invalidity
+from GTG.tools.shortcut import save_new_binding
AUTOSTART_DIRECTORY = os.path.join(xdg_config_home, "autostart")
AUTOSTART_FILE = "gtg.desktop"
@@ -81,8 +81,8 @@
def __init__(self, req):
self.req = req
self.config = self.req.get_config('browser')
- builder = gtk.Builder()
- builder.add_from_file(ViewConfig.PREFERENCES_GLADE_FILE)
+ builder = Gtk.Builder()
+ builder.add_from_file(ViewConfig.PREFERENCES_UI_FILE)
self.dialog = builder.get_object("PreferencesDialog")
self.dialog.set_title(_("Preferences - %s" % info.NAME))
@@ -98,8 +98,9 @@
self.fontbutton = builder.get_object("fontbutton")
editor_font = self.config.get("font_name")
if editor_font == "":
- style = self.dialog.get_style()
- editor_font = str(style.font_desc)
+ font = self.dialog.get_style_context().get_font(
+ Gtk.StateFlags.NORMAL)
+ editor_font = font.to_string()
self.fontbutton.set_font_name(editor_font)
builder.connect_signals({
@@ -190,17 +191,17 @@
self.button = button1
self.new_task_default_binding = "<Primary>F12"
- self.liststore = gtk.ListStore(str, str)
+ self.liststore = Gtk.ListStore(str, str)
self.liststore.append(["", ""])
- treeview = gtk.TreeView(self.liststore)
- column_accel = gtk.TreeViewColumn()
+ treeview = Gtk.TreeView(self.liststore)
+ column_accel = Gtk.TreeViewColumn()
treeview.append_column(column_accel)
treeview.set_headers_visible(False)
- cell = gtk.CellRendererAccel()
+ cell = Gtk.CellRendererAccel()
cell.set_alignment(0.0, 1.0)
cell.set_fixed_size(-1, 18)
- cell.set_property("accel-mode", gtk.CELL_RENDERER_ACCEL_MODE_OTHER)
+ cell.set_property("accel-mode", Gtk.CellRendererAccelMode.OTHER)
cell.connect("accel-edited", self._cellAccelEdit, self.liststore)
cell.connect("accel-cleared", self._accel_cleared, self.liststore)
self.cell = cell
@@ -226,8 +227,8 @@
else:
# There exists a shortcut
self.button.set_active(True)
- (accel_key, accel_mods) = gtk.accelerator_parse(self.new_task_binding)
- self.show_input = gtk.accelerator_get_label(accel_key, accel_mods)
+ (accel_key, accel_mods) = Gtk.accelerator_parse(self.new_task_binding)
+ self.show_input = Gtk.accelerator_get_label(accel_key, accel_mods)
self.liststore.set_value(iter1, 1, self.show_input)
def on_shortcut_toggled(self, widget):
@@ -243,10 +244,10 @@
def _cellAccelEdit(self, cell, path, accel_key, accel_mods, code, model):
""" Accelerator is modified """
- self.show_input = gtk.accelerator_get_label(accel_key, accel_mods)
- self.new_task_binding = gtk.accelerator_name(accel_key, accel_mods)
+ self.show_input = Gtk.accelerator_get_label(accel_key, accel_mods)
+ self.new_task_binding = Gtk.accelerator_name(accel_key, accel_mods)
if check_invalidity(self.new_task_binding, accel_key, accel_mods):
- self._show_warning(gtk.Button(_("Warning")), self.show_input)
+ self._show_warning(Gtk.Button(_("Warning")), self.show_input)
return
self.binding_backup = self.new_task_binding
iter = model.get_iter(path)
@@ -261,11 +262,13 @@
def _show_warning(self, widget, input_str):
""" Show warning when user enters inappropriate accelerator """
show = _("The shortcut \"%s\" cannot be used because "
- "it will become impossible to type using this key.\n"
- "Please try with a key such as "
- "Control, Alt or Shift at the same time.") % input_str
- dialog = gtk.MessageDialog(self.dialog, gtk.DIALOG_DESTROY_WITH_PARENT,
- gtk.MESSAGE_WARNING, gtk.BUTTONS_CANCEL,
+ "it will become impossible to type using this key.\n"
+ "Please try with a key such as "
+ "Control, Alt or Shift at the same time.") % input_str
+ dialog = Gtk.MessageDialog(self.dialog,
+ Gtk.DialogFlags.DESTROY_WITH_PARENT,
+ Gtk.MessageType.WARNING,
+ Gtk.ButtonsType.CANCEL,
show)
dialog.run()
dialog.hide()
=== renamed file 'GTG/gtk/preferences.glade' => 'GTG/gtk/preferences.ui'
--- GTG/gtk/preferences.glade 2013-03-04 16:37:04 +0000
+++ GTG/gtk/preferences.ui 2013-09-25 16:29:12 +0000
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <requires lib="gtk+" version="2.16"/>
- <!-- interface-naming-policy toplevel-contextual -->
+ <!-- interface-requires gtk+ 3.0 -->
<object class="GtkDialog" id="PreferencesDialog">
<property name="can_focus">False</property>
<property name="border_width">3</property>
@@ -9,18 +8,20 @@
<property name="type_hint">dialog</property>
<signal name="delete-event" handler="on_PreferencesDialog_delete_event" swapped="no"/>
<child internal-child="vbox">
- <object class="GtkVBox" id="prefs-vbox1">
+ <object class="GtkBox" id="prefs-vbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
<child>
<object class="GtkNotebook" id="notebook1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="show_tabs">False</property>
<child>
- <object class="GtkVBox" id="prefs-vbox2">
+ <object class="GtkBox" id="prefs-vbox2">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
<child>
<object class="GtkFrame" id="prefs-frame3">
<property name="visible">True</property>
@@ -34,9 +35,10 @@
<property name="bottom_padding">15</property>
<property name="left_padding">12</property>
<child>
- <object class="GtkVBox" id="prefs-vbox7">
+ <object class="GtkBox" id="prefs-vbox7">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
<child>
<object class="GtkCheckButton" id="pref_autostart">
<property name="label" translatable="yes">Start Getting Things GNOME! on every login</property>
@@ -55,7 +57,7 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox1">
+ <object class="GtkBox" id="hbox1">
<property name="height_request">21</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -121,9 +123,10 @@
<property name="bottom_padding">15</property>
<property name="left_padding">12</property>
<child>
- <object class="GtkVBox" id="prefs-vbox3">
+ <object class="GtkBox" id="prefs-vbox3">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
<child>
<object class="GtkCheckButton" id="bg_color_enable">
<property name="label" translatable="yes">Enable colored backgrounds in the task list</property>
@@ -192,7 +195,7 @@
<property name="bottom_padding">15</property>
<property name="left_padding">12</property>
<child>
- <object class="GtkHBox" id="prefs-vbox4">
+ <object class="GtkBox" id="prefs-vbox4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
@@ -244,44 +247,6 @@
</child>
</object>
</child>
- <child type="tab">
- <object class="GtkLabel" id="label2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">page 1</property>
- </object>
- <packing>
- <property name="tab_fill">False</property>
- </packing>
- </child>
- <child>
- <placeholder/>
- </child>
- <child type="tab">
- <object class="GtkLabel" id="label3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">page 2</property>
- </object>
- <packing>
- <property name="position">1</property>
- <property name="tab_fill">False</property>
- </packing>
- </child>
- <child>
- <placeholder/>
- </child>
- <child type="tab">
- <object class="GtkLabel" id="label4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">page 3</property>
- </object>
- <packing>
- <property name="position">2</property>
- <property name="tab_fill">False</property>
- </packing>
- </child>
</object>
<packing>
<property name="expand">True</property>
@@ -290,7 +255,7 @@
</packing>
</child>
<child internal-child="action_area">
- <object class="GtkHButtonBox" id="prefs-action_area">
+ <object class="GtkButtonBox" id="prefs-action_area">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
=== modified file 'GTG/gtk/tag_completion.py'
--- GTG/gtk/tag_completion.py 2012-11-25 19:19:44 +0000
+++ GTG/gtk/tag_completion.py 2013-09-25 16:29:12 +0000
@@ -19,7 +19,7 @@
""" Tag completion which is connected to LibLarch """
-import gtk
+from gi.repository import Gtk
import unicodedata
FILTER_NAME = '@@TagCompletion'
@@ -38,7 +38,7 @@
def normalize_unicode(string):
""" Unicode characters with diacritic could have more than just one
representation. We force them to be in just one of them."""
- return unicodedata.normalize('NFC', unicode(string))
+ return unicodedata.normalize('NFC', str(string))
def tag_match(completion, key, iterator, column):
@@ -57,7 +57,7 @@
return text.startswith(key)
-class TagCompletion(gtk.EntryCompletion):
+class TagCompletion(Gtk.EntryCompletion):
""" Tag completion which allows to enter 4 representation of a '@tag':
['@tag', '!@tag', 'tag', '!tag']
@@ -71,9 +71,9 @@
Create a list store which is connected to a LibLarch and
kept updated. """
- gtk.EntryCompletion.__init__(self)
+ Gtk.EntryCompletion.__init__(self)
- self.tags = gtk.ListStore(str)
+ self.tags = Gtk.ListStore(str)
tree = tree.get_basetree()
tree.add_filter(FILTER_NAME, tag_filter, {'flat': True})
=== modified file 'GTG/info.py'
--- GTG/info.py 2013-02-25 07:35:07 +0000
+++ GTG/info.py 2013-09-25 16:29:12 +0000
@@ -97,6 +97,9 @@
ARTISTS = ["Kalle Persson <kalle@xxxxxxxxxxxxxxx>",
"Bertrand Rousseau <bertrand.rousseau@xxxxxxxxx>"]
ARTISTS.sort()
+
+# Please, keep the width at max 80 characters wide because
+# GtkAboutDialog in GTK3 can't wrap text :/
TRANSLATORS = \
"""Afrikaans:Arthur Rilke, Walter Leibbrandt, Wesley Channon
=== modified file 'GTG/plugins/bugzilla/bugzilla.py'
--- GTG/plugins/bugzilla/bugzilla.py 2013-07-02 17:50:18 +0000
+++ GTG/plugins/bugzilla/bugzilla.py 2013-09-25 16:29:12 +0000
@@ -14,15 +14,15 @@
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
-import gobject
+from gi.repository import GObject
import re
import threading
-import xmlrpclib
-from urlparse import urlparse
+import xmlrpc.client
+from urllib.parse import urlparse
-from services import BugzillaServiceFactory
-from services import BugzillaServiceNotExist
-from notification import send_notification
+from .services import BugzillaServiceFactory
+from .services import BugzillaServiceNotExist
+from .notification import send_notification
__all__ = ('pluginBugzilla', )
@@ -67,7 +67,7 @@
try:
bug = bugzillaService.getBug(bug_id)
- except xmlrpclib.Fault, err:
+ except xmlrpc.client.Fault as err:
code = err.faultCode
if code == 100: # invalid bug ID
title = 'Invalid bug ID #%s' % bug_id
@@ -79,18 +79,18 @@
title = err.faultString
send_notification(bugzillaService.name, title)
- except Exception, err:
+ except Exception as err:
send_notification(bugzillaService.name, err.message)
else:
title = '#%s: %s' % (bug_id, bug.summary)
- gobject.idle_add(self.task.set_title, title)
+ GObject.idle_add(self.task.set_title, title)
text = "%s\n\n%s" % (bug_url, bug.description)
- gobject.idle_add(self.task.set_text, text)
+ GObject.idle_add(self.task.set_text, text)
tags = bugzillaService.getTags(bug)
if tags is not None and tags:
for tag in tags:
- gobject.idle_add(self.task.add_tag, '@%s' % tag)
+ GObject.idle_add(self.task.add_tag, '@%s' % tag)
class pluginBugzilla:
=== modified file 'GTG/plugins/bugzilla/notification.py'
--- GTG/plugins/bugzilla/notification.py 2013-07-03 00:27:08 +0000
+++ GTG/plugins/bugzilla/notification.py 2013-09-25 16:29:12 +0000
@@ -14,9 +14,9 @@
TIMEOUT = 3000
-def _notify_via_pynotify(title, message):
- pynotify.init(APP_NAME)
- nt = pynotify.Notification(title, message)
+def _notify_via_notify(title, message):
+ Notify.init(APP_NAME)
+ nt = Notify.Notification.new(title, message)
nt.set_timeout(TIMEOUT)
try:
nt.show()
@@ -39,8 +39,8 @@
try:
# Primarily, pynotify is used to send notification. However, it might not
# appear in user's machine. So, we'll try another alternative.
- import pynotify
- _notify_handler = _notify_via_pynotify
+ from gi.repository import Notify
+ _notify_handler = _notify_via_notify
except ImportError:
# The alternative is notify-send, which is a command line utility provided
# by libnotify package.
@@ -60,5 +60,5 @@
@atexit.register
-def uinit_pynotify():
- pynotify.uninit()
+def uinit_notify():
+ Notify.uninit()
=== modified file 'GTG/plugins/bugzilla/services.py'
--- GTG/plugins/bugzilla/services.py 2013-06-04 13:54:42 +0000
+++ GTG/plugins/bugzilla/services.py 2013-09-25 16:29:12 +0000
@@ -2,9 +2,9 @@
# Remove dependence of bugz due to that plugin just needs get action and
# it is done by Python xmlrpclib simply enough.
-from xmlrpclib import ServerProxy
+from xmlrpc.client import ServerProxy
-from bug import BugFactory
+from .bug import BugFactory
__all__ = ('BugzillaServiceFactory',)
=== modified file 'GTG/plugins/export/export.py'
--- GTG/plugins/export/export.py 2013-02-25 08:29:31 +0000
+++ GTG/plugins/export/export.py 2013-09-25 16:29:12 +0000
@@ -24,8 +24,7 @@
import subprocess
from xdg.BaseDirectory import xdg_config_home
-import gobject
-import gtk
+from gi.repository import GObject, Gtk, GdkPixbuf
from GTG import _
from GTG.plugins.export.task_str import get_task_wrappers
@@ -132,7 +131,7 @@
try:
self.template.generate(tasks, self.plugin_api,
self.on_export_finished)
- except Exception, err:
+ except Exception as err:
self.show_error_dialog(
_("GTG could not generate the document: %s") % err)
raise
@@ -179,26 +178,25 @@
self.menu_entry = False
self.toolbar_entry = False
- self.menu_item = gtk.MenuItem(_("Export the tasks currently listed"))
+ self.menu_item = Gtk.MenuItem(_("Export the tasks currently listed"))
self.menu_item.connect('activate', self.show_dialog)
self.menu_item.show()
- self.tb_button = gtk.ToolButton(gtk.STOCK_PRINT)
+ self.tb_button = Gtk.ToolButton(Gtk.STOCK_PRINT)
self.tb_button.connect('clicked', self.show_dialog)
self.tb_button.show()
- builder = gtk.Builder()
+ builder = Gtk.Builder()
cur_dir = os.path.dirname(os.path.abspath(__file__))
builder_file = os.path.join(cur_dir, "export.ui")
builder.add_from_file(builder_file)
self.combo = builder.get_object("export_combo_templ")
- templates_list = gtk.ListStore(gobject.TYPE_STRING,
- gobject.TYPE_STRING,
- gobject.TYPE_STRING, gobject.TYPE_STRING
- )
+ templates_list = Gtk.ListStore(
+ GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING,
+ GObject.TYPE_STRING)
self.combo.set_model(templates_list)
- cell = gtk.CellRendererText()
+ cell = Gtk.CellRendererText()
self.combo.pack_start(cell, True)
self.combo.add_attribute(cell, 'text', 1)
@@ -293,10 +291,10 @@
description, image = model[active][2], model[active][3]
if image:
- pixbuf = gtk.gdk.pixbuf_new_from_file(image)
+ pixbuf = GdkPixbuf.Pixbuf.new_from_file(image)
width, height = self.export_image.get_size_request()
pixbuf = pixbuf.scale_simple(width, height,
- gtk.gdk.INTERP_BILINEAR)
+ GdkPixbuf.InterpType.BILINEAR)
self.export_image.set_from_pixbuf(pixbuf)
else:
self.export_image.clear()
@@ -308,30 +306,30 @@
def show_error_dialog(self, message):
""" Display an error """
- dialog = gtk.MessageDialog(
+ dialog = Gtk.MessageDialog(
parent=self.export_dialog,
- flags=gtk.DIALOG_DESTROY_WITH_PARENT,
- type=gtk.MESSAGE_ERROR,
- buttons=gtk.BUTTONS_OK,
+ flags=Gtk.DialogFlags.DESTROY_WITH_PARENT,
+ type=Gtk.MessageType.ERROR,
+ buttons=Gtk.ButtonsType.OK,
message_format=message)
dialog.run()
dialog.destroy()
def choose_file(self):
""" Let user choose a file to save and return its path """
- chooser = gtk.FileChooserDialog(
+ chooser = Gtk.FileChooserDialog(
title=_("Choose where to save your list"),
parent=self.export_dialog,
- action=gtk.FILE_CHOOSER_ACTION_SAVE,
- buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
- gtk.STOCK_SAVE, gtk.RESPONSE_OK))
+ action=Gtk.FileChooserAction.SAVE,
+ buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
+ Gtk.STOCK_SAVE, Gtk.ResponseType.OK))
chooser.set_do_overwrite_confirmation(True)
- chooser.set_default_response(gtk.RESPONSE_OK)
+ chooser.set_default_response(Gtk.ResponseType.OK)
chooser.set_current_folder(get_desktop_dir())
response = chooser.run()
filename = chooser.get_filename()
chooser.destroy()
- if response == gtk.RESPONSE_OK:
+ if response == Gtk.ResponseType.OK:
return filename
else:
return None
=== modified file 'GTG/plugins/export/export.ui'
--- GTG/plugins/export/export.ui 2012-08-11 11:46:52 +0000
+++ GTG/plugins/export/export.ui 2013-09-25 16:29:12 +0000
@@ -1,7 +1,6 @@
<?xml version="1.0"?>
<interface>
- <requires lib="gtk+" version="2.16"/>
- <!-- interface-naming-policy toplevel-contextual -->
+ <!-- interface-requires gtk+ 3.0 -->
<object class="GtkAccelGroup" id="accelgroup1"/>
<object class="GtkWindow" id="export_dialog">
<property name="title" translatable="yes">Export tasks</property>
@@ -9,19 +8,22 @@
<property name="destroy_with_parent">True</property>
<signal name="delete_event" handler="on_export_dialog_delete_event"/>
<child>
- <object class="GtkVBox" id="vbox3">
+ <object class="GtkBox" id="vbox3">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<child>
- <object class="GtkHBox" id="hbox11">
+ <object class="GtkBox" id="box11">
<property name="visible">True</property>
<property name="border_width">15</property>
<property name="spacing">15</property>
<child>
- <object class="GtkVBox" id="vbox111">
+ <object class="GtkBox" id="vbox111">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<child>
- <object class="GtkVBox" id="vbox44444444444">
+ <object class="GtkBox" id="vbox44444444444">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="label1ewegwegewg">
<property name="visible">True</property>
@@ -37,8 +39,9 @@
<object class="GtkAlignment" id="alignment3">
<property name="visible">True</property>
<child>
- <object class="GtkVBox" id="vbox1342342243">
+ <object class="GtkBox" id="vbox1342342243">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<child>
<object class="GtkRadioButton" id="export_all_active_rb">
<property name="label" translatable="yes">Active tasks shown in the browser</property>
@@ -100,8 +103,9 @@
<property name="visible">True</property>
<property name="top_padding">20</property>
<child>
- <object class="GtkVBox" id="vbox1343">
+ <object class="GtkBox" id="vbox1343">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="label1lalalla">
<property name="visible">True</property>
@@ -175,7 +179,7 @@
<property name="visible">True</property>
<property name="yalign">1</property>
<child>
- <object class="GtkHBox" id="buttonbox">
+ <object class="GtkBox" id="buttonbox">
<property name="height_request">50</property>
<property name="visible">True</property>
<property name="border_width">12</property>
@@ -222,8 +226,9 @@
<property name="type_hint">dialog</property>
<signal name="delete_event" handler="on_preferences_dialog_delete_event"/>
<child>
- <object class="GtkVBox" id="vbox1">
+ <object class="GtkBox" id="vbox1">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
@@ -235,8 +240,9 @@
</packing>
</child>
<child>
- <object class="GtkVBox" id="vbox2">
+ <object class="GtkBox" id="vbox2">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<child>
<object class="GtkCheckButton" id="pref_chbox_menu">
<property name="label" translatable="yes">Put an entry in the Plugins menu</property>
@@ -268,7 +274,7 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox1">
+ <object class="GtkBox" id="box1">
<property name="height_request">30</property>
<property name="visible">True</property>
<property name="spacing">50</property>
=== modified file 'GTG/plugins/export/templates.py'
--- GTG/plugins/export/templates.py 2013-02-25 08:29:31 +0000
+++ GTG/plugins/export/templates.py 2013-09-25 16:29:12 +0000
@@ -26,7 +26,7 @@
from Cheetah.Template import Template as CheetahTemplate
from xdg.BaseDirectory import xdg_config_home
-import gobject
+from gi.repository import GObject
TEMPLATE_PATHS = [
os.path.join(xdg_config_home, "gtg/plugins/export/export_templates"),
@@ -168,7 +168,7 @@
def wait_for_document():
""" Wait for the completion of the script and finish generation """
document_ready.wait()
- gobject.idle_add(callback)
+ GObject.idle_add(callback)
threading.Thread(target=script).start()
threading.Thread(target=wait_for_document).start()
=== renamed file 'GTG/plugins/geolocalized_tasks/geolocalized.glade' => 'GTG/plugins/geolocalized_tasks/geolocalized.ui'
--- GTG/plugins/geolocalized_tasks/geolocalized.glade 2012-05-23 08:55:31 +0000
+++ GTG/plugins/geolocalized_tasks/geolocalized.ui 2013-09-25 16:29:12 +0000
@@ -1,43 +1,52 @@
<?xml version="1.0"?>
-<glade-interface>
- <!-- interface-requires gtk+ 2.16 -->
- <!-- interface-naming-policy toplevel-contextual -->
- <widget class="GtkDialog" id="SetTaskLocation">
+<interface>
+ <!-- interface-requires gtk+ 3.0 -->
+ <object class="GtkAdjustment" id="adjustment1">
+ <property name="upper">100</property>
+ <property name="lower">1</property>
+ <property name="page_increment">10</property>
+ <property name="step_increment">0.10000000149</property>
+ <property name="page_size">10</property>
+ <property name="value">5</property>
+ </object>
+ <object class="GtkDialog" id="SetTaskLocation">
<property name="visible">True</property>
<property name="title" translatable="yes">Set the task's location</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
- <widget class="GtkVBox" id="dialog-vbox2">
+ <object class="GtkBox" id="dialog-vbox2">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<child>
- <widget class="GtkVBox" id="vbox">
+ <object class="GtkBox" id="vbox">
<property name="width_request">400</property>
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<child>
- <widget class="GtkToolbar" id="toolbar2">
+ <object class="GtkToolbar" id="toolbar2">
<property name="visible">True</property>
<property name="toolbar_style">both</property>
<child>
- <widget class="GtkToolButton" id="btn_zoom_in">
+ <object class="GtkToolButton" id="btn_zoom_in">
<property name="visible">True</property>
<property name="stock_id">gtk-zoom-in</property>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
- <widget class="GtkToolButton" id="btn_zoom_out">
+ <object class="GtkToolButton" id="btn_zoom_out">
<property name="visible">True</property>
<property name="stock_id">gtk-zoom-out</property>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
@@ -45,26 +54,26 @@
</packing>
</child>
<child>
- <widget class="GtkVBox" id="vbox_map">
+ <object class="GtkBox" id="vbox_map">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<child>
<placeholder/>
</child>
- </widget>
+ </object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child>
- <widget class="GtkVBox" id="vbox_opt">
+ <object class="GtkBox" id="vbox_opt">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<child>
- <widget class="GtkTable" id="tabela_set_task">
+ <object class="GtkGrid" id="tabela_set_task">
<property name="visible">True</property>
- <property name="n_rows">2</property>
- <property name="n_columns">2</property>
<child>
- <widget class="GtkRadioButton" id="radiobutton1">
+ <object class="GtkRadioButton" id="radiobutton1">
<property name="label" translatable="yes">Associate with new tag</property>
<property name="width_request">198</property>
<property name="visible">True</property>
@@ -72,14 +81,16 @@
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
- </widget>
+ </object>
<packing>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="left">0</property>
+ <property name="top">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
</packing>
</child>
<child>
- <widget class="GtkRadioButton" id="radiobutton2">
+ <object class="GtkRadioButton" id="radiobutton2">
<property name="label" translatable="yes">Associate with existing tag</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -87,45 +98,44 @@
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<property name="group">radiobutton1</property>
- </widget>
+ </object>
<packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="left">0</property>
+ <property name="top">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
</packing>
</child>
<child>
- <widget class="GtkEntry" id="txt_new_tag">
+ <object class="GtkEntry" id="txt_new_tag">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
- </widget>
+ </object>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="y_options"></property>
+ <property name="left">1</property>
+ <property name="top">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
</packing>
</child>
<child>
- <widget class="GtkComboBoxEntry" id="cmb_existing_tag">
+ <object class="GtkComboBoxText" id="cmb_existing_tag">
<property name="visible">True</property>
- </widget>
+ </object>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="left">1</property>
+ <property name="top">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
</packing>
</child>
- </widget>
+ </object>
<packing>
<property name="position">0</property>
</packing>
</child>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
@@ -133,7 +143,7 @@
<property name="position">2</property>
</packing>
</child>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
@@ -141,19 +151,18 @@
</packing>
</child>
<child internal-child="action_area">
- <widget class="GtkHButtonBox" id="dialog_action_area_btn">
+ <object class="GtkButtonBox" id="dialog_action_area_btn">
<property name="visible">True</property>
<property name="layout_style">end</property>
<child>
- <widget class="GtkButton" id="btn_cancel">
+ <object class="GtkButton" id="btn_cancel">
<property name="label">gtk-cancel</property>
- <property name="response_id">-6</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
@@ -161,15 +170,14 @@
</packing>
</child>
<child>
- <widget class="GtkButton" id="btn_ok">
+ <object class="GtkButton" id="btn_ok">
<property name="label">gtk-ok</property>
- <property name="response_id">-5</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
@@ -177,63 +185,69 @@
</packing>
</child>
<child>
- <widget class="GtkButton" id="btn_close">
+ <object class="GtkButton" id="btn_close">
<property name="label">gtk-close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
- </widget>
+ </object>
</child>
- </widget>
- <widget class="GtkDialog" id="TagLocation">
+ <action-widgets>
+ <action-widget response="-6">btn_cancel</action-widget>
+ <action-widget response="-5">btn_ok</action-widget>
+ </action-widgets>
+ </object>
+ <object class="GtkDialog" id="TagLocation">
<property name="visible">True</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
- <widget class="GtkVBox" id="dialog-vbox3">
+ <object class="GtkBox" id="dialog-vbox3">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<child>
- <widget class="GtkVBox" id="vbox3">
+ <object class="GtkBox" id="vbox3">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<child>
- <widget class="GtkToolbar" id="toolbar3">
+ <object class="GtkToolbar" id="toolbar3">
<property name="visible">True</property>
<property name="toolbar_style">both</property>
<child>
- <widget class="GtkToolButton" id="btn_zoom_in">
+ <object class="GtkToolButton" id="btn_zoom_in2">
<property name="visible">True</property>
<property name="stock_id">gtk-zoom-in</property>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
- <widget class="GtkToolButton" id="btn_zoom_out">
+ <object class="GtkToolButton" id="btn_zoom_out2">
<property name="visible">True</property>
<property name="stock_id">gtk-zoom-out</property>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
@@ -241,18 +255,19 @@
</packing>
</child>
<child>
- <widget class="GtkVBox" id="vbox_map">
+ <object class="GtkBox" id="vbox_map2">
<property name="width_request">400</property>
+ <property name="orientation">vertical</property>
<property name="visible">True</property>
<child>
<placeholder/>
</child>
- </widget>
+ </object>
<packing>
<property name="position">1</property>
</packing>
</child>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
@@ -260,19 +275,18 @@
</packing>
</child>
<child internal-child="action_area">
- <widget class="GtkHButtonBox" id="dialog-action_area3">
+ <object class="GtkButtonBox" id="dialog-action_area3">
<property name="visible">True</property>
<property name="layout_style">end</property>
<child>
- <widget class="GtkButton" id="cancelbutton3">
+ <object class="GtkButton" id="cancelbutton3">
<property name="label">gtk-cancel</property>
- <property name="response_id">-6</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
@@ -280,68 +294,73 @@
</packing>
</child>
<child>
- <widget class="GtkButton" id="okbutton3">
+ <object class="GtkButton" id="okbutton3">
<property name="label">gtk-ok</property>
- <property name="response_id">-5</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
- </widget>
+ </object>
</child>
- </widget>
- <widget class="GtkDialog" id="Preferences">
+ <action-widgets>
+ <action-widget response="-6">cancelbutton3</action-widget>
+ <action-widget response="-5">okbutton3</action-widget>
+ </action-widgets>
+ </object>
+ <object class="GtkDialog" id="Preferences">
<property name="width_request">350</property>
<property name="visible">True</property>
<property name="title" translatable="yes">Geolocalized-tasks Preferences</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
- <widget class="GtkVBox" id="dialog-vbox4">
+ <object class="GtkBox" id="dialog-vbox4">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<child>
- <widget class="GtkVBox" id="vbox4">
+ <object class="GtkBox" id="vbox4">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<child>
- <widget class="GtkFrame" id="frame4">
+ <object class="GtkFrame" id="frame4">
<property name="visible">True</property>
<property name="border_width">3</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
- <widget class="GtkAlignment" id="alignment4">
+ <object class="GtkAlignment" id="alignment4">
<property name="visible">True</property>
<property name="left_padding">12</property>
<child>
- <widget class="GtkHBox" id="hbox5">
+ <object class="GtkBox" id="box5">
<property name="visible">True</property>
<child>
- <widget class="GtkVBox" id="vbox5">
+ <object class="GtkBox" id="vbox5">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
- <widget class="GtkCheckButton" id="check_network">
+ <object class="GtkCheckButton" id="check_network">
<property name="label" translatable="yes">Use network</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
@@ -349,14 +368,14 @@
</packing>
</child>
<child>
- <widget class="GtkCheckButton" id="check_cellphone">
+ <object class="GtkCheckButton" id="check_cellphone">
<property name="label" translatable="yes">Use cellphone</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
@@ -364,66 +383,63 @@
</packing>
</child>
<child>
- <widget class="GtkCheckButton" id="check_gps">
+ <object class="GtkCheckButton" id="check_gps">
<property name="label" translatable="yes">Use gps</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
- </widget>
+ </object>
<packing>
<property name="position">0</property>
</packing>
</child>
- </widget>
+ </object>
</child>
- </widget>
+ </object>
</child>
- <child>
- <widget class="GtkLabel" id="label6">
+ <child type="label">
+ <object class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="label" translatable="yes"><b>Location Determination Method</b></property>
<property name="use_markup">True</property>
- </widget>
- <packing>
- <property name="type">label_item</property>
- </packing>
+ </object>
</child>
- </widget>
+ </object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
- <widget class="GtkFrame" id="frame5">
+ <object class="GtkFrame" id="frame5">
<property name="visible">True</property>
<property name="border_width">3</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
- <widget class="GtkAlignment" id="alignment5">
+ <object class="GtkAlignment" id="alignment5">
<property name="visible">True</property>
<property name="left_padding">12</property>
<child>
- <widget class="GtkHBox" id="hbox3">
+ <object class="GtkBox" id="box3">
<property name="visible">True</property>
<child>
- <widget class="GtkSpinButton" id="spin_proximityfactor">
+ <object class="GtkSpinButton" id="spin_proximityfactor">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
- <property name="adjustment">5 1 100 0.10000000149 10 10</property>
+ <property name="adjustment">adjustment1</property>
<property name="climb_rate">1</property>
<property name="digits">1</property>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
@@ -431,57 +447,53 @@
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label8">
+ <object class="GtkLabel" id="label8">
<property name="visible">True</property>
<property name="xpad">4</property>
<property name="label" translatable="yes"><small>Distance in kilometers from
the current location.</small></property>
<property name="use_markup">True</property>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
- </widget>
+ </object>
</child>
- </widget>
+ </object>
</child>
- <child>
- <widget class="GtkLabel" id="label7">
+ <child type="label">
+ <object class="GtkLabel" id="label7">
<property name="visible">True</property>
<property name="label" translatable="yes"><b>Proximity Factor</b></property>
<property name="use_markup">True</property>
- </widget>
- <packing>
- <property name="type">label_item</property>
- </packing>
+ </object>
</child>
- </widget>
+ </object>
<packing>
<property name="position">1</property>
</packing>
</child>
- </widget>
+ </object>
<packing>
<property name="position">2</property>
</packing>
</child>
<child internal-child="action_area">
- <widget class="GtkHButtonBox" id="dialog-action_area4">
+ <object class="GtkButtonBox" id="dialog-action_area4">
<property name="visible">True</property>
<property name="layout_style">end</property>
<child>
- <widget class="GtkButton" id="cancelbutton4">
+ <object class="GtkButton" id="cancelbutton4">
<property name="label">gtk-cancel</property>
- <property name="response_id">-6</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
@@ -489,29 +501,32 @@
</packing>
</child>
<child>
- <widget class="GtkButton" id="okbutton4">
+ <object class="GtkButton" id="okbutton4">
<property name="label">gtk-ok</property>
- <property name="response_id">-5</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
- </widget>
+ </object>
<packing>
<property name="expand">False</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
- </widget>
+ </object>
</child>
- </widget>
-</glade-interface>
+ <action-widgets>
+ <action-widget response="-6">cancelbutton4</action-widget>
+ <action-widget response="-5">okbutton4</action-widget>
+ </action-widgets>
+ </object>
+</interface>
=== modified file 'GTG/plugins/geolocalized_tasks/geolocalized_tasks.py'
--- GTG/plugins/geolocalized_tasks/geolocalized_tasks.py 2013-02-25 07:35:07 +0000
+++ GTG/plugins/geolocalized_tasks/geolocalized_tasks.py 2013-09-25 16:29:12 +0000
@@ -14,17 +14,22 @@
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
-import gtk
+from gi.repository import Gtk, GdkPixbuf, GtkClutter
import os
import Geoclue
-import cluttergtk
-import clutter
+from gi.repository import Clutter
import champlain
from GTG.plugins.geolocalized_tasks.marker import MarkerLayer
+# Attention!!! FIXME
+# FIXME During porting GTG into GTK3/PyGObject was geolocalized.glade converted
+# to GtkBuilder format together with other glade XMLs.
+# FIXME Since this plugin is broken, I am not going to replace galde mentions
+# to GtkBuilder, it's your job ;)
+
class geolocalizedTasks:
@@ -33,10 +38,10 @@
self.geoclue.connect(self.location_changed)
self.plugin_path = os.path.dirname(os.path.abspath(__file__))
- self.glade_file = os.path.join(self.plugin_path, "geolocalized.glade")
+ self.glade_file = os.path.join(self.plugin_path, "geolocalized.ui")
# the preference menu for the plugin
- self.menu_item = gtk.MenuItem("Geolocalized-tasks Preferences")
+ self.menu_item = Gtk.MenuItem("Geolocalized-tasks Preferences")
self.PROXIMITY_FACTOR = 5 # 5 km
self.LOCATION_DETERMINATION_METHOD = []
@@ -55,7 +60,7 @@
self.LOCATION_DETERMINATION_METHOD.append("cellphone")
self.location_filter = []
- self.task_separator = gtk.SeparatorToolItem()
+ self.task_separator = Gtk.SeparatorToolItem()
def activate(self, plugin_api):
self.plugin_api = plugin_api
@@ -66,15 +71,15 @@
image_assign_location_path = os.path.join(self.plugin_path,
"icons/hicolor/16x16/assign\
-location.png")
- pixbug_assign_location = gtk.gdk.pixbuf_new_from_file_at_size(
+ pixbug_assign_location = GdkPixbuf.Pixbuf.new_from_file_at_size(
image_assign_location_path, 16, 16)
- image_assign_location = gtk.Image()
+ image_assign_location = Gtk.Image()
image_assign_location.set_from_pixbuf(pixbug_assign_location)
image_assign_location.show()
# the menu intem for the tag context
- self.context_item = gtk.ImageMenuItem("Assign a location to this tag")
+ self.context_item = Gtk.ImageMenuItem("Assign a location to this tag")
self.context_item.set_image(image_assign_location)
# TODO: add a short cut to the menu
@@ -198,23 +203,23 @@
image_geolocalization_path = os.path.join(self.plugin_path,
"icons/hicolor/24x24/\
geolocalization.png")
- pixbuf_geolocalization = gtk.gdk.pixbuf_new_from_file_at_size(
+ pixbuf_geolocalization = GdkPixbuf.Pixbuf.new_from_file_at_size(
image_geolocalization_path, 24, 24)
# create the image and associate the pixbuf
- icon_geolocalization = gtk.Image()
+ icon_geolocalization = Gtk.Image()
icon_geolocalization.set_from_pixbuf(pixbuf_geolocalization)
icon_geolocalization.show()
# toolbar button for the location_view
- btn_location_view = gtk.ToggleToolButton()
+ btn_location_view = Gtk.ToggleToolButton()
btn_location_view.set_icon_widget(icon_geolocalization)
btn_location_view.set_label("Location View")
self.task_separator = plugin_api.add_task_toolbar_item(
- gtk.SeparatorToolItem())
+ Gtk.SeparatorToolItem())
- btn_set_location = gtk.ToolButton()
+ btn_set_location = Gtk.ToolButton()
btn_set_location.set_icon_widget(icon_geolocalization)
btn_set_location.set_label("Set/View location")
btn_set_location.connect('clicked', self.set_task_location, plugin_api)
@@ -263,7 +268,7 @@
#=== GEOLOCALIZED PREFERENCES=============================================
def on_geolocalized_preferences(self):
- wTree = gtk.glade.XML(self.glade_file, "Preferences")
+ wTree = Gtk.glade.XML(self.glade_file, "Preferences")
dialog = wTree.get_widget("Preferences")
dialog.connect("response", self.preferences_close)
@@ -361,7 +366,7 @@
self.tmp_proximityfactor = spinbutton.get_value()
def preferences_close(self, dialog, response=None):
- if response == gtk.RESPONSE_OK:
+ if response == Gtk.ResponseType.OK:
self.PROXIMITY_FACTOR = float(self.tmp_proximityfactor)
dialog.destroy()
else:
@@ -371,7 +376,7 @@
#=== SET TASK LOCATION ====================================================
def set_task_location(self, widget, plugin_api, location=None):
- wTree = gtk.glade.XML(self.glade_file, "SetTaskLocation")
+ wTree = Gtk.glade.XML(self.glade_file, "SetTaskLocation")
dialog = wTree.get_widget("SetTaskLocation")
plugin_api.set_parent_window(dialog)
@@ -416,7 +421,7 @@
# checks if there is one tag with a location
task_has_location = False
for tag in tag_list:
- for key, item in tag.items():
+ for key, item in list(tag.items()):
if key == "location":
task_has_location = True
break
@@ -427,7 +432,7 @@
self.marker_list = []
if task_has_location:
for tag in tag_list:
- for key, item in tag.items():
+ for key, item in list(tag.items()):
if key == "location":
color = None
try:
@@ -454,7 +459,7 @@
champlain_view.add_layer(layer)
- embed = cluttergtk.Embed()
+ embed = GtkClutter.Embed()
embed.set_size_request(400, 300)
if not task_has_location:
@@ -498,7 +503,7 @@
if not task_has_location:
self.location_defined = False
if len(plugin_api.get_tags()) > 0:
- liststore = gtk.ListStore(str)
+ liststore = Gtk.ListStore(str)
self.cmb_existing_tag.set_model(liststore)
for tag in plugin_api.get_tags():
liststore.append([tag.get_attribute("name")])
@@ -509,7 +514,7 @@
tabela.remove(self.radiobutton1)
tabela.remove(self.radiobutton2)
tabela.remove(self.cmb_existing_tag)
- label = gtk.Label()
+ label = Gtk.Label()
label.set_text("Associate with new tag: ")
tabela.attach(label, 0, 1, 0, 1)
label.show()
@@ -536,7 +541,7 @@
dialog.destroy()
def set_task_location_close(self, dialog, response=None, plugin_api=None):
- if response == gtk.RESPONSE_OK:
+ if response == Gtk.ResponseType.OK:
# ok
# tries to get the radiobuttons value, witch may not exist
if not self.location_defined:
@@ -594,7 +599,7 @@
#=== TAG VIEW CONTEXT MENU ================================================
def on_contextmenu_tag_location(self, widget, plugin_api):
- wTree = gtk.glade.XML(self.glade_file, "TagLocation")
+ wTree = Gtk.glade.XML(self.glade_file, "TagLocation")
dialog = wTree.get_widget("TagLocation")
plugin_api.set_parent_window(dialog)
@@ -641,7 +646,7 @@
champlain_view.add_layer(layer)
- embed = cluttergtk.Embed()
+ embed = GtkClutter.Embed()
embed.set_size_request(400, 300)
champlain_view.set_reactive(True)
@@ -692,7 +697,7 @@
marker.set_position(latitude, longitude)
def tag_location_close(self, dialog, response=None, tag=None, marker=None):
- if response == gtk.RESPONSE_OK:
+ if response == Gtk.ResponseType.OK:
tag_location = str((marker.get_property('latitude'),
marker.get_property('longitude')))
tag.set_attribute("location", tag_location)
@@ -719,4 +724,4 @@
"input #%s is not in #RRGGBB format" % colorstring)
r, g, b = colorstring[:2], colorstring[2:4], colorstring[4:]
r, g, b = [int(n, 16) for n in (r, g, b)]
- return clutter.Color(r, g, b)
+ return Clutter.Color(r, g, b)
=== modified file 'GTG/plugins/geolocalized_tasks/marker.py'
--- GTG/plugins/geolocalized_tasks/marker.py 2013-02-25 07:35:07 +0000
+++ GTG/plugins/geolocalized_tasks/marker.py 2013-09-25 16:29:12 +0000
@@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
-import clutter
+from gi.repository import Clutter
import champlain
@@ -23,11 +23,11 @@
def __init__(self):
champlain.Layer.__init__(self)
# a marker can also be set in RGB with ints
- self.gray = clutter.Color(51, 51, 51)
+ self.gray = Clutter.Color(51, 51, 51)
# RGBA
- self.white = clutter.Color(0xff, 0xff, 0xff, 0xff)
- self.black = clutter.Color(0x00, 0x00, 0x00, 0xff)
+ self.white = Clutter.Color(0xff, 0xff, 0xff, 0xff)
+ self.black = Clutter.Color(0x00, 0x00, 0x00, 0xff)
self.hide()
=== modified file 'GTG/plugins/hamster/hamster.py'
--- GTG/plugins/hamster/hamster.py 2013-03-03 07:27:26 +0000
+++ GTG/plugins/hamster/hamster.py 2013-09-25 16:29:12 +0000
@@ -19,7 +19,7 @@
from calendar import timegm
import dbus
-import gtk
+from gi.repository import Gtk
import os
import re
import time
@@ -41,7 +41,7 @@
def __init__(self):
# task editor widget
self.vbox = None
- self.button = gtk.ToolButton()
+ self.button = Gtk.ToolButton()
#### Interaction with Hamster
def sendTask(self, task):
@@ -53,7 +53,7 @@
activity = "Other"
if self.preferences['activity'] == 'tag':
- hamster_activities = set([unicode(x[0]).lower()
+ hamster_activities = set([str(x[0]).lower()
for x in self.hamster.GetActivities()])
activity_candidates = hamster_activities.intersection(
set(gtg_tags))
@@ -67,7 +67,7 @@
category = ""
if self.preferences['category'] == 'auto_tag':
- hamster_activities = dict([(unicode(x[0]), unicode(x[1]))
+ hamster_activities = dict([(str(x[0]), str(x[1]))
for x in self.hamster.GetActivities()])
if (gtg_title in hamster_activities
or gtg_title.replace(",", "") in hamster_activities):
@@ -76,7 +76,7 @@
if (self.preferences['category'] == 'tag' or
(self.preferences['category'] == 'auto_tag' and not category)):
# See if any of the tags match existing categories
- categories = dict([(unicode(x[1]).lower(), unicode(x[1]))
+ categories = dict([(str(x[1]).lower(), str(x[1]))
for x in self.hamster.GetCategories()])
lower_gtg_tags = set([x.lower() for x in gtg_tags])
intersection = set(categories.keys()).intersection(lower_gtg_tags)
@@ -96,7 +96,7 @@
tag_candidates = []
try:
if self.preferences['tags'] == 'existing':
- hamster_tags = set([unicode(x) for x in
+ hamster_tags = set([str(x) for x in
self.hamster.GetTags()])
tag_candidates = list(hamster_tags.intersection(set(gtg_tags)))
elif self.preferences['tags'] == 'all':
@@ -130,7 +130,7 @@
except dbus.DBusException:
pass
modified = True
- print "Removing invalid fact", i
+ print("Removing invalid fact", i)
if modified:
self.set_hamster_ids(task, valid_ids)
return records
@@ -171,7 +171,7 @@
# add menu item
if plugin_api.is_browser():
- self.menu_item = gtk.MenuItem(_("Start task in Hamster"))
+ self.menu_item = Gtk.MenuItem(_("Start task in Hamster"))
self.menu_item.show_all()
self.menu_item.connect('activate', self.browser_cb, plugin_api)
plugin_api.add_menu_item(self.menu_item)
@@ -188,7 +188,7 @@
def onTaskOpened(self, plugin_api):
# add button
- self.taskbutton = gtk.ToolButton()
+ self.taskbutton = Gtk.ToolButton()
self.taskbutton.set_label("Start")
self.taskbutton.set_icon_name('hamster-applet')
self.taskbutton.set_tooltip_text(self.TOOLTIP_TEXT)
@@ -201,23 +201,23 @@
if len(records):
# add section to bottom of window
- vbox = gtk.VBox()
- inner_table = gtk.Table(rows=len(records), columns=2)
+ vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
+ inner_grid = Gtk.Grid()
if len(records) > 8:
- s = gtk.ScrolledWindow()
- s.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
- v = gtk.Viewport()
- v.add(inner_table)
+ s = Gtk.ScrolledWindow()
+ s.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
+ v = Gtk.Viewport()
+ v.add(inner_grid)
s.add(v)
- v.set_shadow_type(gtk.SHADOW_NONE)
+ v.set_shadow_type(Gtk.ShadowType.NONE)
s.set_size_request(-1, 150)
else:
- s = inner_table
+ s = inner_grid
- outer_table = gtk.Table(rows=1, columns=2)
- vbox.pack_start(s)
- vbox.pack_start(outer_table)
- vbox.pack_end(gtk.HSeparator())
+ outer_grid = Gtk.Grid()
+ vbox.pack_start(s, True, True, 0)
+ vbox.pack_start(outer_grid, True, True, 0)
+ vbox.pack_end(Gtk.Separator())
total = 0
@@ -226,29 +226,25 @@
a = "<span color='red'>%s</span>" % a
b = "<span color='red'>%s</span>" % b
- dateLabel = gtk.Label(a)
+ dateLabel = Gtk.Label(label=a)
dateLabel.set_use_markup(True)
dateLabel.set_alignment(xalign=0.0, yalign=0.5)
dateLabel.set_size_request(200, -1)
- w.attach(dateLabel, left_attach=0, right_attach=1,
- top_attach=offset, bottom_attach=offset + 1,
- xoptions=gtk.FILL, xpadding=20, yoptions=0)
+ w.attach(dateLabel, 0, offset, 1, 1)
- durLabel = gtk.Label(b)
+ durLabel = Gtk.Label(label=b)
durLabel.set_use_markup(True)
durLabel.set_alignment(xalign=0.0, yalign=0.5)
- w.attach(durLabel, left_attach=1, right_attach=2,
- top_attach=offset, bottom_attach=offset + 1,
- xoptions=gtk.FILL, yoptions=0)
+ w.attach(durLabel, 1, offset, 1, 1)
active_id = self.get_active_id()
for offset, i in enumerate(records):
t = calc_duration(i)
total += t
- add(inner_table, format_date(i), format_duration(t),
+ add(inner_grid, format_date(i), format_duration(t),
offset, i['id'] == active_id)
- add(outer_table, "<big><b>Total</b></big>",
+ add(outer_grid, "<big><b>Total</b></big>",
"<big><b>%s</b></big>" % format_duration(total), 1)
self.vbox = plugin_api.add_widget_to_taskeditor(vbox)
@@ -317,7 +313,7 @@
self.preferences)
def preference_dialog_init(self):
- self.builder = gtk.Builder()
+ self.builder = Gtk.Builder()
path = "%s/prefs.ui" % os.path.dirname(os.path.abspath(__file__))
self.builder.add_from_file(path)
self.preferences_dialog = self.builder.get_object("dialog1")
=== modified file 'GTG/plugins/hamster/prefs.ui'
--- GTG/plugins/hamster/prefs.ui 2012-05-23 08:55:31 +0000
+++ GTG/plugins/hamster/prefs.ui 2013-09-25 16:29:12 +0000
@@ -1,7 +1,6 @@
<?xml version="1.0"?>
<interface>
- <requires lib="gtk+" version="2.16"/>
- <!-- interface-naming-policy project-wide -->
+ <!-- interface-requires gtk+ 3.0 -->
<object class="GtkDialog" id="dialog1">
<property name="border_width">5</property>
<property name="title" translatable="yes">Hamster Preferences</property>
@@ -9,12 +8,12 @@
<property name="has_separator">False</property>
<signal name="delete_event" handler="prefs_close"/>
<child internal-child="vbox">
- <object class="GtkVBox" id="dialog-vbox1">
+ <object class="GtkBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
- <object class="GtkVBox" id="vbox1">
+ <object class="GtkBox" id="vbox1">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
@@ -243,7 +242,7 @@
</packing>
</child>
<child internal-child="action_area">
- <object class="GtkHButtonBox" id="dialog-action_area1">
+ <object class="GtkButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">end</property>
<child>
=== modified file 'GTG/plugins/not_today/not_today.py'
--- GTG/plugins/not_today/not_today.py 2013-02-25 08:29:31 +0000
+++ GTG/plugins/not_today/not_today.py 2013-09-25 16:29:12 +0000
@@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
-import gtk
+from gi.repository import Gtk
from GTG.tools.dates import Date
from GTG import _
@@ -52,7 +52,7 @@
def _init_gtk(self):
""" Initialize all the GTK widgets """
- self.tb_button = gtk.ToolButton()
+ self.tb_button = Gtk.ToolButton()
self.tb_button.set_sensitive(False)
self.tb_button.set_icon_name("document-revert")
self.tb_button.set_is_important(True)
=== modified file 'GTG/plugins/notification_area/notification_area.py'
--- GTG/plugins/notification_area/notification_area.py 2013-02-25 08:12:02 +0000
+++ GTG/plugins/notification_area/notification_area.py 2013-09-25 16:29:12 +0000
@@ -17,9 +17,9 @@
# this program. If not, see <http://www.gnu.org/licenses/>.
import os
-import gtk
+from gi.repository import Gtk
try:
- import appindicator
+ from gi.repository import AppIndicator3 as appindicator
except:
pass
@@ -82,9 +82,9 @@
self._indicator.set_menu(menu)
self._indicator.set_status(appindicator.STATUS_ACTIVE)
else:
- self._icon = gtk.StatusIcon()
+ self._icon = Gtk.StatusIcon()
self._icon.set_from_icon_name(self.NORMAL_ICON)
- self._icon.set_tooltip("Getting Things GNOME!")
+ self._icon.set_tooltip_text("Getting Things GNOME!")
self._icon.set_visible(True)
self._icon.connect('activate', leftbtn_callback)
self._icon.connect('popup-menu', self._on_icon_popup)
@@ -127,7 +127,7 @@
def _on_icon_popup(self, icon, button, timestamp):
""" Show the menu on right click on the icon """
if not self._indicator:
- self._menu.popup(None, None, gtk.status_icon_position_menu,
+ self._menu.popup(None, None, Gtk.status_icon_position_menu,
button, timestamp, icon)
@@ -220,7 +220,7 @@
self.__requester = plugin_api.get_requester()
# Tasks_in_menu will hold the menu_items in the menu, to quickly access
# them given the task id. Contains tuple of this format:
- # (title, key, gtk.MenuItem)
+ # (title, key, Gtk.MenuItem)
self.__init_gtk()
# We load preferences before connecting to tree
@@ -273,28 +273,29 @@
## Helper methods #############################################################
def __init_gtk(self):
- menu = gtk.Menu()
+ menu = Gtk.Menu()
# add "new task"
- menuItem = gtk.MenuItem(_('Add _New Task'))
+ # FIXME test this label... is it needed? play with it a little
+ menuItem = Gtk.MenuItem(label=_('Add _New Task'))
menuItem.connect('activate', self.__open_task)
menu.append(menuItem)
# Show Main Window
- show_browser = gtk.MenuItem(_('_Show Main Window'))
+ show_browser = Gtk.MenuItem(label=_('_Show Main Window'))
show_browser.connect('activate', self.__show_browser)
menu.append(show_browser)
# separator (it's intended to be after show_all)
# separator should be shown only when having tasks
- self.__task_separator = gtk.SeparatorMenuItem()
+ self.__task_separator = Gtk.SeparatorMenuItem()
menu.append(self.__task_separator)
menu_top_length = len(menu)
- menu.append(gtk.SeparatorMenuItem())
+ menu.append(Gtk.SeparatorMenuItem())
# quit item
- menuItem = gtk.MenuItem(_('_Quit'))
+ menuItem = Gtk.MenuItem(label=_('_Quit'))
menuItem.connect('activate', self.__view_manager.close_browser)
menu.append(menuItem)
@@ -360,7 +361,9 @@
title = self.__create_short_title(task.get_title())
# creating the menu item
- menu_item = gtk.MenuItem(title, False)
+ # FIXME test for regression: create a task like Hello_world
+ # (_ might be converted)
+ menu_item = Gtk.MenuItem(label=title)
menu_item.connect('activate', self.__open_task, tid)
self.__tasks_menu.add(tid, (task.get_due_date(), title), menu_item)
@@ -401,7 +404,7 @@
return True
def preference_dialog_init(self):
- self.builder = gtk.Builder()
+ self.builder = Gtk.Builder()
self.builder.add_from_file(os.path.join(
os.path.dirname(os.path.abspath(__file__)),
"notification_area.ui"))
=== modified file 'GTG/plugins/notification_area/notification_area.ui'
--- GTG/plugins/notification_area/notification_area.ui 2012-07-18 12:09:41 +0000
+++ GTG/plugins/notification_area/notification_area.ui 2013-09-25 16:29:12 +0000
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <requires lib="gtk+" version="2.16"/>
- <!-- interface-naming-policy toplevel-contextual -->
+ <!-- interface-requires gtk+ 3.0 -->
<object class="GtkAccelGroup" id="accelgroup1"/>
<object class="GtkAdjustment" id="adjustment_dangerzone">
<property name="upper">100</property>
@@ -15,9 +14,10 @@
<property name="type_hint">dialog</property>
<signal name="delete-event" handler="on_preferences_dialog_delete_event" swapped="no"/>
<child>
- <object class="GtkVBox" id="vbox1">
+ <object class="GtkBox" id="vbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
@@ -32,9 +32,10 @@
</packing>
</child>
<child>
- <object class="GtkVBox" id="vbox2">
+ <object class="GtkBox" id="vbox2">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
<child>
<object class="GtkCheckButton" id="pref_chbox_minimized">
<property name="label" translatable="yes">Start gtg minimized</property>
@@ -60,7 +61,7 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox2">
+ <object class="GtkBox" id="box2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
@@ -107,7 +108,7 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox1">
+ <object class="GtkBox" id="box1">
<property name="height_request">30</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
=== modified file 'GTG/plugins/send_email/sendEmail.py'
--- GTG/plugins/send_email/sendEmail.py 2013-02-25 07:35:07 +0000
+++ GTG/plugins/send_email/sendEmail.py 2013-09-25 16:29:12 +0000
@@ -19,9 +19,9 @@
- Added support for tags and subtasks. (Thibault Févry)
"""
-import gio
-import gtk
-import urllib
+from gi.repository import Gio
+from gi.repository import Gtk
+import urllib.request, urllib.parse, urllib.error
from GTG import _
@@ -37,10 +37,10 @@
"""
self.plugin_api = plugin_api
# add a item (button) to the ToolBar
- tb_Taskicon = gtk.Image()
+ tb_Taskicon = Gtk.Image()
tb_Taskicon.set_from_icon_name('mail-send', 32)
- self.tb_Taskbutton = gtk.ToolButton(tb_Taskicon)
+ self.tb_Taskbutton = Gtk.ToolButton(tb_Taskicon)
self.tb_Taskbutton.set_label(_("Send via email"))
self.tb_Taskbutton.connect('clicked', self.onTbTaskButton, plugin_api)
self.tb_Taskbutton.show_all()
@@ -74,8 +74,8 @@
# Title contains the title and the start and due dates.
title = _("Task: %(task_title)s") % {'task_title': task.get_title()}
- parameters = urllib.urlencode({'subject': title, 'body': body})
+ parameters = urllib.parse.urlencode({'subject': title, 'body': body})
parameters = parameters.replace('+', '%20')
- gio.app_info_get_default_for_uri_scheme('mailto').launch_uris(
+ Gio.app_info_get_default_for_uri_scheme('mailto').launch_uris(
['mailto:' + 'gtg@xxxxxxxxxxx?' + parameters])
=== modified file 'GTG/plugins/task_reaper/reaper.py'
--- GTG/plugins/task_reaper/reaper.py 2013-02-25 08:29:31 +0000
+++ GTG/plugins/task_reaper/reaper.py 2013-09-25 16:29:12 +0000
@@ -13,19 +13,9 @@
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
-import sys
import os
-try:
- import pygtk
- pygtk.require("2.0")
-except:
- sys.exit(1)
-
-try:
- import gtk
-except:
- sys.exit(1)
+from gi.repository import Gtk
from threading import Timer
@@ -48,7 +38,7 @@
def __init__(self):
self.path = os.path.dirname(os.path.abspath(__file__))
# GUI initialization
- self.builder = gtk.Builder()
+ self.builder = Gtk.Builder()
self.builder.add_from_file(os.path.join(
os.path.dirname(os.path.abspath(__file__)) +
"/reaper.ui"))
@@ -68,7 +58,7 @@
self.on_preferences_ok,
}
self.builder.connect_signals(SIGNAL_CONNECTIONS_DIC)
- self.menu_item = gtk.MenuItem("Delete old closed tasks")
+ self.menu_item = Gtk.MenuItem("Delete old closed tasks")
self.menu_item.connect('activate', self.delete_old_closed_tasks)
def activate(self, plugin_api):
=== modified file 'GTG/plugins/task_reaper/reaper.ui'
--- GTG/plugins/task_reaper/reaper.ui 2012-05-23 08:55:31 +0000
+++ GTG/plugins/task_reaper/reaper.ui 2013-09-25 16:29:12 +0000
@@ -1,7 +1,6 @@
<?xml version="1.0"?>
<interface>
- <requires lib="gtk+" version="2.16"/>
- <!-- interface-naming-policy toplevel-contextual -->
+ <!-- interface-requires gtk+ 3.0 -->
<object class="GtkAccelGroup" id="accelgroup1"/>
<object class="GtkWindow" id="preferences_dialog">
<property name="border_width">10</property>
@@ -9,16 +8,16 @@
<property name="type_hint">dialog</property>
<signal name="delete_event" handler="on_preferences_dialog_delete_event"/>
<child>
- <object class="GtkVBox" id="vbox1">
+ <object class="GtkBox" id="vbox1">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
- <object class="GtkVBox" id="vbox2">
+ <object class="GtkBox" id="vbox2">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
- <object class="GtkHBox" id="hbox2">
+ <object class="GtkBox" id="box2">
<property name="visible">True</property>
<child>
<object class="GtkLabel" id="label2">
@@ -91,7 +90,7 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox1">
+ <object class="GtkBox" id="box1">
<property name="height_request">30</property>
<property name="visible">True</property>
<property name="spacing">50</property>
=== modified file 'GTG/plugins/tomboy/combobox_enhanced.py'
--- GTG/plugins/tomboy/combobox_enhanced.py 2013-02-25 07:35:07 +0000
+++ GTG/plugins/tomboy/combobox_enhanced.py 2013-09-25 16:29:12 +0000
@@ -15,17 +15,17 @@
# this program. If not, see <http://www.gnu.org/licenses/>.
-# TODO: put this in a class extending gtk.Combobox and place the file in
+# TODO: put this in a class extending Gtk.Combobox and place the file in
# GTG.tools
-import gtk
-import gobject
+from gi.repository import Gtk, Gdk
+from gi.repository import GObject
def ifKeyPressedCallback(widget, key, callback):
def keyPress(combobox, event):
- keyname = gtk.gdk.keyval_name(event.keyval)
+ keyname = Gdk.keyval_name(event.keyval)
if keyname == key:
callback()
widget.connect("key-press-event", keyPress)
@@ -34,13 +34,13 @@
def ifClipboardTextIsInListCallback(clipboard_obj, list_obj, callback):
def clipboardCallback(clipboard_obj, text, list_obj):
- if len(filter(lambda x: x == text, list_obj)) != 0:
+ if len([x for x in list_obj if x == text]) != 0:
callback(text)
clipboard_obj.request_text(clipboardCallback, list_obj)
def listStoreFromList(list_obj):
- list_store = gtk.ListStore(gobject.TYPE_STRING)
+ list_store = Gtk.ListStore(GObject.TYPE_STRING)
for elem in list_obj:
iter = list_store.append()
list_store.set(iter, 0, elem)
@@ -48,7 +48,7 @@
def completionFromListStore(list_store):
- completion = gtk.EntryCompletion()
+ completion = Gtk.EntryCompletion()
completion.set_minimum_key_length(0)
completion.set_text_column(0)
completion.set_inline_completion(True)
@@ -57,9 +57,9 @@
def smartifyComboboxEntry(combobox, list_obj, callback):
- entry = gtk.Entry()
+ entry = Gtk.Entry()
# check if Clipboard contains an element of the list
- clipboard = gtk.Clipboard()
+ clipboard = Gtk.Clipboard()
ifClipboardTextIsInListCallback(clipboard, list_obj, entry.set_text)
# pressing Enter will cause the callback
ifKeyPressedCallback(entry, "Return", callback)
@@ -76,7 +76,7 @@
combobox.add(entry)
combobox.connect('changed', setText, entry)
# render the combo-box drop down menu
- cell = gtk.CellRendererText()
+ cell = Gtk.CellRendererText()
combobox.pack_start(cell, True)
combobox.add_attribute(cell, 'text', 0)
return entry
=== modified file 'GTG/plugins/tomboy/tomboy.py'
--- GTG/plugins/tomboy/tomboy.py 2013-04-28 08:37:38 +0000
+++ GTG/plugins/tomboy/tomboy.py 2013-09-25 16:29:12 +0000
@@ -16,15 +16,8 @@
import dbus
import os
-import sys
-
-try:
- import pygtk
- pygtk.require("2.0")
-except:
- sys.exit(1)
-
-import gtk
+
+from gi.repository import Gtk, Gdk, GdkPixbuf
from GTG import _
from GTG.plugins.tomboy.combobox_enhanced import smartifyComboboxEntry
@@ -58,7 +51,7 @@
# Function called upon plug-in activation
def activate(self, plugin_api):
- self.builder = gtk.Builder()
+ self.builder = Gtk.Builder()
# Returns true is Tomboy/Gnote is present, otherwise shows a dialog
#(only once) and returns False
@@ -67,13 +60,13 @@
self.activated = self.findTomboyIconPath()
# The notification to disable the plug-in to the user will be
# showed only once
- dialog_destroy_with_parent = gtk.DIALOG_DESTROY_WITH_PARENT
+ DIALOG_DESTROY_WITH_PARENT = Gtk.DialogFlags.DESTROY_WITH_PARENT
if not self.activated:
- dialog = gtk.MessageDialog(parent=self.plugin_api.get_ui().
+ dialog = Gtk.MessageDialog(parent=self.plugin_api.get_ui().
get_window(),
- flags=dialog_destroy_with_parent,
- type=gtk.MESSAGE_ERROR,
- buttons=gtk.BUTTONS_OK,
+ flags=DIALOG_DESTROY_WITH_PARENT,
+ type=Gtk.MessageType.ERROR,
+ buttons=Gtk.ButtonsType.OK,
message_format=_("Tomboy/Gnote "
"not found. Please install it or "
"disable the Tomboy/Gnote plugin"
@@ -112,12 +105,12 @@
def addButtonToToolbar(self, plugin_api):
if not self.checkTomboyPresent():
return
- tb_Taskbutton_image = gtk.Image()
+ tb_Taskbutton_image = Gtk.Image()
tb_Taskbutton_image_path = self.tomboy_icon_path
- tb_Taskbutton_pixbuf = gtk.gdk.\
- pixbuf_new_from_file_at_size(tb_Taskbutton_image_path, 16, 16)
+ tb_Taskbutton_pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(
+ tb_Taskbutton_image_path, 16, 16)
tb_Taskbutton_image.set_from_pixbuf(tb_Taskbutton_pixbuf)
- self.tb_Taskbutton = gtk.ToolButton(tb_Taskbutton_image)
+ self.tb_Taskbutton = Gtk.ToolButton(tb_Taskbutton_image)
self.tb_Taskbutton.set_label(_("Add Tomboy note"))
self.tb_Taskbutton.connect('clicked', self.onTbTaskButton,
self.plugin_api)
@@ -129,7 +122,7 @@
self.anchors = []
start_iter = self.textview.buff.get_start_iter()
end_iter = self.textview.buff.get_end_iter()
- text = self.textview.buff.get_slice(start_iter, end_iter)
+ text = self.textview.buff.get_slice(start_iter, end_iter, True)
text_offset = 0
token_position = text.find(self.token_start)
token_ending = text.find(self.token_end, token_position)
@@ -184,13 +177,13 @@
obj = bus.get_object("org.gnome.Tomboy",
"/org/gnome/Tomboy/RemoteControl")
except dbus.DBusException:
- DIALOG_DESTROY_WITH_PARENT = gtk.DIALOG_DESTROY_WITH_PARENT
+ DIALOG_DESTROY_WITH_PARENT = Gtk.DialogFlags.DESTROY_WITH_PARENT
if not hasattr(self, "disable_flag"):
- dialog = gtk.MessageDialog(parent=self.plugin_api.get_ui().
+ dialog = Gtk.MessageDialog(parent=self.plugin_api.get_ui().
get_window(),
flags=DIALOG_DESTROY_WITH_PARENT,
- type=gtk.MESSAGE_ERROR,
- buttons=gtk.BUTTONS_OK,
+ type=Gtk.MessageType.ERROR,
+ buttons=Gtk.ButtonsType.OK,
message_format=_("%s seems to be "
"installed on your system, but it "
"does not provide a DBus interface"
@@ -208,8 +201,7 @@
tomboy = self.getTomboyObject()
if tomboy is None:
return None
- return map(lambda note: str(tomboy.GetNoteTitle(note)),
- tomboy.ListAllNotes())
+ return [str(tomboy.GetNoteTitle(note)) for note in tomboy.ListAllNotes()]
def onTbTaskButton(self, widget, plugin_api):
title_list = self.getTomboyNoteTitleList()
@@ -238,18 +230,18 @@
if tomboy is None:
return
supposed_title = self.combobox_entry.get_text()
- if filter(lambda x: tomboy.GetNoteTitle(x) == supposed_title,
- tomboy.ListAllNotes()) == []:
+ if [x for x in tomboy.ListAllNotes() if tomboy.GetNoteTitle(x) == supposed_title] == []:
self.label_caption.set_text(_("That note does not exist!"))
- dialog = gtk.MessageDialog(parent=self.dialog,
- flags=gtk.DIALOG_DESTROY_WITH_PARENT,
- type=gtk.MESSAGE_QUESTION,
- buttons=gtk.BUTTONS_YES_NO,
+ DIALOG_DESTROY_WITH_PARENT = Gtk.DialogFlags.DESTROY_WITH_PARENT
+ dialog = Gtk.MessageDialog(parent=self.dialog,
+ flags=DIALOG_DESTROY_WITH_PARENT,
+ type=Gtk.MessageType.QUESTION,
+ buttons=Gtk.ButtonsType.YES_NO,
message_format=_("That note does not \
exist. Do you want to create a new one?"))
response = dialog.run()
dialog.destroy()
- if response == gtk.RESPONSE_YES:
+ if response == Gtk.ResponseType.YES:
tomboy.CreateNamedNote(supposed_title)
else:
return
@@ -268,17 +260,18 @@
return
note = tomboy.FindNote(widget.tomboy_note_title)
if str(note) == "":
- dialog = gtk.MessageDialog(parent=self.
- plugin_api.get_ui().get_window(),
- flags=gtk.DIALOG_DESTROY_WITH_PARENT,
- type=gtk.MESSAGE_WARNING,
- buttons=gtk.BUTTONS_YES_NO,
+ DIALOG_DESTROY_WITH_PARENT = Gtk.DialogFlags.DESTROY_WITH_PARENT
+ dialog = Gtk.MessageDialog(parent=self.plugin_api.get_ui().
+ get_window(),
+ flags=DIALOG_DESTROY_WITH_PARENT,
+ type=Gtk.MessageType.WARNING,
+ buttons=Gtk.ButtonsType.YES_NO,
message_format=(_("This Tomboy note \
does not exist anymore. Do you want to\
create it?")))
response = dialog.run()
dialog.destroy()
- if response == gtk.RESPONSE_YES:
+ if response == Gtk.ResponseType.YES:
tomboy.CreateNamedNote(widget.tomboy_note_title)
tomboy.DisplayNote(note)
else:
@@ -293,49 +286,48 @@
# creates the tomboy widget
def widgetCreate(self, tomboy_note_title):
- image = gtk.Image()
+ image = Gtk.Image()
window = self.plugin_api.get_ui().get_window()
window.realize()
- window_style = window.get_style()
- pixbuf = gtk.gdk.\
- pixbuf_new_from_file_at_size(self.tomboy_icon_path, 16, 16)
+ pixbuf = Gdk.pixbuf_new_from_file_at_size(
+ self.tomboy_icon_path, 16, 16)
image.show()
image.set_from_pixbuf(pixbuf)
image.set_alignment(0.5, 1.0)
- label = gtk.Label()
- color = str(window_style.text[gtk.STATE_PRELIGHT])
+ label = Gtk.Label()
+ window_style = window.get_style_context()
+ color = window_style.get_color(
+ Gtk.StateType.PRELIGHT).to_color().to_string()
title = tomboy_note_title
label.set_markup("<span underline='low' color='%s'>%s</span>" % (color,
title)
)
label.show()
label.set_alignment(0.5, 1.0)
- eventbox = gtk.EventBox()
- eventbox.set_events(gtk.gdk.BUTTON_PRESS_MASK)
+ eventbox = Gtk.EventBox()
+ eventbox.set_events(Gdk.EventMask.BUTTON_PRESS_MASK)
eventbox.connect('button_press_event', self.tomboyDisplayNote)
- hbox = gtk.HBox()
- hbox.show()
- hbox.add(image)
- hbox.add(label)
- eventbox.add(hbox)
- # the eventbox should follow the colours of the textview to blend in
- # properly
- textview_style = self.textview.get_style()
- eventbox_style = eventbox.get_style().copy()
- for state in (gtk.STATE_NORMAL, gtk.STATE_PRELIGHT, gtk.STATE_ACTIVE,
- gtk.STATE_SELECTED, gtk.STATE_INSENSITIVE):
- eventbox_style.base[state] = textview_style.base[state]
- eventbox_style.bg[state] = textview_style.bg[state]
- eventbox_style.fg[state] = textview_style.fg[state]
- eventbox_style.text[state] = textview_style.text[state]
- eventbox_style.bg[gtk.STATE_NORMAL] = \
- textview_style.base[gtk.STATE_NORMAL]
- eventbox.set_style(eventbox_style)
+ box = Gtk.Box()
+ box.show()
+ box.add(image)
+ box.add(label)
+ eventbox.add(box)
+ #the eventbox should follow the colours of the textview to blend in
+ #properly
+ textview_style = self.textview.get_style_context()
+ for state in (Gtk.StateType.NORMAL, Gtk.StateType.PRELIGHT,
+ Gtk.StateType.ACTIVE, Gtk.StateType.SELECTED,
+ Gtk.StateType.INSENSITIVE):
+ fg_color = textview_style.get_color(state)
+ eventbox.override_color(state, fg_color)
+
+ bg_color = textview_style.get_background_color(state)
+ eventbox.override_background_color(state, bg_color)
eventbox.show()
eventbox.tomboy_note_title = tomboy_note_title
# cursor changes to a hand
def realize_callback(widget):
- eventbox.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.HAND2))
+ eventbox.window.set_cursor(Gdk.Cursor.new(Gdk.HAND2))
eventbox.connect("realize", realize_callback)
return eventbox
=== modified file 'GTG/plugins/tomboy/tomboy.ui'
--- GTG/plugins/tomboy/tomboy.ui 2012-05-23 08:55:31 +0000
+++ GTG/plugins/tomboy/tomboy.ui 2013-09-25 16:29:12 +0000
@@ -1,15 +1,15 @@
<?xml version="1.0"?>
<interface>
- <!-- interface-requires gtk+ 2.12 -->
- <!-- interface-naming-policy toplevel-contextual -->
+ <!-- interface-requires gtk+ 3.0 -->
<object class="GtkDialog" id="InsertNoteDialog">
<property name="width_request">300</property>
<property name="title" translatable="yes">Insert Note</property>
<property name="type_hint">dialog</property>
<signal name="close" handler="on_InsertNoteDialog_close"/>
<child internal-child="vbox">
- <object class="GtkVBox" id="dialog-vbox1">
+ <object class="GtkBox" id="dialog-vbox1">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="label_caption">
<property name="visible">True</property>
@@ -30,7 +30,7 @@
</packing>
</child>
<child internal-child="action_area">
- <object class="GtkHButtonBox" id="dialog-action_area1">
+ <object class="GtkButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">end</property>
<child>
=== modified file 'GTG/plugins/untouched_tasks/untouchedTasks.py'
--- GTG/plugins/untouched_tasks/untouchedTasks.py 2013-02-25 08:12:02 +0000
+++ GTG/plugins/untouched_tasks/untouchedTasks.py 2013-09-25 16:29:12 +0000
@@ -14,15 +14,13 @@
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
+from threading import Timer
+import datetime
import os
-import gtk
-import datetime
+
+from gi.repository import Gtk
from GTG.tools.logger import Log
-from threading import Timer
-
-
-###################################
class pluginUntouchedTasks:
@@ -40,7 +38,7 @@
def __init__(self):
self.path = os.path.dirname(os.path.abspath(__file__))
# GUI initialization
- self.builder = gtk.Builder()
+ self.builder = Gtk.Builder()
self.builder.add_from_file(os.path.join(
os.path.dirname(os.path.abspath(__file__)) +
"/untouchedTasks.ui"))
@@ -60,7 +58,7 @@
self.on_preferences_ok,
}
self.builder.connect_signals(SIGNAL_CONNECTIONS_DIC)
- self.menu_item = gtk.MenuItem("Add @untouched tag")
+ self.menu_item = Gtk.MenuItem("Add @untouched tag")
self.menu_item.connect('activate', self.add_untouched_tag)
def activate(self, plugin_api):
=== modified file 'GTG/plugins/untouched_tasks/untouchedTasks.ui'
--- GTG/plugins/untouched_tasks/untouchedTasks.ui 2012-12-12 23:14:43 +0000
+++ GTG/plugins/untouched_tasks/untouchedTasks.ui 2013-09-25 16:29:12 +0000
@@ -1,24 +1,22 @@
<?xml version="1.0"?>
<interface>
- <requires lib="gtk+" version="2.16"/>
- <!-- interface-naming-policy toplevel-contextual -->
- <object class="GtkAccelGroup" id="accelgroup1"/>
+ <!-- interface-requires gtk+ 3.0 -->
<object class="GtkWindow" id="preferences_dialog">
<property name="border_width">10</property>
<property name="window_position">center-on-parent</property>
<property name="type_hint">dialog</property>
<signal name="delete_event" handler="on_preferences_dialog_delete_event"/>
<child>
- <object class="GtkVBox" id="vbox1">
+ <object class="GtkBox" id="vbox1">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
- <object class="GtkVBox" id="vbox2">
+ <object class="GtkBox" id="vbox2">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
- <object class="GtkHBox" id="hbox2">
+ <object class="GtkBox" id="box2">
<property name="visible">True</property>
<child>
<object class="GtkLabel" id="label2">
@@ -92,19 +90,6 @@
<property name="position">1</property>
</packing>
</child>
- <!--<child>
- <object class="GtkCheckButton" id="pref_chbox_show_menu_item">
- <property name="label" translatable="yes">Add the "Plugins > Add @untouched plugin" menu item</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="image_position">top</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="position">2</property>
- </packing>
- </child>-->
</object>
<packing>
<property name="padding">21</property>
@@ -112,7 +97,7 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox1">
+ <object class="GtkBox" id="box1">
<property name="height_request">30</property>
<property name="visible">True</property>
<property name="spacing">50</property>
=== modified file 'GTG/plugins/urgency_color/preferences.ui'
--- GTG/plugins/urgency_color/preferences.ui 2012-05-23 08:55:31 +0000
+++ GTG/plugins/urgency_color/preferences.ui 2013-09-25 16:29:12 +0000
@@ -12,9 +12,10 @@
<property name="type_hint">dialog</property>
<signal name="delete-event" handler="on_prefs_window_delete_event" swapped="no"/>
<child>
- <object class="GtkVBox" id="vbox_main">
+ <object class="GtkBox" id="vbox_main">
<property name="can_focus">False</property>
<property name="spacing">2</property>
+ <property name="orientation">vertical</property>
<child>
<object class="GtkFrame" id="frame_reddays">
<property name="visible">True</property>
@@ -29,7 +30,7 @@
<property name="bottom_padding">5</property>
<property name="left_padding">12</property>
<child>
- <object class="GtkHBox" id="hbox_reddays">
+ <object class="GtkBox" id="box_reddays">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
@@ -106,12 +107,13 @@
<property name="bottom_padding">5</property>
<property name="left_padding">12</property>
<child>
- <object class="GtkVBox" id="vbox_colors">
+ <object class="GtkBox" id="vbox_colors">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">5</property>
+ <property name="orientation">vertical</property>
<child>
- <object class="GtkHBox" id="hbox_colors_overdue">
+ <object class="GtkBox" id="box_colors_overdue">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
@@ -149,7 +151,7 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox_colors_high">
+ <object class="GtkBox" id="box_colors_high">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
@@ -187,7 +189,7 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox_colors_normal">
+ <object class="GtkBox" id="box_colors_normal">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
@@ -225,7 +227,7 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox_colors_low">
+ <object class="GtkBox" id="box_colors_low">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
@@ -287,7 +289,7 @@
<property name="can_focus">False</property>
<property name="top_padding">5</property>
<child>
- <object class="GtkHButtonBox" id="hbuttonbox">
+ <object class="GtkButtonBox" id="hbuttonbox">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="homogeneous">True</property>
=== modified file 'GTG/plugins/urgency_color/urgency_color.py'
--- GTG/plugins/urgency_color/urgency_color.py 2013-02-25 08:12:02 +0000
+++ GTG/plugins/urgency_color/urgency_color.py 2013-09-25 16:29:12 +0000
@@ -15,7 +15,8 @@
# this program. If not, see <http://www.gnu.org/licenses/>.
from math import ceil
-import gtk
+from gi.repository import Gtk
+from gi.repository import Gdk
import os
from GTG.tools.dates import Date
@@ -60,17 +61,17 @@
return None
def _get_gradient_color(self, color1, color2, position):
- """This function returns a gtk.gdk.Color which corresponds to the
+ """This function returns a Gdk.Color which corresponds to the
position (a float value from 0 to 1) in the gradient formed by the
- colors color1 and color2, both of type gtk.gdk.Color"""
- color1 = gtk.gdk.color_parse(color1)
- color2 = gtk.gdk.color_parse(color2)
+ colors color1 and color2, both of type Gdk.Color"""
+ color1 = Gdk.color_parse(color1)
+ color2 = Gdk.color_parse(color2)
R1, G1, B1 = color1.red, color1.green, color1.blue
R2, G2, B2 = color2.red, color2.green, color2.blue
R = R1 + (R2 - R1) * position
G = G1 + (G2 - G1) * position
B = B1 + (B2 - B1) * position
- return gtk.gdk.Color(int(R), int(G), int(B))
+ return Gdk.Color(int(R), int(G), int(B))
def get_node_bgcolor(self, node):
""" This method checks the urgency of a node (task) and returns its
@@ -197,7 +198,7 @@
pass
def prefs_init(self):
- self.builder = gtk.Builder()
+ self.builder = Gtk.Builder()
self.builder.add_from_file(os.path.join(
os.path.dirname(os.path.abspath(__file__)),
'preferences.ui'))
@@ -259,16 +260,16 @@
self.spinbutton_reddays.set_value(self._pref_data['reddays'])
# Colorbutton - OVERDUE
self.colorbutton_overdue.set_color(
- gtk.gdk.color_parse(self._pref_data['color_overdue']))
+ Gdk.color_parse(self._pref_data['color_overdue']))
# Colorbutton - HIGH
self.colorbutton_high.set_color(
- gtk.gdk.color_parse(self._pref_data['color_high']))
+ Gdk.color_parse(self._pref_data['color_high']))
# Colorbutton - NORMAL
self.colorbutton_normal.set_color(
- gtk.gdk.color_parse(self._pref_data['color_normal']))
+ Gdk.color_parse(self._pref_data['color_normal']))
# Colorbutton - LOW
self.colorbutton_low.set_color(
- gtk.gdk.color_parse(self._pref_data['color_low']))
+ Gdk.color_parse(self._pref_data['color_low']))
def on_prefs_cancel(self, widget=None, data=None):
self.prefs_update_widgets()
@@ -296,7 +297,7 @@
# distant future, when nobody has "red", "yellow" or "green"
# settings
namepairs = {'red': 'high', 'yellow': 'normal', 'green': 'low'}
- for oldname, newname in namepairs.iteritems():
+ for oldname, newname in namepairs.items():
old_key, new_key = "color_" + oldname, "color_" + newname
if old_key in self._pref_data:
self._pref_data[new_key] = self._pref_data.pop(old_key)
=== modified file 'GTG/tests/__init__.py'
--- GTG/tests/__init__.py 2013-02-25 07:35:07 +0000
+++ GTG/tests/__init__.py 2013-09-25 16:29:12 +0000
@@ -33,8 +33,7 @@
'''
# find all the test files
test_dir = os.path.dirname(__file__)
- test_files = filter(lambda f: f.endswith(".py") and f.startswith("test_"),
- os.listdir(test_dir))
+ test_files = [f for f in os.listdir(test_dir) if f.endswith(".py") and f.startswith("test_")]
# Loading of the test files and adding to the TestSuite
test_suite = unittest.TestSuite()
=== modified file 'GTG/tests/signals_testing.py'
--- GTG/tests/signals_testing.py 2013-02-25 07:35:07 +0000
+++ GTG/tests/signals_testing.py 2013-09-25 16:29:12 +0000
@@ -18,7 +18,7 @@
# -----------------------------------------------------------------------------
import threading
-import gobject
+from gi.repository import GObject
import time
from GTG.tools.watchdog import Watchdog
@@ -46,7 +46,7 @@
# then we notify the error
# if the error_code is set to None, we're expecting it to fail.
if error_code is not None:
- print "An expected signal wasn't received %s" % str(error_code)
+ print("An expected signal wasn't received %s" % str(error_code))
self.unittest.assertFalse(should_be_caught)
self.watchdog = Watchdog(3, _on_failure)
@@ -93,7 +93,7 @@
# then we notify the error
# if the error_code is set to None, we're expecting it to fail.
if error_code is not None:
- print "An expected signal wasn't received %s" % str(error_code)
+ print("An expected signal wasn't received %s" % str(error_code))
self.unittest.assertFalse(should_be_caught)
self.watchdog = Watchdog(3, _on_failure)
@@ -131,8 +131,8 @@
"""
def gobject_main_loop():
- gobject.threads_init()
- self.main_loop = gobject.MainLoop()
+ GObject.threads_init()
+ self.main_loop = GObject.MainLoop()
self.main_loop.run()
threading.Thread(target=gobject_main_loop).start()
=== modified file 'GTG/tests/test_backend_tomboy.py'
--- GTG/tests/test_backend_tomboy.py 2013-02-25 08:12:02 +0000
+++ GTG/tests/test_backend_tomboy.py 2013-09-25 16:29:12 +0000
@@ -25,7 +25,7 @@
import dbus.glib
import dbus.service
import errno
-import gobject
+from gi.repository import GObject
import math
import os
import random
@@ -91,7 +91,7 @@
try:
fd = os.open(lockfile_path,
os.O_CREAT | os.O_EXCL | os.O_RDWR)
- except OSError, e:
+ except OSError as e:
if e.errno != errno.EEXIST:
raise
time.sleep(0.3)
@@ -264,7 +264,7 @@
def TEST_multiple_task_same_title(self):
self.backend.set_attached_tags(['@a'])
how_many_tasks = int(math.ceil(20 * random.random()))
- for iteration in xrange(0, how_many_tasks):
+ for iteration in range(0, how_many_tasks):
task = self.datastore.requester.new_task()
task.set_title("title")
task.add_tag('@a')
@@ -372,9 +372,9 @@
self.notes[note]['changed'] = time.mktime(datetime.now().timetuple())
def fake_main_loop(self):
- gobject.threads_init()
+ GObject.threads_init()
dbus.glib.init_threads()
- self.main_loop = gobject.MainLoop()
+ self.main_loop = GObject.MainLoop()
self.main_loop.run()
@dbus.service.method(BUS_INTERFACE)
=== modified file 'GTG/tests/test_bidict.py'
--- GTG/tests/test_bidict.py 2012-11-25 19:19:44 +0000
+++ GTG/tests/test_bidict.py 2013-09-25 16:29:12 +0000
@@ -30,7 +30,7 @@
def test_add_and_gets(self):
""" Test for the __init__, _get_by_first, _get_by_second function """
- pairs = [(uuid.uuid4(), uuid.uuid4()) for a in xrange(10)]
+ pairs = [(uuid.uuid4(), uuid.uuid4()) for a in range(10)]
bidict = BiDict(*pairs)
for pair in pairs:
self.assertEqual(bidict._get_by_first(pair[0]), pair[1])
=== modified file 'GTG/tests/test_datastore.py'
--- GTG/tests/test_datastore.py 2013-02-25 07:35:07 +0000
+++ GTG/tests/test_datastore.py 2013-09-25 16:29:12 +0000
@@ -23,7 +23,7 @@
import uuid
import time
from random import randint
-import gobject
+from gi.repository import GObject
import GTG
from GTG.core.datastore import DataStore
@@ -33,11 +33,11 @@
def sleep_within_loop(duration):
- main_loop = gobject.MainLoop()
- gobject.timeout_add(duration * 1000, main_loop.quit)
+ main_loop = GObject.MainLoop()
+ GObject.timeout_add(duration * 1000, main_loop.quit)
# NOTE: I am not sure why, but I need add this
# dumb thing to run _process method of LibLarch
- gobject.idle_add(lambda: True)
+ GObject.idle_add(lambda: True)
main_loop.run()
@@ -77,7 +77,7 @@
def test_get_all_tasks(self):
""" Tests the get_all_tasks function """
task_ids = []
- for i in xrange(1, 10):
+ for i in range(1, 10):
task = self.datastore.new_task()
task_ids.append(task.get_id())
return_list = self.datastore.get_all_tasks()
@@ -114,7 +114,7 @@
Tests the push_task function
'''
task_ids = []
- for i in xrange(1, 10):
+ for i in range(1, 10):
tid = str(uuid.uuid4())
if tid not in task_ids:
task_ids.append(tid)
@@ -138,7 +138,7 @@
# create a simple backend dictionary
backend = FakeBackend(enabled=True)
tasks_in_backend_count = randint(1, 20)
- for temp in xrange(0, tasks_in_backend_count):
+ for temp in range(0, tasks_in_backend_count):
backend.fake_add_random_task()
backend_dic = {'backend': backend, 'pid': 'a'}
self.datastore.register_backend(backend_dic)
@@ -157,7 +157,7 @@
# same test, disabled backend
backend = FakeBackend(enabled=False)
- for temp in xrange(1, randint(2, 20)):
+ for temp in range(1, randint(2, 20)):
backend.fake_add_random_task()
backend_dic = {'backend': backend, 'pid': 'b'}
self.datastore.register_backend(backend_dic)
@@ -244,7 +244,7 @@
'''
# we add some tasks in the datastore
tasks_in_datastore_count = 10 # randint(1, 20)
- for temp in xrange(0, tasks_in_datastore_count):
+ for temp in range(0, tasks_in_datastore_count):
self.datastore.new_task()
datastore_stored_tids = self.datastore.get_all_tasks()
self.assertEqual(tasks_in_datastore_count, len(datastore_stored_tids))
@@ -258,7 +258,7 @@
self.datastore.get_backend(backend.get_id()).sync()
# and we inject task in the backend
tasks_in_backend_count = 5 # randint(1, 20)
- for temp in xrange(0, tasks_in_backend_count):
+ for temp in range(0, tasks_in_backend_count):
backend.fake_add_random_task()
backend_stored_tids = backend.fake_get_task_ids()
self.assertEqual(tasks_in_backend_count, len(backend_stored_tids))
=== modified file 'GTG/tests/test_signal_testing.py'
--- GTG/tests/test_signal_testing.py 2013-02-25 07:35:07 +0000
+++ GTG/tests/test_signal_testing.py 2013-09-25 16:29:12 +0000
@@ -17,7 +17,7 @@
# this program. If not, see <http://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------------
-import gobject
+from gi.repository import GObject
import unittest
import uuid
@@ -46,14 +46,14 @@
self.assertEqual(arg, one_signal_arguments[0])
-class FakeGobject(gobject.GObject):
- __gsignals__ = {'one': (gobject.SIGNAL_RUN_FIRST,
- gobject.TYPE_NONE, (str, )),
- 'two': (gobject.SIGNAL_RUN_FIRST,
- gobject.TYPE_NONE, (str, ))}
+class FakeGobject(GObject.GObject):
+ __gsignals__ = {'one': (GObject.SignalFlags.RUN_FIRST,
+ None, (str, )),
+ 'two': (GObject.SignalFlags.RUN_FIRST,
+ None, (str, ))}
def emit_signal(self, signal_name, argument):
- gobject.idle_add(self.emit, signal_name, argument)
+ GObject.idle_add(self.emit, signal_name, argument)
def test_suite():
=== modified file 'GTG/tests/test_twokeydict.py'
--- GTG/tests/test_twokeydict.py 2013-02-25 07:35:07 +0000
+++ GTG/tests/test_twokeydict.py 2013-09-25 16:29:12 +0000
@@ -31,7 +31,7 @@
def test_add_and_gets(self):
""" Test for the __init__, _get_by_first, _get_by_second function """
triplets = [(uuid.uuid4(), uuid.uuid4(), uuid.uuid4())
- for a in xrange(10)]
+ for a in range(10)]
tw_dict = TwoKeyDict(*triplets)
for triplet in triplets:
self.assertEqual(tw_dict._get_by_primary(triplet[0]), triplet[2])
@@ -66,14 +66,14 @@
self.assertEqual(missing_second, 2)
# check for memory leaks
dict_len = 0
- for key in tw_dict._primary_to_value.iterkeys():
+ for key in tw_dict._primary_to_value.keys():
dict_len += 1
self.assertEqual(dict_len, 0)
def test_get_primary_and_secondary_key(self):
""" Test for fetching the objects stored in the TwoKeyDict """
triplets = [(uuid.uuid4(), uuid.uuid4(), uuid.uuid4())
- for a in xrange(10)]
+ for a in range(10)]
tw_dict = TwoKeyDict(*triplets)
for triplet in triplets:
self.assertEqual(tw_dict._get_secondary_key(triplet[0]),
=== modified file 'GTG/tests/tree_testing.py'
--- GTG/tests/tree_testing.py 2013-02-25 07:35:07 +0000
+++ GTG/tests/tree_testing.py 2013-09-25 16:29:12 +0000
@@ -65,7 +65,7 @@
raise Exception('%s is not a path of node %s' % (str(path), nid))
if REORDER_ON_DELETE:
index = path[-1:]
- print "reorder on delete not yet implemented"
+ print("reorder on delete not yet implemented")
self.nodes[nid].remove(path)
if len(self.nodes[nid]) == 0:
self.nodes.pop(nid)
@@ -105,13 +105,13 @@
old_path = path
if check_prefix(path) and len(path_prefix) > 1:
new_path = list(path)
- print "new_path: %s" % str(new_path)
+ print("new_path: %s" % str(new_path))
index = len(path_prefix)
new_path[index] = str(int(new_path[index]) - 1)
new_path = tuple(new_path)
- print "new_path: %s" % str(new_path)
- print "self.paths: %s" % str(self.paths)
+ print("new_path: %s" % str(new_path))
+ print("self.paths: %s" % str(self.paths))
assert new_path not in self.paths
@@ -146,7 +146,7 @@
pass
def reordered(self, nid, path, neworder):
- print "reordering"
+ print("reordering")
self.trace += "reordering children of %s (%s) : %s\n" % (nid,
str(path),
neworder)
@@ -163,7 +163,7 @@
oldp = path + (old, )
newp = path + (i, )
le = len(newp)
- for pp in self.paths.keys():
+ for pp in list(self.paths.keys()):
if pp[0:le] == oldp:
n = self.paths[pp]
self.nodes[n].remove(pp)
@@ -182,7 +182,7 @@
self.paths[p] = newpaths[p]
def test_validity(self):
- for n in self.nodes.keys():
+ for n in list(self.nodes.keys()):
paths = self.tree.get_paths_for_node(n)
if len(self.nodes[n]) == 0:
raise Exception('Node %s is stored without any path' % n)
@@ -201,7 +201,7 @@
paths.remove(p)
if len(paths) > 0:
raise Exception('why is this path existing for %s' % n)
- for p in self.paths.keys():
+ for p in list(self.paths.keys()):
node = self.tree.get_node_for_path(p)
n = self.paths[p]
if n != node:
=== modified file 'GTG/tools/bidict.py'
--- GTG/tools/bidict.py 2013-02-25 07:35:07 +0000
+++ GTG/tools/bidict.py 2013-09-25 16:29:12 +0000
@@ -1,3 +1,4 @@
+from functools import reduce
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Getting Things GNOME! - a personal organizer for the GNOME desktop
@@ -107,4 +108,4 @@
'''
return reduce(lambda text, keys:
str(text) + str(keys),
- self._first_to_second.iteritems())
+ iter(self._first_to_second.items()))
=== modified file 'GTG/tools/cleanxml.py'
--- GTG/tools/cleanxml.py 2013-02-25 08:12:02 +0000
+++ GTG/tools/cleanxml.py 2013-09-25 16:29:12 +0000
@@ -136,11 +136,11 @@
sys.exit(1)
return _try_openxmlfile(zefile, root)
- except IOError, msg:
- print msg
+ except IOError as msg:
+ print(msg)
sys.exit(1)
- except xml.parsers.expat.ExpatError, msg:
+ except xml.parsers.expat.ExpatError as msg:
errormsg = "Error parsing XML file %s: %s" % (zefile, msg)
Log.error(errormsg)
if os.path.exists(tmpfile):
@@ -149,7 +149,7 @@
# Ok, try one more time now
try:
return _try_openxmlfile(zefile, root)
- except Exception, msg:
+ except Exception as msg:
Log.warning('Failed with reason: %s' % msg)
# Try to revert to backup
@@ -160,7 +160,7 @@
Log.info("Trying to restore backup file %s" % backup_file)
try:
return _try_openxmlfile(backup_file, root)
- except Exception, msg:
+ except Exception as msg:
Log.warning('Failed with reason: %s' % msg)
Log.info("No suitable backup was found")
@@ -189,18 +189,18 @@
try:
os.makedirs(backup_dir)
except IOError as error:
- print "Error while creating backup/ directory:", error
+ print("Error while creating backup/ directory:", error)
return False
try:
if os.path.exists(zefile):
os.rename(zefile, tmpfile)
f = open(zefile, mode='w+')
- pretty = doc.toprettyxml(tab, enter).encode("utf-8")
+ pretty = doc.toprettyxml(tab, enter)
if f and pretty:
- bwritten = os.write(f.fileno(), pretty)
+ bwritten = os.write(f.fileno(), bytes(pretty, 'utf8'))
if bwritten != len(pretty):
- print "error writing file %s" % zefile
+ print("error writing file %s" % zefile)
f.close()
return False
f.close()
@@ -231,8 +231,8 @@
shutil.copy(zefile, daily_backup)
return True
else:
- print "no file %s or no pretty xml" % zefile
+ print("no file %s or no pretty xml" % zefile)
return False
- except IOError, msg:
- print msg
+ except IOError as msg:
+ print(msg)
return False
=== modified file 'GTG/tools/clipboard.py'
--- GTG/tools/clipboard.py 2013-02-25 07:35:07 +0000
+++ GTG/tools/clipboard.py 2013-09-25 16:29:12 +0000
@@ -30,7 +30,7 @@
self.content = []
self.req = req
- """"take two gtk.TextIter as parameter and copy the
+ """"take two Gtk.TextIter as parameter and copy the
"""
def copy(self, start, stop, bullet=None):
@@ -54,9 +54,9 @@
tags = end_line.get_tags() + end_line.get_toggled_tags(False)
is_subtask = False
for ta in tags:
- if (ta.get_data('is_subtask')):
+ if hasattr(ta, 'is_subtask'):
is_subtask = True
- tid = ta.get_data('child')
+ tid = ta.child
tas = self.req.get_task(tid)
tas.set_to_keep()
tas.sync()
=== modified file 'GTG/tools/dates.py'
--- GTG/tools/dates.py 2013-02-25 08:29:31 +0000
+++ GTG/tools/dates.py 2013-09-25 16:29:12 +0000
@@ -32,7 +32,7 @@
__all__ = 'Date',
-NOW, SOON, SOMEDAY, NODATE = range(4)
+NOW, SOON, SOMEDAY, NODATE = list(range(4))
# strings representing fuzzy dates + no date
ENGLISH_STRINGS = {
NOW: 'now',
@@ -105,7 +105,7 @@
# Copy internal values from other Date object
self._real_date = value._real_date
self._fuzzy = value._fuzzy
- elif isinstance(value, str) or isinstance(value, unicode):
+ elif isinstance(value, str) or isinstance(value, str):
try:
da_ti = datetime.datetime.strptime(value, locale_format).date()
self._real_date = convert_datetime_to_date(da_ti)
@@ -153,21 +153,89 @@
else:
return other - self.date()
- def __cmp__(self, other):
- """ Compare with other Date instance """
- if isinstance(other, Date):
- comparison = cmp(self.date(), other.date())
-
- # Keep fuzzy dates below normal dates
- if comparison == 0:
- if self.is_fuzzy() and not other.is_fuzzy():
- return 1
- elif not self.is_fuzzy() and other.is_fuzzy():
- return -1
-
- return comparison
- elif isinstance(other, datetime.date):
- return cmp(self.date(), other)
+ def __lt__(self, other):
+ """ Judge whehter less than other Date instance """
+ if isinstance(other, Date):
+ # Keep fuzzy dates below normal dates
+ if self.date() == other.date():
+ if not self.is_fuzzy() and other.is_fuzzy():
+ return True
+ else:
+ return False
+ return self.date() < other.date()
+ elif isinstance(other, datetime.date):
+ return self.date() < other
+ else:
+ raise NotImplementedError
+
+ def __le__(self, other):
+ """ Judge whehter less than or equal to other Date instance """
+ if isinstance(other, Date):
+ # Keep fuzzy dates below normal dates
+ if self.date() == other.date():
+ if self.is_fuzzy() and not other.is_fuzzy():
+ return False
+ else:
+ return True
+ return self.date() <= other.date()
+ elif isinstance(other, datetime.date):
+ return self.date() <= other
+ else:
+ raise NotImplementedError
+
+ def __eq__(self, other):
+ """ Judge whehter equal to other Date instance """
+ if isinstance(other, Date):
+ # Handle fuzzy dates situations
+ if self.date() == other.date():
+ return self.is_fuzzy() == other.is_fuzzy()
+ else:
+ return False
+ elif isinstance(other, datetime.date):
+ return self.date() == other
+ else:
+ raise NotImplementedError
+
+ def __ne__(self, other):
+ """ Judge whehter not equal to other Date instance """
+ if isinstance(other, Date):
+ # Handle fuzzy dates situations
+ if self.date() == other.date():
+ return self.is_fuzzy() != other.is_fuzzy()
+ else:
+ return True
+ elif isinstance(other, datetime.date):
+ return self.date() != other
+ else:
+ raise NotImplementedError
+
+ def __gt__(self, other):
+ """ Judge whehter greater than other Date instance """
+ if isinstance(other, Date):
+ # Keep fuzzy dates below normal dates
+ if self.date() == other.date():
+ if self.is_fuzzy() and not other.is_fuzzy():
+ return True
+ else:
+ return False
+ return self.date() > other.date()
+ elif isinstance(other, datetime.date):
+ return self.date() > other
+ else:
+ raise NotImplementedError
+
+ def __ge__(self, other):
+ """ Judge whehter greater than or equal to other Date instance """
+ if isinstance(other, Date):
+ # Keep fuzzy dates below normal dates
+ if self.date() == other.date():
+ if not self.is_fuzzy() and other.is_fuzzy():
+ return False
+ else:
+ return True
+ return self.date() >= other.date()
+ elif isinstance(other, datetime.date):
+ return self.date() >= other
else:
raise NotImplementedError
@@ -187,7 +255,7 @@
else:
return self._real_date.isoformat()
- def __nonzero__(self):
+ def __bool__(self):
return self._fuzzy != NODATE
def __getattr__(self, name):
=== modified file 'GTG/tools/import_liblarch.py'
--- GTG/tools/import_liblarch.py 2013-02-25 08:12:02 +0000
+++ GTG/tools/import_liblarch.py 2013-09-25 16:29:12 +0000
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# -----------------------------------------------------------------------------
# Getting Things GNOME! - A personal organizer for the GNOME desktop
@@ -33,7 +33,9 @@
If use_local, prioritize local (development) liblarch in ../liblarch"""
def check_liblarch():
- """ Import liblarch and find out which one is missing """
+ """
+ Import liblarch and find out which one is missing
+ """
has_libraries = True
missing = []
try:
@@ -62,22 +64,22 @@
has_libraries, missing = check_liblarch()
if not has_libraries:
- print """GTG can't find %s. To install missing libraries,
+ print("""GTG can't find %s. To install missing libraries,
run the following command in the current folder:
%s
More information about liblarch: https://live.gnome.org/liblarch/""" % (
- missing, GIT_CMD)
+ missing, GIT_CMD))
return False
import liblarch
try:
is_liblarch_compatible = liblarch.is_compatible(REQUIRED_LIBLARCH_API)
except:
- print """I could not recognize your liblarch module. Make sure that
+ print("""I could not recognize your liblarch module. Make sure that
you don't have stale copies of liblarch in your import path
-"""
+""")
is_liblarch_compatible = False
if not is_liblarch_compatible:
try:
@@ -86,11 +88,11 @@
# Liblarch 1.0 has lowercased API variable
liblarch_version = liblarch.api
- print """Your liblarch copy has its API at version %s
+ print("""Your liblarch copy has its API at version %s
but your GTG copy need liblarch API version %s
You may fix that by downloading the last version of liblarch with
-%s """ % (liblarch_version, REQUIRED_LIBLARCH_API, GIT_CMD)
+%s """ % (liblarch_version, REQUIRED_LIBLARCH_API, GIT_CMD))
return False
return True
=== modified file 'GTG/tools/keyring.py'
--- GTG/tools/keyring.py 2013-02-25 08:12:02 +0000
+++ GTG/tools/keyring.py 2013-09-25 16:29:12 +0000
@@ -18,10 +18,9 @@
# -----------------------------------------------------------------------------
try:
- import gnomekeyring
- assert gnomekeyring
+ from gi.repository import GnomeKeyring
except ImportError:
- gnomekeyring = None
+ GnomeKeyring = None
from GTG.tools.borg import Borg
from GTG.tools.logger import Log
@@ -32,22 +31,32 @@
def __init__(self):
super(Keyring, self).__init__()
if not hasattr(self, "keyring"):
- self.keyring = gnomekeyring.get_default_keyring_sync()
+ result, self.keyring = GnomeKeyring.get_default_keyring_sync()
+ if result != GnomeKeyring.Result.OK:
+ raise Exception("Can't get default keyring, error=%s" % result)
def set_password(self, name, password, userid=""):
- return gnomekeyring.item_create_sync(
+ attrs = GnomeKeyring.Attribute.list_new()
+ GnomeKeyring.Attribute.list_append_string(attrs, "backend", name)
+ result, password_id = GnomeKeyring.item_create_sync(
self.keyring,
- gnomekeyring.ITEM_GENERIC_SECRET,
+ GnomeKeyring.ItemType.GENERIC_SECRET,
name,
- {"backend": name},
+ attrs,
password,
True)
+ if result != GnomeKeyring.Result.OK:
+ raise Exception("Can't create a new password, error=%s" % result)
+
+ return password_id
+
def get_password(self, item_id):
- try:
- item_info = gnomekeyring.item_get_info_sync(self.keyring, item_id)
+ result, item_info = GnomeKeyring.item_get_info_sync(
+ self.keyring, item_id)
+ if result == GnomeKeyring.Result.OK:
return item_info.get_secret()
- except (gnomekeyring.DeniedError, gnomekeyring.NoMatchError):
+ else:
return ""
@@ -73,7 +82,7 @@
def get_password(self, key):
return self.keyring.get(key, "")
-if gnomekeyring is not None:
+if GnomeKeyring is not None:
Keyring = GNOMEKeyring
else:
Log.info("GNOME keyring was not found, passwords will be not stored after\
=== modified file 'GTG/tools/networkmanager.py'
--- GTG/tools/networkmanager.py 2013-02-25 07:35:07 +0000
+++ GTG/tools/networkmanager.py 2013-09-25 16:29:12 +0000
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Getting Things GNOME! - a personal organizer for the GNOME desktop
@@ -18,25 +18,15 @@
# this program. If not, see <http://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------------
-""" Communicate with Network Manager over its D-Bus API
-
-API spec: http://projects.gnome.org/NetworkManager/developers/api/09/spec.html
-"""
-
-import dbus
-
-# A network device is connected, with global network connectivity.
-NM_STATE_CONNECTED_GLOBAL = 70
+""" Communicate with Network Manager """
+
+from gi.repository import NetworkManager, NMClient
def is_connection_up():
""" Returns True if GTG can access the Internet """
- bus = dbus.SystemBus()
- proxy = bus.get_object('org.freedesktop.NetworkManager',
- '/org/freedesktop/NetworkManager')
- network_manager = dbus.Interface(proxy, 'org.freedesktop.NetworkManager')
-
- return network_manager.state() == NM_STATE_CONNECTED_GLOBAL
+ state = NMClient.Client().get_state()
+ return state == NetworkManager.State.CONNECTED_GLOBAL
if __name__ == "__main__":
- print "is_connection_up() == %s" % is_connection_up()
+ print("is_connection_up() == %s" % is_connection_up())
=== modified file 'GTG/tools/shortcut.py'
--- GTG/tools/shortcut.py 2013-03-09 16:59:30 +0000
+++ GTG/tools/shortcut.py 2013-09-25 16:29:12 +0000
@@ -22,19 +22,19 @@
CHECK_VERSION = "gsettings list-keys " \
-"org.gnome.settings-daemon.plugins.media-keys"
+ "org.gnome.settings-daemon.plugins.media-keys"
NEW_TASK_ACTION = "gtg_new_task"
NEW_TASK_NAME = "GTG New Task"
GSETTINGS_GET_LIST = "gsettings get " \
-"org.gnome.settings-daemon.plugins.media-keys custom-keybindings"
+ "org.gnome.settings-daemon.plugins.media-keys custom-keybindings"
GSETTINGS_SET_LIST = "gsettings set " \
-"org.gnome.settings-daemon.plugins.media-keys custom-keybindings"
+ "org.gnome.settings-daemon.plugins.media-keys custom-keybindings"
GSETTINGS_GET = "gsettings get " \
-"org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:" \
-"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom"
+ "org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:" \
+ "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom"
GSETTINGS_SET = "gsettings set " \
-"org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:" \
-"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom"
+ "org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:" \
+ "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom"
GCONF_GET = "gconftool-2 --get /desktop/gnome/keybindings/custom"
GCONF_SET = "gconftool-2 --type string --set /desktop/gnome/keybindings/custom"
@@ -110,7 +110,7 @@
a.sort()
index = a[-1] + 1
append_this = "['/org/gnome/settings-daemon/plugins/media-keys/" \
- "custom-keybindings/custom" + str(index) + "/']"
+ "custom-keybindings/custom" + str(index) + "/']"
call_subprocess(GSETTINGS_SET, str(index), "/ command", NEW_TASK_ACTION)
call_subprocess(GSETTINGS_SET, str(index), "/ binding", binding)
call_subprocess(GSETTINGS_SET, str(index), "/ name", NEW_TASK_NAME)
@@ -152,7 +152,7 @@
if to_append is not None:
cmd.append(to_append)
out = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- return out.communicate()[0]
+ return out.communicate()[0].decode('ascii')
def check_invalidity(binding, key, mods):
=== modified file 'GTG/tools/taskxml.py'
--- GTG/tools/taskxml.py 2013-02-25 08:29:31 +0000
+++ GTG/tools/taskxml.py 2013-09-25 16:29:12 +0000
@@ -153,7 +153,7 @@
remote_ids_element = doc.createElement("task-remote-ids")
t_xml.appendChild(remote_ids_element)
remote_ids_dict = task.get_remote_ids()
- for backend_id, task_id in remote_ids_dict.iteritems():
+ for backend_id, task_id in remote_ids_dict.items():
backend_element = doc.createElement('backend')
remote_ids_element.appendChild(backend_element)
backend_element.appendChild(doc.createTextNode(backend_id))
=== modified file 'GTG/tools/urlregex.py'
--- GTG/tools/urlregex.py 2013-02-25 07:35:07 +0000
+++ GTG/tools/urlregex.py 2013-09-25 16:29:12 +0000
@@ -26,14 +26,14 @@
import re
-UTF_CHARS = ur'a-z0-9_\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u00ff'
+UTF_CHARS = r'a-z0-9_\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u00ff'
SUBST_DICT = {
- "pre": ur'(?:[^/"\':!=]|^|\:)',
- "domain": ur'([\.-]|[^\s_\!\.\/])+\.[a-z]{2,}(?::[0-9]+)?',
- "path": ur'(?:[\.,]?[%s!\*\'\(\);:&=\+\$/%s#\[\]\-_,~@])' % (
+ "pre": r'(?:[^/"\':!=]|^|\:)',
+ "domain": r'([\.-]|[^\s_\!\.\/])+\.[a-z]{2,}(?::[0-9]+)?',
+ "path": r'(?:[\.,]?[%s!\*\'\(\);:&=\+\$/%s#\[\]\-_,~@])' % (
UTF_CHARS, '%'),
- "query": ur'[a-z0-9!\*\'\(\);:&=\+\$/%#\[\]\-_\.,~]',
+ "query": r'[a-z0-9!\*\'\(\);:&=\+\$/%#\[\]\-_\.,~]',
# Valid end-of-path characters (so /foo. does not gobble the period).
"path_end": r'[%s\)=#/]' % UTF_CHARS,
"query_end": '[a-z0-9_&=#]',
=== modified file 'gtcli'
--- gtcli 2013-02-25 07:35:07 +0000
+++ gtcli 2013-09-25 16:29:12 +0000
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# -----------------------------------------------------------------------------
# Command line user interface for manipulating tasks in gtg.
@@ -75,12 +75,12 @@
This function handles possible errors while connecting to GTG """
try:
bus = dbus.SessionBus()
- except dbus.exceptions.DBusException, err:
+ except dbus.exceptions.DBusException as err:
if "X11 initialization failed" in err.get_dbus_message():
os.environ['DISPLAY'] = ":0"
bus = dbus.SessionBus()
else:
- print "dbus exception: '%s'" % err
+ print("dbus exception: '%s'" % err)
raise
proxy = bus.get_object("org.gnome.GTG", "/org/gnome/GTG")
@@ -103,9 +103,9 @@
gtg = connect_to_gtg()
task = gtg.NewTask("Active", title, '', '', '', [], cgi.escape(body), [])
if task:
- print _("New task created with id %s") % task['id']
+ print(_("New task created with id %s") % task['id'])
else:
- print _("New task could not be created")
+ print(_("New task could not be created"))
sys.exit(1)
@@ -117,11 +117,11 @@
task = gtg.GetTask(task_id)
gtg.DeleteTask(task_id)
if gtg.GetTask(task_id):
- print _("Task %s could not be deleted") % (task['title'])
+ print(_("Task %s could not be deleted") % (task['title']))
else:
- print _("Task %s deleted") % (task['title'])
+ print(_("Task %s deleted") % (task['title']))
else:
- print MSG_ERROR_TASK_ID_INVALID
+ print(MSG_ERROR_TASK_ID_INVALID)
sys.exit(1)
@@ -135,12 +135,12 @@
gtg.ModifyTask(task_id, task)
task = gtg.GetTask(task_id)
if task['status'] == "Done":
- print _("Task %s marked as done") % (task['title'])
+ print(_("Task %s marked as done") % (task['title']))
else:
- print _("Task %s could not be marked as done") % task['title']
+ print(_("Task %s could not be marked as done") % task['title'])
sys.exit(1)
else:
- print MSG_ERROR_TASK_ID_INVALID
+ print(MSG_ERROR_TASK_ID_INVALID)
sys.exit(1)
@@ -157,18 +157,18 @@
if decoration:
content = decoration.group(1)
- print task['title']
+ print(task['title'])
if len(task['tags']) > 0:
- print " %-12s %s" % ('tags:', task['tags'][0])
+ print(" %-12s %s" % ('tags:', task['tags'][0]))
for k in ['id', 'startdate', 'duedate', 'status']:
- print " %-12s %s" % (k + ":", task[k])
+ print(" %-12s %s" % (k + ":", task[k]))
if len(task['parents']) > 0:
- print " %-12s %s" % ('parents:', task['parents'][0])
- print
- print content
- print
+ print(" %-12s %s" % ('parents:', task['parents'][0]))
+ print()
+ print(content)
+ print()
else:
- print MSG_ERROR_TASK_ID_INVALID
+ print(MSG_ERROR_TASK_ID_INVALID)
sys.exit(1)
@@ -190,10 +190,10 @@
if task:
task['startdate'] = startdate
tags = ", ".join(task['tags'])
- print "%-12s %-20s %s" % (task['id'], tags, task['title'])
+ print("%-12s %-20s %s" % (task['id'], tags, task['title']))
gtg.ModifyTask(task['id'], task)
else:
- print MSG_ERROR_TASK_ID_INVALID
+ print(MSG_ERROR_TASK_ID_INVALID)
sys.exit(1)
@@ -204,7 +204,7 @@
if gtg.GetTask(task):
gtg.OpenTaskEditor(task)
else:
- print MSG_ERROR_TASK_ID_INVALID
+ print(MSG_ERROR_TASK_ID_INVALID)
sys.exit(1)
@@ -249,7 +249,7 @@
continue
total += 1
- print total
+ print(total)
return total
@@ -281,11 +281,11 @@
report[duedate] = {'starting': 0, 'due': 0}
report[duedate]['due'] += 1
- print "%-20s %5s %5s" % ("", "Start", "Due")
+ print("%-20s %5s %5s" % ("", "Start", "Due"))
if 'unscheduled' in report:
- print "%-20s %5d %5d" % ('unscheduled',
+ print("%-20s %5d %5d" % ('unscheduled',
report['unscheduled']['starting'],
- report['unscheduled']['due'])
+ report['unscheduled']['due']))
num_days = 22
fmt = "%a %-m-%-d"
if 'today' in criteria:
@@ -294,11 +294,11 @@
day = date.today() + timedelta(i)
sday = str(day)
if sday in report:
- print "%-20s %5d %5d" % (day.strftime(fmt),
+ print("%-20s %5d %5d" % (day.strftime(fmt),
report[sday]['starting'],
- report[sday]['due'])
+ report[sday]['due']))
else:
- print "%-20s %5d %5d" % (day.strftime(fmt), 0, 0)
+ print("%-20s %5d %5d" % (day.strftime(fmt), 0, 0))
def list_tasks(criteria):
@@ -334,19 +334,19 @@
# If any tags were specified, use only those as the categories
keys = [fname for fname in filters if fname.startswith('@')]
if not keys:
- keys = tasks_tree.keys()
+ keys = list(tasks_tree.keys())
keys.sort()
for key in keys:
if key not in tasks_tree:
continue
if key != notag:
- print "%s:" % (key[1:])
+ print("%s:" % (key[1:]))
for task in tasks_tree[key]:
text = textwrap.fill(task['title'],
initial_indent='',
subsequent_indent=' ' * 40)
- print " %-36s %s" % (task['id'], text)
+ print(" %-36s %s" % (task['id'], text))
def search_tasks(expression):
@@ -358,7 +358,7 @@
text = textwrap.fill(task['title'],
initial_indent='',
subsequent_indent=' ' * 40)
- print " %-36s %s" % (task['id'], text)
+ print(" %-36s %s" % (task['id'], text))
def overview(expression):
@@ -407,10 +407,10 @@
day_str = day.strftime("%A %-m-%-d")
if i > 0:
- print ""
- print "%s (%d tasks)" % (day_str, len(today_tasks))
+ print("")
+ print("%s (%d tasks)" % (day_str, len(today_tasks)))
for task in sorted(today_tasks):
- print " - %s" % task.encode('utf-8')
+ print(" - %s" % task)
def run_command(args):
@@ -453,7 +453,7 @@
""" Parse arguments and launch command """
try:
opts, args = getopt.gnu_getopt(sys.argv[1:], "h", ["help"])
- except getopt.GetoptError, err:
+ except getopt.GetoptError as err:
sys.stderr.write("Error: " + str(err) + "\n\n")
usage()
sys.exit(2)
=== modified file 'gtg'
--- gtg 2013-02-25 07:35:07 +0000
+++ gtg 2013-09-25 16:29:12 +0000
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# -----------------------------------------------------------------------------
# Getting Things GNOME! - A personal organizer for the GNOME desktop
@@ -23,7 +23,7 @@
import sys
from optparse import OptionParser
-from gtk.gdk import Screen
+from gi.repository.Gdk import Screen
from GTG import info
from GTG.tools.import_liblarch import import_liblarch
@@ -32,10 +32,10 @@
def x_is_running():
""" Return True if GTG could be displayed on the current XServer """
try:
- if Screen().get_display():
+ if Screen().get_default().get_display():
return True
- except RuntimeError:
- pass
+ except RuntimeError as exc:
+ print(exc)
return False
@@ -71,19 +71,20 @@
info.NAME = options.title
if options.print_version:
- print "GTG (Getting Things GNOME!)", info.VERSION
- print
- print "For more information:", info.URL
+ print("GTG (Getting Things GNOME!)", info.VERSION)
+ print()
+ print("For more information:", info.URL)
sys.exit(0)
elif not x_is_running():
- print "Could not open X display"
+ print("Could not open X display")
sys.exit(1)
elif import_liblarch(options.local_liblarch):
from GTG import gtg
sys.exit(gtg.main(options, args))
+
if __name__ == "__main__":
try:
main()
=== modified file 'gtg_new_task'
--- gtg_new_task 2013-02-25 07:35:07 +0000
+++ gtg_new_task 2013-09-25 16:29:12 +0000
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# -----------------------------------------------------------------------------
# Getting Things GNOME! - A personal organizer for the GNOME desktop
=== modified file 'profile.py'
--- profile.py 2012-11-25 19:19:44 +0000
+++ profile.py 2013-09-25 16:29:12 +0000
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Getting Things GNOME! - a personal organizer for the GNOME desktop
=== modified file 'run-tests'
--- run-tests 2012-11-25 19:19:44 +0000
+++ run-tests 2013-09-25 16:29:12 +0000
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Getting Things GNOME! - a personal organizer for the GNOME desktop
@@ -35,13 +35,15 @@
descriptions = True,
verbosity = 1)
if "-h" in args:
- print "USAGE:"
- print "./run_tests to run all tests"
- print "./run_tests [module_name ..] to run tests from the listed " + \
- "modules"
- print "./run_tests [function_path ..] to run the selected " + \
- "functions as tests"
+ print("USAGE:")
+ print("./run_tests to run all tests")
+ print("./run_tests [module_name ..] to run tests from the listed " + \
+ "modules")
+ print("./run_tests [function_path ..] to run the selected " + \
+ "functions as tests")
return
+ if "-l" in args:
+ args.remove("-l")
# fake modules that mimic the behaviour of external libraries ...
TestingMode().set_testing_mode(True)
if args:
@@ -79,16 +81,18 @@
#show the aggregated result of all the tests
if tests_are_successful:
- print "ALL TESTS ARE SUCCESSFUL"
+ print("ALL TESTS ARE SUCCESSFUL")
return 0
else:
- print """
+ print("""
****************************************
SOME TESTS *FAILED*!
****************************************
- """
+ """)
return 1
if __name__ == '__main__':
- if import_liblarch():
+ use_local = "-l" in sys.argv[1:] or "--local-liblarch" in sys.argv[1:]
+
+ if import_liblarch(use_local):
sys.exit(main(sys.argv[1:]))
=== modified file 'scripts/anonymize_task_file.py'
--- scripts/anonymize_task_file.py 2013-02-25 07:35:07 +0000
+++ scripts/anonymize_task_file.py 2013-09-25 16:29:12 +0000
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright © 2010 Marko Kevac <marko@xxxxxxxxx>
#
@@ -24,8 +24,8 @@
def anonymize(filename, outputfile):
try:
dom = parse(filename)
- except Exception, err:
- print "error while parsing %s: %s" % (filename, err)
+ except Exception as err:
+ print("error while parsing %s: %s" % (filename, err))
return
tasks = dom.getElementsByTagName("task")
@@ -62,18 +62,18 @@
try:
fp = open(outputfile, "w")
- fp.write(dom.toxml().encode("utf8"))
- except Exception, err:
- print "error while saving output file: %s" % err
+ fp.write(dom.toxml())
+ except Exception as err:
+ print("error while saving output file: %s" % err)
def usage():
- print "Usage: %s [taskfile] [outputfile]" % sys.argv[0]
- print
- print "Removes private data from specified taskfile, or your"
- print "default gtg tasks file if unspecified. Writes output"
- print "to /tmp/gtg-tasks.xml by default, or to specified"
- print "outputfile if provided."
+ print("Usage: %s [taskfile] [outputfile]" % sys.argv[0])
+ print()
+ print("Removes private data from specified taskfile, or your")
+ print("default gtg tasks file if unspecified. Writes output")
+ print("to /tmp/gtg-tasks.xml by default, or to specified")
+ print("outputfile if provided.")
sys.exit(1)
@@ -90,9 +90,9 @@
xmlproject = dom.getElementsByTagName("backend")[0]
xmlfile = str(xmlproject.getAttribute("path"))
- print "Reading tasks from %s" % (xmlfile)
+ print("Reading tasks from %s" % (xmlfile))
except:
- print
+ print()
usage()
if len(sys.argv) > 2:
@@ -100,7 +100,7 @@
else:
# Use a reasonable default, and write out where it's sent
outputfile = "/tmp/gtg-tasks.xml"
- print "Saving anonymized tasks to %s" % (outputfile)
+ print("Saving anonymized tasks to %s" % (outputfile))
anonymize(xmlfile, outputfile)
=== modified file 'scripts/build_integrity.py'
--- scripts/build_integrity.py 2013-02-25 07:35:07 +0000
+++ scripts/build_integrity.py 2013-09-25 16:29:12 +0000
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# Copyright © 2012 Izidor Matušov <izidor.matusov@xxxxxxxxx
#
@@ -26,11 +26,11 @@
# Build MANIFEST and also run build action
if os.system("python setup.py sdist > /dev/null") != 0:
- print "sdist operation failed"
+ print("sdist operation failed")
sys.exit(1)
if os.system("python setup.py build > /dev/null") != 0:
- print "build operation failed"
+ print("build operation failed")
sys.exit(1)
manifest_files = []
@@ -64,6 +64,6 @@
missing_files = list(set(manifest_files) - set(build_files))
if len(missing_files) > 0:
missing_files.sort()
- print "Missing build files:"
- print "\n".join("\t%s" % f for f in missing_files)
+ print("Missing build files:")
+ print("\n".join("\t%s" % f for f in missing_files))
sys.exit(1)
=== modified file 'scripts/close_launchpad_bugs.py'
--- scripts/close_launchpad_bugs.py 2013-02-25 07:35:07 +0000
+++ scripts/close_launchpad_bugs.py 2013-09-25 16:29:12 +0000
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# Copyright © 2009 Luca Falavigna <dktrkranz@xxxxxxxxxx>
#
@@ -22,7 +22,7 @@
import re
import sys
from re import findall
-from urllib import urlopen
+from urllib.request import urlopen
from launchpadlib.credentials import Credentials
from launchpadlib.launchpad import Launchpad, EDGE_SERVICE_ROOT
@@ -35,7 +35,7 @@
creddir = os.path.expanduser("~/.cache/lp_credentials")
if not os.path.isdir(creddir):
os.makedirs(creddir)
- os.chmod(creddir, 0700)
+ os.chmod(creddir, 0o700)
credpath = os.path.join(creddir, 'close_launchpad_bugs.txt')
try:
@@ -61,7 +61,7 @@
task.lp_save()
if len(sys.argv) != 2:
- print 'Usage: %s <release>' % sys.argv[0]
+ print('Usage: %s <release>' % sys.argv[0])
sys.exit(1)
data = urlopen('https://launchpad.net/gtg/+milestone/%s' % sys.argv[1]).read()
@@ -69,13 +69,13 @@
launchpad = lp_login()
if not 'gtg' in [e.name for e in launchpad.people[launchpad.me].super_teams]:
- print 'You are not a GTG developer, exiting.'
+ print('You are not a GTG developer, exiting.')
sys.exit(0)
for bugno in bugs:
try:
process_bug(launchpad.bugs[bugno])
- print "Bug #%s marked as Fix Released: " \
- "https://bugs.edge.launchpad.net/gtg/+bug/%s" % (bugno, bugno)
+ print("Bug #%s marked as Fix Released: " \
+ "https://bugs.edge.launchpad.net/gtg/+bug/%s" % (bugno, bugno))
except:
- print "UNABLE TO PROCESS BUG #%s" % bugno
+ print("UNABLE TO PROCESS BUG #%s" % bugno)
=== modified file 'scripts/gtg_stress_test'
--- scripts/gtg_stress_test 2012-11-25 19:19:44 +0000
+++ scripts/gtg_stress_test 2013-09-25 16:29:12 +0000
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# -----------------------------------------------------------------------------
# Getting Things GNOME! - A personal organizer for the GNOME desktop
@@ -35,7 +35,7 @@
if __name__ == '__main__':
if len(sys.argv) == 1:
- print "Usage: " + sys.argv[0] + " <number-of-tasks> [number-of-words-in-bodies]"
+ print("Usage: " + sys.argv[0] + " <number-of-tasks> [number-of-words-in-bodies]")
sys.exit(1)
total_tasks = int(sys.argv[1])
@@ -44,8 +44,8 @@
text_length = int(sys.argv[2])
gtg = connect()
- for i in xrange(total_tasks):
+ for i in range(total_tasks):
lengthy_text = ""
- for i in xrange(text_length):
+ for i in range(text_length):
lengthy_text += str(uuid.uuid4())
gtg.NewTask("Active", str(uuid.uuid4()), '', '', '', [], lengthy_text, [])
=== modified file 'scripts/profile_interpret.sh'
--- scripts/profile_interpret.sh 2012-01-14 22:10:04 +0000
+++ scripts/profile_interpret.sh 2013-09-25 16:29:12 +0000
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
import pstats
p = pstats.Stats('gtg.prof')
p.strip_dirs().sort_stats("cumulative").print_stats(20)
=== modified file 'scripts/tarball_integrity.py'
--- scripts/tarball_integrity.py 2013-02-25 07:35:07 +0000
+++ scripts/tarball_integrity.py 2013-09-25 16:29:12 +0000
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# Copyright © 2010 Luca Falavigna <dktrkranz@xxxxxxxxxx>
#
@@ -55,6 +55,6 @@
missing = list(set(dirlist) - set(tarlist))
if len(missing) > 0:
missing.sort()
- print 'Missing files in tarball:'
- print '\n'.join("\t%s" % f for f in missing)
+ print('Missing files in tarball:')
+ print('\n'.join("\t%s" % f for f in missing))
sys.exit(1)
=== modified file 'setup.py'
--- setup.py 2013-02-11 13:10:01 +0000
+++ setup.py 2013-09-25 16:29:12 +0000
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Getting Things GNOME! - a personal organizer for the GNOME desktop
@@ -111,7 +111,7 @@
try:
return_code = call(['msgfmt', '-o', mo, po])
except OSError:
- print 'Translation not available, please install gettext'
+ print('Translation not available, please install gettext')
break
if return_code:
raise Warning('Error when building locales')
Follow ups