Merge lp:~stefan-schwarzburg/qreator/qreator into lp:~dpm/qreator/trunk

Proposed by Schwarzburg
Status: Merged
Merged at revision: 82
Proposed branch: lp:~stefan-schwarzburg/qreator/qreator
Merge into: lp:~dpm/qreator/trunk
Diff against target: 123 lines (+16/-37)
4 files modified
data/ui/QrCodeLocation.ui (+3/-3)
data/ui/QrCodeSoftwareCentreApp.ui (+0/-3)
data/ui/QreatorWindow.ui (+6/-9)
qreator/QreatorWindow.py (+7/-22)
To merge this branch: bzr merge lp:~stefan-schwarzburg/qreator/qreator
Reviewer Review Type Date Requested Status
David Planella Approve
Review via email: mp+108396@code.launchpad.net

Description of the change

The Notebook that was used to place the different QRCode widgets in did not resize itself, even with a solution that used hide/show on the not-used widgets.

A alternative to the Notebook is a Box with ALL QRCode widgets in them, but only the currently active is shown (all others are hidden).

To post a comment you must log in.
Revision history for this message
David Planella (dpm) wrote :

Thanks a lot!

I like the approach, which is quite similar to what I did in rev 74 already before switching to a notebook widget, and much cleaner. I'd be happy to merge. However, after trying it, it seems to either have brought a regression or trigger a couple of issues that were already present in the code:

* When launching the application:
  - The main window doe not longer have a maximize button
  - The main window height is quite big and cannot be changed (see below). It's off-screen on my laptop.
  - The main window can only be resized horizontally, but not vertically

Oddly enough, these issues resolve when clicking on one of the QR type buttons and going back to the "New" screen.

Here is a short video that illustrates the issues [1]. Any ideas as to what could be causing it?

[1]: http://ubuntuone.com/4tNSAhnTU8EPoEirzTzGrZ

review: Needs Information
83. By Schwarzburg

Remove the height request from the qrcode widget and make the qrcode size adaptable.

This solves the height problem and the not-maximazable window problem.

Revision history for this message
David Planella (dpm) wrote :

Thanks a lot for the new revision, you rock!

I've merged it with some minor changes:

- Added margins to the qr_input box
- Added you to the authors credits
- Disabled automatic resizing of QR codes for now (*)

I also have a couple of questions:

- Looking at the diffs for 'data/ui/QrCodeLocation.ui', and 'data/ui/QrCodeSoftwareCentreApp.ui', what is the function of the placeholders?
- Why was the placeholder added in one case and removed in the other?

(*) While I like the 'organic' feel of the automatic QR code resizing you are proposing, for now I'd prefer to have the user always expect a fixed size, and not have to rely on resizing the window to resize the QR code.

Eventually I want to add '+' and '-' buttons and keyboard shortcuts to increase or decrease the QR code at the user's request (and increase the size of the drawing area when the QR code is too big), but until that is implemented, I prefer to stay on fixed sizes.

review: Approve
Revision history for this message
Schwarzburg (stefan-schwarzburg) wrote :

