Merge lp:~dpm/ubuntu-terminal-app/migrate-new-header into lp:ubuntu-terminal-app

Proposed by David Planella
Status: Merged
Approved by: Alan Pope 🍺🐧🐱 🦄
Approved revision: 119
Merged at revision: 112
Proposed branch: lp:~dpm/ubuntu-terminal-app/migrate-new-header
Merge into: lp:ubuntu-terminal-app
Diff against target: 254 lines (+86/-79)
3 files modified
src/app/qml/Terminal.qml (+30/-0)
src/app/qml/ubuntu-terminal-app.qml (+36/-49)
tests/autopilot/ubuntu_terminal_app/tests/test_terminal.py (+20/-30)
To merge this branch: bzr merge lp:~dpm/ubuntu-terminal-app/migrate-new-header
Reviewer Review Type Date Requested Status
Nekhelesh Ramananthan (community) Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Ubuntu Terminal Developers Pending
Review via email: mp+230225@code.launchpad.net

Commit message

Migrate to the new header

Description of the change

Migrate to the new header.

Caveats:
- This is only the first cut. I'm not too convinced by the actions to show extra panels, which require an additional one to close them all. But this is the easiest path to migrate to the new panel, and if we need a redesign of the panels, it can be discussed and implemented as a separate MP.
- I'd like to show only the settings icon on the header, and the rest grouped in the list of actions. head.actions does not seem to give me any control over this, and shows always the 2 first actions as an icon, and the rest grouped.

To post a comment you must log in.
113. By David Planella

Give back the objectName to the settings action

114. By David Planella

Removed obsolete pixmap icons

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

Action {
86 + objectName: "hidepanelaction"
87 + iconName: "edit-clear"
88 + text: i18n.tr("Hide all key panels")
89 + onTriggered: pgTerm.showExtraPanel(0)
90 + },

Shouldn't the clear button be shown only when a panel is shown? Otherwise it is a bit confusing what the button does where there are no panels open.

> and shows always the 2 first actions as an icon, and the rest grouped.

The header by default shows a maximum of 3 icons. So due to that in your case it shows the first 2 icons and then the 3rd one in the list. I don't think (nor believe) that a public API will be provided to control this.

review: Needs Fixing
Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

As you said we could decide on the redesign of the panels in another panel, just jotting down my idea here. Ideally it would be nice to show,

- Setting icon (visible always)
- Clear icon (conditionally visible)
- Panels Button to show popover for additional functions like the original implementation. This way it won't be grouped and also a popover seems like a good way to show this.

Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

93 + text: i18n.tr("Show control keys panel")
88 + text: i18n.tr("Hide all key panels")
103 + text: i18n.tr("Show arrow keys panel")
98 + text: i18n.tr("Show function keys panel")

Why the additional strings? Feel like "Hide Panels", "Control Keys", "Arrow Keys", "Function Keys" should the job. Either way with the long description they will be truncated (elipsed, cut of). Might as well shorten them ourselves.

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

On Sun, Aug 10, 2014 at 2:07 PM, Nekhelesh Ramananthan <
<email address hidden>> wrote:

> Review: Needs Fixing
>
> Action {
> 86 + objectName: "hidepanelaction"
> 87 + iconName: "edit-clear"
> 88 + text: i18n.tr("Hide all key panels")
> 89 + onTriggered: pgTerm.showExtraPanel(0)
> 90 + },
>
> Shouldn't the clear button be shown only when a panel is shown? Otherwise
> it is a bit confusing what the button does where there are no panels open.
>

Indeed, I agree it's not optimal, I'm just thinking of a first cut. But the
alternative of having it conditionally visible might not be too optimal, as
it would make the second action in the header change. I'll give it a go.

>
> > and shows always the 2 first actions as an icon, and the rest grouped.
>
> The header by default shows a maximum of 3 icons. So due to that in your
> case it shows the first 2 icons and then the 3rd one in the list. I don't
> think (nor believe) that a public API will be provided to control this.
>

Indeed, I noticed this, which seems to be undocumented. However, some
existing core apps which use the deprecated 'tools' property (see Calendar,
Reminders) manage to have only the first item visible and then the others
grouped, so I was wondering why the behaviour was different with
header.actions.

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

On Sun, Aug 10, 2014 at 2:15 PM, Nekhelesh Ramananthan <
<email address hidden>> wrote:

> Review: Needs Fixing
>
> 93 + text: i18n.tr("Show control keys panel")
> 88 + text: i18n.tr("Hide all key panels")
> 103 + text: i18n.tr("Show arrow keys panel")
> 98 + text: i18n.tr("Show function keys panel")
>
> Why the additional strings? Feel like "Hide Panels", "Control Keys",
> "Arrow Keys", "Function Keys" should the job. Either way with the long
> description they will be truncated (elipsed, cut of). Might as well shorten
> them ourselves.
>

Thanks for the thorough review,btw!

I feel if it's an action it needs to tell the user exactly what the action
does. "Arrow keys" does not tell me anything until I click it, whereas I
will know exactly what "Show arrow keys panel" does and will be able to
decide if I want to click it or not, without surprises. In any case, the
shorter texts don't quite fit, either.

115. By David Planella

Made panels actions in the header conditionally visible, added icons to ensure the second action is visible

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

On Sun, Aug 10, 2014 at 2:13 PM, Nekhelesh Ramananthan <
<email address hidden>> wrote:

> As you said we could decide on the redesign of the panels in another
> panel, just jotting down my idea here. Ideally it would be nice to show,
>
> - Setting icon (visible always)

- Clear icon (conditionally visible)
>

Both done, thanks for the suggestion!

> - Panels Button to show popover for additional functions like the original
> implementation. This way it won't be grouped and also a popover seems like
> a good way to show this.
>

Not too sure about this one - in a way, we'd be overriding the default
behaviour of actionsby replacing them with a popup, just to work around the
bug whereby the space of the text in actions is limited. For now, I can
shorten the text.

116. By David Planella

Shortened action texts again to make them fit the available space

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
117. By David Planella

Fixed autopilot tests to click the header actions instead of those in the bottom toolbar

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

Ok, fixed the tests now to use header actions instead of toolbar actions, but it seems they don't manage to close the extra panels (or to detect they are closed, can't figure out which).

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
118. By David Planella

Fix autopilot tests

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
119. By David Planella

pep8 tests are ludicrous

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

There are several places where things could be improved as you mentioned. But for a first cut this is looking good. AP tests transition code looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/app/qml/Terminal.qml'
2--- src/app/qml/Terminal.qml 2014-04-27 09:11:14 +0000
3+++ src/app/qml/Terminal.qml 2014-08-10 16:58:23 +0000
4@@ -48,6 +48,36 @@
5 }
6 }
7
8+ // FIXME: there is probably a better way to do this.
9+ // For now, we're just keeping consistency with showExtraPanel()
10+ function isExtraPanelVisible(i) {
11+ var isPanelVisible = false;
12+
13+ switch (i) {
14+ case 1:
15+ isPanelVisible = kbCtrl.visible;
16+ break;
17+ case 2:
18+ isPanelVisible = kbFn.visible;
19+ break;
20+ case 3:
21+ isPanelVisible = kbScrl.visible;
22+ break;
23+ default:
24+ isPanelVisible = false;
25+ }
26+
27+ return isPanelVisible;
28+ }
29+
30+ function areExtraPanelsVisible() {
31+ if (kbCtrl.visible || kbFn.visible || kbScrl.visible) {
32+ return true;
33+ } else {
34+ return false;
35+ }
36+ }
37+
38 Component.onCompleted: {
39 pgConf.colorSchemes = kterm.availableColorSchemes();
40
41
42=== removed file 'src/app/qml/avatar@8.png'
43Binary files src/app/qml/avatar@8.png 2014-04-27 09:11:14 +0000 and src/app/qml/avatar@8.png 1970-01-01 00:00:00 +0000 differ
44=== removed file 'src/app/qml/settings.png'
45Binary files src/app/qml/settings.png 2014-04-27 09:11:14 +0000 and src/app/qml/settings.png 1970-01-01 00:00:00 +0000 differ
46=== modified file 'src/app/qml/ubuntu-terminal-app.qml'
47--- src/app/qml/ubuntu-terminal-app.qml 2014-08-07 01:22:55 +0000
48+++ src/app/qml/ubuntu-terminal-app.qml 2014-08-10 16:58:23 +0000
49@@ -1,5 +1,5 @@
50 import QtQuick 2.0
51-import Ubuntu.Components 0.1
52+import Ubuntu.Components 1.1
53 import Ubuntu.Components.Popups 0.1
54
55
56@@ -9,40 +9,11 @@
57 objectName: "terminal"
58 applicationName: "com.ubuntu.terminal"
59 automaticOrientation: true
60+ useDeprecatedToolbar: false
61
62 width: units.gu(50)
63 height: units.gu(75)
64
65- Component {
66- id: actionSelectionPopover
67-
68- ActionSelectionPopover {
69- objectName: "panelpopover"
70- actions: ActionList {
71- Action {
72- objectName: "controlkeysaction"
73- text: i18n.tr("Control keys")
74- onTriggered: pgTerm.showExtraPanel(1)
75- }
76- Action {
77- objectName: "functionkeysaction"
78- text: i18n.tr("Function keys")
79- onTriggered: pgTerm.showExtraPanel(2)
80- }
81- Action {
82- objectName: "textkeysaction"
83- text: i18n.tr("Arrow keys")
84- onTriggered: pgTerm.showExtraPanel(3)
85- }
86- Action {
87- objectName: "hidepanelaction"
88- text: i18n.tr("Hide extra panel")
89- onTriggered: pgTerm.showExtraPanel(0)
90- }
91- }
92- }
93- }
94-
95 PageStack {
96 id: pageStack
97
98@@ -70,26 +41,42 @@
99 objectName: "pgTerm"
100 }
101
102- tools: ToolbarItems {
103- ToolbarButton {
104- id: toolbarAction
105- objectName: "PanelsButton"
106- action: Action {
107- text: i18n.tr("Panels")
108- iconSource: Qt.resolvedUrl("avatar.png")
109- onTriggered: PopupUtils.open(actionSelectionPopover, toolbarAction)
110- }
111- }
112- ToolbarButton {
113- id: settingsButton
114+ head.actions: [
115+ Action {
116 objectName: "SettingsButton"
117- action: Action {
118- text: i18n.tr("Settings")
119- iconSource: Qt.resolvedUrl("settings.png")
120- onTriggered: pageStack.push(settingsPage)
121- }
122+ iconName: "settings"
123+ text: i18n.tr("Settings")
124+ onTriggered: pageStack.push(settingsPage)
125+ },
126+ Action {
127+ objectName: "hidepanelaction"
128+ iconName: "edit-clear"
129+ text: i18n.tr("Hide all key panels")
130+ visible: pgTerm.areExtraPanelsVisible()
131+ onTriggered: pgTerm.showExtraPanel(0)
132+ },
133+ Action {
134+ objectName: "controlkeysaction"
135+ iconName: "browser-tabs"
136+ text: i18n.tr("Control keys")
137+ visible: !pgTerm.isExtraPanelVisible(1)
138+ onTriggered: pgTerm.showExtraPanel(1)
139+ },
140+ Action {
141+ objectName: "functionkeysaction"
142+ iconName: "browser-tabs"
143+ text: i18n.tr("Function keys")
144+ visible: !pgTerm.isExtraPanelVisible(2)
145+ onTriggered: pgTerm.showExtraPanel(2)
146+ },
147+ Action {
148+ objectName: "textkeysaction"
149+ iconName: "browser-tabs"
150+ text: i18n.tr("Arrow keys")
151+ visible: !pgTerm.isExtraPanelVisible(3)
152+ onTriggered: pgTerm.showExtraPanel(3)
153 }
154- }
155+ ]
156 }
157
158 Page {
159
160=== modified file 'tests/autopilot/ubuntu_terminal_app/tests/test_terminal.py'
161--- tests/autopilot/ubuntu_terminal_app/tests/test_terminal.py 2014-07-18 10:37:26 +0000
162+++ tests/autopilot/ubuntu_terminal_app/tests/test_terminal.py 2014-08-10 16:58:23 +0000
163@@ -14,6 +14,7 @@
164 from autopilot.platform import model
165
166 from ubuntu_terminal_app.tests import TerminalTestCase, DbMan
167+from ubuntuuitoolkit import ToolkitException as ToolkitException
168
169 from time import sleep
170 import unittest
171@@ -32,19 +33,17 @@
172
173 def hide_panels(self):
174 """Click hide panels button"""
175- toolbar = self.main_view.open_toolbar()
176- timeout = 0
177- toolbar.click_button("PanelsButton")
178- panel_popover = self.main_view.get_panel_actions_popover()
179-
180- # we have to poll the complex action because
181- # we can't check the animation for the header
182- while panel_popover is None and timeout < 10:
183- toolbar.click_button("PanelsButton")
184- panel_popover = self.main_view.get_panel_actions_popover()
185- sleep(1)
186- timeout += 1
187- panel_popover.click_button("Hide extra panel")
188+ header = self.main_view.get_header()
189+ header.click_action_button('hidepanelaction')
190+ # Click on the button a second time in case that the
191+ # actions list was open and the first click just closed it
192+ # without further effect. If that was not the case, then
193+ # be prepared to catch the exception, as once clicked on,
194+ # the action to hide panels makes the button no longer visible
195+ try:
196+ header.click_action_button('hidepanelaction')
197+ except ToolkitException:
198+ pass
199
200 def click_item_selector_item(self, selector, value):
201 """Clicks item from item selector"""
202@@ -79,11 +78,8 @@
203 def test_control_panel(self):
204 """Make sure that Control Keys Panel is visible
205 when clicking the toolbar popup items and hides properly."""
206- toolbar = self.main_view.open_toolbar()
207- toolbar.click_button("PanelsButton")
208-
209- panel_popover = self.main_view.get_panel_actions_popover()
210- panel_popover.click_button("Control keys")
211+ header = self.main_view.get_header()
212+ header.click_action_button('controlkeysaction')
213
214 panelCtrl = lambda: self.main_view.get_control_panel().visible
215 self.assertThat(panelCtrl, Eventually(Equals(True)))
216@@ -93,11 +89,8 @@
217 def test_function_panel(self):
218 """Make sure that function Keys Panel is visible
219 when clicking the toolbar popup items and hides properly."""
220- toolbar = self.main_view.open_toolbar()
221- toolbar.click_button("PanelsButton")
222-
223- panel_popover = self.main_view.get_panel_actions_popover()
224- panel_popover.click_button("Function keys")
225+ header = self.main_view.get_header()
226+ header.click_action_button('functionkeysaction')
227
228 panelFunc = lambda: self.main_view.get_function_panel().visible
229 self.assertThat(panelFunc, Eventually(Equals(True)))
230@@ -107,11 +100,8 @@
231 def test_textctrl_panel(self):
232 """Make sure that Text Control Keys Panel is visible
233 when clicking the toolbar popup items and hides properly."""
234- toolbar = self.main_view.open_toolbar()
235- toolbar.click_button("PanelsButton")
236-
237- panel_popover = self.main_view.get_panel_actions_popover()
238- panel_popover.click_button("Arrow keys")
239+ header = self.main_view.get_header()
240+ header.click_action_button('textkeysaction')
241
242 panelScrl = lambda: self.main_view.get_scroll_panel().visible
243 self.assertThat(panelScrl, Eventually(Equals(True)))
244@@ -172,8 +162,8 @@
245
246 def test_font_size_changes(self):
247 """Make sure that font size is set correctly"""
248- toolbar = self.main_view.open_toolbar()
249- toolbar.click_button("SettingsButton")
250+ header = self.main_view.get_header()
251+ header.click_action_button('SettingsButton')
252
253 # change font size to max
254 self.main_view.drag_horizontal_slider("slFont", 32)

Subscribers

People subscribed via source and target branches