Merge lp:~dcaro/clicompanion/fix-915606 into lp:clicompanion

Proposed by David Caro
Status: Merged
Approved by: Marek Bardoński
Approved revision: 106
Merged at revision: 105
Proposed branch: lp:~dcaro/clicompanion/fix-915606
Merge into: lp:clicompanion
Diff against target: 114 lines (+37/-4)
4 files modified
clicompanionlib/config.py (+4/-0)
clicompanionlib/tabs.py (+23/-0)
clicompanionlib/view.py (+6/-0)
plugins/LocalCommandList.py (+4/-4)
To merge this branch: bzr merge lp:~dcaro/clicompanion/fix-915606
Reviewer Review Type Date Requested Status
Marek Bardoński Approve
Review via email: mp+88422@code.launchpad.net

Description of the change

Added the reorderable tabs

To post a comment you must log in.
lp:~dcaro/clicompanion/fix-915606 updated
106. By David Caro "<email address hidden>"

merged from trunk

Revision history for this message
Marek Bardoński (bdfhjk) wrote :

Work fine.

Thank You David!

review: Approve
Revision history for this message
David Caro (dcaro) wrote :

You are welcome!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'clicompanionlib/config.py'
2--- clicompanionlib/config.py 2012-01-12 08:48:49 +0000
3+++ clicompanionlib/config.py 2012-01-12 20:55:28 +0000
4@@ -80,6 +80,8 @@
5 'close_tab': 'unused',
6 'next_tab': 'unused',
7 'previous_tab': 'unused',
8+ 'move_tab_right': 'unused',
9+ 'move_tab_left': 'unused',
10 'toggle_fullscreen': 'F12',
11 'toggle_maximize': 'F11',
12 'toggle_hide_ui': 'F9',
13@@ -100,6 +102,8 @@
14 'close_tab': 'Close tab',
15 'next_tab': 'Go to the next tab',
16 'previous_tab': 'Go to the previous tab',
17+ 'move_tab_right': 'Move the focused tab to the right',
18+ 'move_tab_left': 'Move the focused tab to the left',
19 'toggle_fullscreen': 'Toggle fullscreen',
20 'toggle_maximize': 'Maximize',
21 'toggle_hide_ui': 'Hide UI',
22
23=== modified file 'clicompanionlib/tabs.py'
24--- clicompanionlib/tabs.py 2012-01-11 20:16:12 +0000
25+++ clicompanionlib/tabs.py 2012-01-12 20:55:28 +0000
26@@ -326,8 +326,30 @@
27 add_tab_button.set_tooltip_text(_("Click to add another tab"))
28 ## create first tab
29 self.append_page(gtk.Label(""), add_tab_button)
30+ self.set_tab_reorderable(add_tab_button, False)
31 add_tab_button.connect("clicked", lambda *x: self.add_tab())
32 self.set_size_request(700, 120)
33+ self.connect('page-reordered', self.check_order)
34+
35+ def check_order(self, notebook, child, page_num):
36+ if page_num == self.get_n_pages() - 1:
37+ self.reorder_child(child, self.get_n_pages() - 2)
38+
39+ def move_tab_right(self):
40+ page = self.get_current_page()
41+ child = self.get_nth_page(page)
42+ if page != self.get_n_pages() - 2:
43+ self.reorder_child(child, page + 1)
44+ else:
45+ self.reorder_child(child, 0)
46+
47+ def move_tab_left(self):
48+ page = self.get_current_page()
49+ child = self.get_nth_page(page)
50+ if page == 0:
51+ self.reorder_child(child, self.get_n_pages() - 2)
52+ else:
53+ self.reorder_child(child, page - 1)
54
55 def focus(self):
56 num = self.get_current_page()
57@@ -359,6 +381,7 @@
58 newtab.connect("preferences", lambda *x: self.emit('preferences'))
59 newtab.connect("rename",
60 lambda wg, text: self.rename_tab(newtab, text))
61+ self.set_tab_reorderable(newtab, True)
62 self.focus()
63 return newtab
64
65
66=== modified file 'clicompanionlib/view.py'
67--- clicompanionlib/view.py 2012-01-11 20:16:12 +0000
68+++ clicompanionlib/view.py 2012-01-12 20:55:28 +0000
69@@ -462,6 +462,12 @@
70 def previous_tab(self):
71 self.term_notebook.prev_tab()
72
73+ def move_tab_right(self):
74+ self.term_notebook.move_tab_right()
75+
76+ def move_tab_left(self):
77+ self.term_notebook.move_tab_left()
78+
79 def copy(self):
80 self.term_notebook.copy()
81
82
83=== modified file 'plugins/LocalCommandList.py'
84--- plugins/LocalCommandList.py 2012-01-10 21:00:04 +0000
85+++ plugins/LocalCommandList.py 2012-01-12 20:55:28 +0000
86@@ -24,6 +24,7 @@
87 import pygtk
88 pygtk.require('2.0')
89 import gobject
90+import collections
91
92 try:
93 import gtk
94@@ -346,7 +347,7 @@
95 orig = [fld.strip() for fld in orig]
96 # fill the empty fields
97 if len(orig) < 3:
98- orig = orig + ('', ) * (3 - len(orig))
99+ orig = list(orig) + ['', ] * (3 - len(orig))
100 dbg('Got drop of command %s' % '_\t_'.join(orig))
101
102 if drop_info:
103@@ -359,9 +360,8 @@
104 self.cmnds.drag_n_drop(orig, dest, before=False)
105 else:
106 dbg('\t to the end')
107- self.cmnds[len(cmnds)] = orig
108- if context.action == gtk.gdk.ACTION_MOVE:
109- context.finish(True, True, etime)
110+ self.cmnds[len(self.cmnds)] = orig
111+ context.finish(True, True, time)
112 self.sync_cmnds()
113
114 def main(self):

Subscribers

People subscribed via source and target branches