As for the placeholders, I have no idea. They were not put there on purpose by me, but maybe they have been automatically added/removed by glade during the changes.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/ui/QrCodeLocation.ui'
2--- data/ui/QrCodeLocation.ui 2012-05-30 08:33:06 +0000
3+++ data/ui/QrCodeLocation.ui 2012-06-02 07:25:21 +0000
4@@ -5,9 +5,6 @@
5 <property name="visible">True</property>
6 <property name="can_focus">False</property>
7 <child>
8- <placeholder/>
9- </child>
10- <child>
11 <object class="GtkExpander" id="expander1">
12 <property name="can_focus">True</property>
13 <property name="margin_top">6</property>
14@@ -106,5 +103,8 @@
15 <property name="height">1</property>
16 </packing>
17 </child>
18+ <child>
19+ <placeholder/>
20+ </child>
21 </object>
22 </interface>
23
24=== modified file 'data/ui/QrCodeSoftwareCentreApp.ui'
25--- data/ui/QrCodeSoftwareCentreApp.ui 2012-05-30 09:21:02 +0000
26+++ data/ui/QrCodeSoftwareCentreApp.ui 2012-06-02 07:25:21 +0000
27@@ -20,8 +20,5 @@
28 <property name="height">1</property>
29 </packing>
30 </child>
31- <child>
32- <placeholder/>
33- </child>
34 </object>
35 </interface>
36
37=== modified file 'data/ui/QreatorWindow.ui'
38--- data/ui/QreatorWindow.ui 2012-05-30 08:33:06 +0000
39+++ data/ui/QreatorWindow.ui 2012-06-02 07:25:21 +0000
40@@ -457,7 +457,6 @@
41 <property name="can_focus">False</property>
42 <child>
43 <object class="GtkDrawingArea" id="qr_drawingarea">
44- <property name="height_request">350</property>
45 <property name="visible">True</property>
46 <property name="can_focus">False</property>
47 <property name="margin_left">12</property>
48@@ -543,15 +542,13 @@
49 </packing>
50 </child>
51 <child>
52- <object class="GtkNotebook" id="qr_input_notebook">
53+ <object class="GtkBox" id="qr_input_box">
54 <property name="visible">True</property>
55- <property name="can_focus">True</property>
56- <property name="margin_left">12</property>
57- <property name="margin_right">12</property>
58- <property name="margin_top">6</property>
59- <property name="margin_bottom">6</property>
60- <property name="show_tabs">False</property>
61- <property name="show_border">False</property>
62+ <property name="can_focus">False</property>
63+ <property name="orientation">vertical</property>
64+ <child>
65+ <placeholder/>
66+ </child>
67 </object>
68 <packing>
69 <property name="left_attach">0</property>
70
71=== modified file 'qreator/QreatorWindow.py'
72--- qreator/QreatorWindow.py 2012-05-31 19:01:53 +0000
73+++ qreator/QreatorWindow.py 2012-06-02 07:25:21 +0000
74@@ -105,26 +105,7 @@
75 self.curr_width = 0
76
77 for qr_type in self.qr_types:
78- self.ui.qr_input_notebook.append_page(qr_type.widget.grid, None)
79-
80- self.ui.qr_input_notebook.connect("switch-page",
81- self.on_qr_input_notebook_switch_page)
82-
83- def on_qr_input_notebook_switch_page(self, widget, label, page):
84- for p in range(widget.get_n_pages()):
85- container = widget.get_nth_page(p)
86- if not p == page:
87- for c in container.get_children():
88- try:
89- c.hide_all()
90- except AttributeError:
91- c.hide()
92- else:
93- for c in container.get_children():
94- try:
95- c.show_all()
96- except AttributeError:
97- c.show()
98+ self.ui.qr_input_box.add(qr_type.widget.grid)
99
100 def fill_qr_types_store(self):
101 self.qr_types_store.clear()
102@@ -204,7 +185,11 @@
103 self.qr_types[qr_id].widget.on_activated()
104
105 self.ui.notebook1.set_current_page(PAGE_QR)
106- self.ui.qr_input_notebook.set_current_page(qr_id)
107+
108+ for child in self.ui.qr_input_box.get_children():
109+ child.hide()
110+ self.ui.qr_input_box.get_children()[qr_id].show()
111+
112
113 ##########################################
114
115@@ -316,7 +301,7 @@
116
117 if not text == '':
118 ## Create the QR code
119- qr_code = QRCode()
120+ qr_code = QRCode(output_size = int(min(width, height)*0.9))
121 self.surface = qr_code.encode(text, QRCodeOutput.CAIRO_SURFACE)
122
123 # Center the image in the drawing area

Subscribers

People subscribed via source and target branches

to all changes: