GTG

Merge lp:~izidor/gtg/title into lp:~gtg/gtg/old-trunk

Proposed by Izidor Matušov
Status: Merged
Merged at revision: 1192
Proposed branch: lp:~izidor/gtg/title
Merge into: lp:~gtg/gtg/old-trunk
Diff against target: 111 lines (+32/-20)
3 files modified
CHANGELOG (+1/-0)
gtg (+5/-0)
scripts/debug.sh (+26/-20)
To merge this branch: bzr merge lp:~izidor/gtg/title
Reviewer Review Type Date Requested Status
Lionel Dricot (community) Approve
Review via email: mp+109153@code.launchpad.net

Description of the change

Added option -t to set the title of windows (You can put whatever you want instead of "Getting Things GNOME!" in the titlebar). It is useful when you have opened multiple instances of GTG and want to differentiate between them.

Use case from real life. I do final debug of a new feature. I import my real life data to test and run it. In that moment I have two identical instances of GTG running. If I want to add a new task to my real GTG (oops, found a bug), it is impossible to distinguish between them.

./scripts/debug.sh sets title to "Dev GTG: <name of the dir>" or "Dev GTG: <name of dir> (<name of -s dataset> dataset)". If I am in ~/projects/gtg/new-feature and run ./scripts/debug.sh -s bryce, the title is "Dev GTG: new-feature (bryce dataset)"

I think it is a nifty feature to have.

To post a comment you must log in.
Revision history for this message
Lionel Dricot (ploum-deactivatedaccount) :
review: Approve
Revision history for this message
Bertrand Rousseau (bertrand-rousseau) wrote :

Just a small comment: I totally agree it can be really useful, but
maybe another way to implement this would be to set a custom title in
the configuration file. That would allow to have development-oriented
customizations while still avoiding to make them visible to users.
That being said, I don't disapprove this particular solution, it's ok
to merge it (since it's buried in the command line options, it won't
be very visible to the user anyway). However I just wanted to point
out that if we'll need more of such kind of development-oriented
features in the future, it would probably be better to avoid adding a
dedicated flag for each one.

On Thu, Jun 7, 2012 at 4:23 PM, Lionel Dricot <email address hidden> wrote:
> Review: Approve
>
>
> --
> https://code.launchpad.net/~izidor/gtg/title/+merge/109153
> You are subscribed to branch lp:gtg.

--
Bertrand Rousseau

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CHANGELOG'
2--- CHANGELOG 2012-06-07 11:37:15 +0000
3+++ CHANGELOG 2012-06-07 14:07:23 +0000
4@@ -24,6 +24,7 @@
5 * New tag editor
6 * Fix bugs #1003872 and #1002067: Correct titles to Preferences and Synchronization Services Dialogs, by Alan Gomes
7 * Improved Export plugin, export to PDF works now, by Izidor Matušov
8+ * Added -t option to distinguish between multiple instances of GTG
9
10 2012-02-13 Getting Things GNOME! 0.2.9
11 * Big refractorization of code, now using liblarch
12
13=== modified file 'gtg'
14--- gtg 2012-06-02 11:02:53 +0000
15+++ gtg 2012-06-07 14:07:23 +0000
16@@ -57,10 +57,15 @@
17 parser.add_option('-l', '--local-liblarch', action='store_true',
18 dest='local_liblarch', default=False,
19 help="Use local liblarch located in ../liblarch if it is posible")
20+ parser.add_option('-t', '--title', action='store',
21+ help="Use special title for windows' title")
22 parser.add_option('-v', '--version', action='store_true',
23 dest='print_version', help="Print GTG's version number", default=False)
24 (options, args) = parser.parse_args()
25
26+ if options.title is not None:
27+ info.NAME = options.title
28+
29 if options.print_version:
30 print "GTG (Getting Things Gnome!)", info.VERSION
31 print
32
33=== modified file 'scripts/debug.sh'
34--- scripts/debug.sh 2012-04-07 15:05:21 +0000
35+++ scripts/debug.sh 2012-06-07 14:07:23 +0000
36@@ -7,9 +7,10 @@
37 fi
38
39 args="--no-crash-handler"
40-set="default"
41+dataset="default"
42 norun=0
43 profile=0
44+title=""
45
46 # Create execution-time data directory if needed
47 mkdir -p tmp
48@@ -25,29 +26,34 @@
49 ;;
50 n) norun=1;;
51 p) profile=1;;
52- s) set="$OPTARG";;
53- [?]) echo >&2 "Usage: $0 [-s dataset] [-b] [-d] [-l] [-n] [-p]"
54+ s) dataset="$OPTARG";;
55+ t) title="$OPTARG";;
56+ [?]) echo >&2 "Usage: $0 [-s dataset] [-t title] [-b] [-d] [-l] [-n] [-p]"
57 exit 1;;
58 esac
59 done
60
61 # Copy dataset
62-if [ $set != "default" ]
63-then
64- if [ ! -d "./tmp/$set" ]
65+if [ $dataset != "default" -a ! -d "./tmp/$dataset" ]
66+then
67+ echo "Copying $dataset dataset to ./tmp/"
68+ cp -r test/data/$dataset tmp/
69+fi
70+
71+echo "Setting XDG vars to use $dataset dataset."
72+export XDG_DATA_HOME="./tmp/$dataset/xdg/data"
73+export XDG_CACHE_HOME="./tmp/$dataset/xdg/cache"
74+export XDG_CONFIG_HOME="./tmp/$dataset/xdg/config"
75+
76+# Title has to be passed to GTG directly, not through $args
77+# title could be more word, and only the first word would be taken
78+if [ "$title" = "" ]
79+then
80+ title="Dev GTG: $(basename `pwd`)"
81+ if [ "$dataset" != "default" ]
82 then
83- echo "Copying $set dataset to ./tmp/"
84- cp -r test/data/$set tmp/
85+ title="$title ($dataset dataset)"
86 fi
87- echo "Setting XDG vars to use $set dataset."
88- export XDG_DATA_HOME="./tmp/$set/xdg/data"
89- export XDG_CACHE_HOME="./tmp/$set/xdg/cache"
90- export XDG_CONFIG_HOME="./tmp/$set/xdg/config"
91-else
92- echo "Setting XDG vars to use default dataset."
93- export XDG_DATA_HOME="./tmp/default/xdg/data"
94- export XDG_CACHE_HOME="./tmp/default/xdg/cache"
95- export XDG_CONFIG_HOME="./tmp/default/xdg/config"
96 fi
97
98 if [ $norun -eq 0 ]; then
99@@ -64,10 +70,10 @@
100 fi
101
102 if [ $profile -eq 1 ]; then
103- python -m cProfile -o gtg.prof ./gtg $args
104- python ./scripts/profile_interpret.sh
105+ python -m cProfile -o gtg.prof ./gtg $args -t "$title"
106+ python ./scripts/profile_interpret.sh
107 else
108- ./gtg $args
109+ ./gtg $args -t "$title"
110 fi
111 fi
112

Subscribers

People subscribed via source and target branches

to status/vote changes: