manabu-desktop 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,211 +2,334 @@
2
2
  <!-- Generated with glade 3.20.0 -->
3
3
  <interface>
4
4
  <requires lib="gtk+" version="3.20"/>
5
- <object class="GtkWindow" id="student_registration.window">
5
+ <object class="GtkImage" id="birth_date_picker.Image">
6
+ <property name="visible">True</property>
6
7
  <property name="can_focus">False</property>
8
+ <property name="stock">gtk-index</property>
9
+ </object>
10
+ <object class="GtkWindow" id="student_registration.Window">
11
+ <property name="can_focus">False</property>
12
+ <property name="default_width">720</property>
13
+ <property name="default_height">300</property>
7
14
  <child>
8
15
  <object class="GtkBox">
9
16
  <property name="visible">True</property>
10
17
  <property name="can_focus">False</property>
11
18
  <property name="orientation">vertical</property>
12
19
  <child>
13
- <object class="GtkGrid" id="name.grid">
20
+ <object class="GtkBox">
14
21
  <property name="visible">True</property>
15
22
  <property name="can_focus">False</property>
16
23
  <child>
17
- <object class="GtkLabel" id="surname.label">
18
- <property name="visible">True</property>
19
- <property name="can_focus">False</property>
20
- <property name="label" translatable="yes">surname</property>
21
- </object>
22
- <packing>
23
- <property name="left_attach">0</property>
24
- <property name="top_attach">0</property>
25
- </packing>
26
- </child>
27
- <child>
28
- <object class="GtkLabel" id="name.label">
29
- <property name="visible">True</property>
30
- <property name="can_focus">False</property>
31
- <property name="label" translatable="yes">name</property>
32
- </object>
33
- <packing>
34
- <property name="left_attach">1</property>
35
- <property name="top_attach">0</property>
36
- </packing>
37
- </child>
38
- <child>
39
- <object class="GtkLabel" id="middle_name.label">
40
- <property name="visible">True</property>
41
- <property name="can_focus">False</property>
42
- <property name="label" translatable="yes">middle_name</property>
43
- </object>
44
- <packing>
45
- <property name="left_attach">2</property>
46
- <property name="top_attach">0</property>
47
- </packing>
48
- </child>
49
- <child>
50
- <object class="GtkEntry" id="surname.entry">
51
- <property name="visible">True</property>
52
- <property name="can_focus">True</property>
53
- </object>
54
- <packing>
55
- <property name="left_attach">0</property>
56
- <property name="top_attach">1</property>
57
- </packing>
58
- </child>
59
- <child>
60
- <object class="GtkEntry" id="name.entry">
61
- <property name="visible">True</property>
62
- <property name="can_focus">True</property>
63
- </object>
64
- <packing>
65
- <property name="left_attach">1</property>
66
- <property name="top_attach">1</property>
67
- </packing>
68
- </child>
69
- <child>
70
- <object class="GtkEntry" id="middle_name.entry">
71
- <property name="visible">True</property>
72
- <property name="can_focus">True</property>
73
- </object>
74
- <packing>
75
- <property name="left_attach">2</property>
76
- <property name="top_attach">1</property>
77
- </packing>
78
- </child>
79
- <child>
80
- <object class="GtkLabel" id="surname_reading.label">
24
+ <object class="GtkBox">
81
25
  <property name="visible">True</property>
82
26
  <property name="can_focus">False</property>
83
- <property name="label" translatable="yes">surname_reading</property>
27
+ <property name="orientation">vertical</property>
28
+ <child>
29
+ <object class="GtkGrid" id="name.Grid">
30
+ <property name="visible">True</property>
31
+ <property name="can_focus">False</property>
32
+ <child>
33
+ <object class="GtkLabel" id="name.Label">
34
+ <property name="visible">True</property>
35
+ <property name="can_focus">False</property>
36
+ <property name="label" translatable="yes">name</property>
37
+ </object>
38
+ <packing>
39
+ <property name="left_attach">1</property>
40
+ <property name="top_attach">0</property>
41
+ </packing>
42
+ </child>
43
+ <child>
44
+ <object class="GtkLabel" id="middle_name.Label">
45
+ <property name="visible">True</property>
46
+ <property name="can_focus">False</property>
47
+ <property name="label" translatable="yes">middle_name</property>
48
+ </object>
49
+ <packing>
50
+ <property name="left_attach">2</property>
51
+ <property name="top_attach">0</property>
52
+ </packing>
53
+ </child>
54
+ <child>
55
+ <object class="GtkEntry" id="surname.Entry">
56
+ <property name="visible">True</property>
57
+ <property name="can_focus">True</property>
58
+ </object>
59
+ <packing>
60
+ <property name="left_attach">0</property>
61
+ <property name="top_attach">1</property>
62
+ </packing>
63
+ </child>
64
+ <child>
65
+ <object class="GtkEntry" id="name.Entry">
66
+ <property name="visible">True</property>
67
+ <property name="can_focus">True</property>
68
+ </object>
69
+ <packing>
70
+ <property name="left_attach">1</property>
71
+ <property name="top_attach">1</property>
72
+ </packing>
73
+ </child>
74
+ <child>
75
+ <object class="GtkEntry" id="middle_name.Entry">
76
+ <property name="visible">True</property>
77
+ <property name="can_focus">True</property>
78
+ </object>
79
+ <packing>
80
+ <property name="left_attach">2</property>
81
+ <property name="top_attach">1</property>
82
+ </packing>
83
+ </child>
84
+ <child>
85
+ <object class="GtkLabel" id="name_reading.Label">
86
+ <property name="visible">True</property>
87
+ <property name="can_focus">False</property>
88
+ <property name="label" translatable="yes">name_reading</property>
89
+ </object>
90
+ <packing>
91
+ <property name="left_attach">1</property>
92
+ <property name="top_attach">2</property>
93
+ </packing>
94
+ </child>
95
+ <child>
96
+ <object class="GtkLabel" id="middle_name_reading.Label">
97
+ <property name="visible">True</property>
98
+ <property name="can_focus">False</property>
99
+ <property name="label" translatable="yes">middle_name_reading</property>
100
+ </object>
101
+ <packing>
102
+ <property name="left_attach">2</property>
103
+ <property name="top_attach">2</property>
104
+ </packing>
105
+ </child>
106
+ <child>
107
+ <object class="GtkEntry" id="name_reading.Entry">
108
+ <property name="visible">True</property>
109
+ <property name="can_focus">True</property>
110
+ </object>
111
+ <packing>
112
+ <property name="left_attach">1</property>
113
+ <property name="top_attach">3</property>
114
+ </packing>
115
+ </child>
116
+ <child>
117
+ <object class="GtkEntry" id="middle_name_reading.Entry">
118
+ <property name="visible">True</property>
119
+ <property name="can_focus">True</property>
120
+ </object>
121
+ <packing>
122
+ <property name="left_attach">2</property>
123
+ <property name="top_attach">3</property>
124
+ </packing>
125
+ </child>
126
+ <child>
127
+ <object class="GtkLabel" id="surname.Label">
128
+ <property name="visible">True</property>
129
+ <property name="can_focus">False</property>
130
+ <property name="label" translatable="yes">surname</property>
131
+ </object>
132
+ <packing>
133
+ <property name="left_attach">0</property>
134
+ <property name="top_attach">0</property>
135
+ </packing>
136
+ </child>
137
+ <child>
138
+ <object class="GtkEntry" id="surname_reading.Entry">
139
+ <property name="visible">True</property>
140
+ <property name="can_focus">True</property>
141
+ </object>
142
+ <packing>
143
+ <property name="left_attach">0</property>
144
+ <property name="top_attach">3</property>
145
+ </packing>
146
+ </child>
147
+ <child>
148
+ <object class="GtkLabel" id="surname_reading.Label">
149
+ <property name="visible">True</property>
150
+ <property name="can_focus">False</property>
151
+ <property name="label" translatable="yes">surname_reading</property>
152
+ </object>
153
+ <packing>
154
+ <property name="left_attach">0</property>
155
+ <property name="top_attach">2</property>
156
+ </packing>
157
+ </child>
158
+ </object>
159
+ <packing>
160
+ <property name="expand">False</property>
161
+ <property name="fill">True</property>
162
+ <property name="position">0</property>
163
+ </packing>
164
+ </child>
165
+ <child>
166
+ <object class="GtkGrid" id="student_details.Grid">
167
+ <property name="visible">True</property>
168
+ <property name="can_focus">False</property>
169
+ <child>
170
+ <object class="GtkLabel" id="gender.Label">
171
+ <property name="visible">True</property>
172
+ <property name="can_focus">False</property>
173
+ <property name="label" translatable="yes">gender</property>
174
+ </object>
175
+ <packing>
176
+ <property name="left_attach">0</property>
177
+ <property name="top_attach">0</property>
178
+ </packing>
179
+ </child>
180
+ <child>
181
+ <object class="GtkLabel" id="birth_date.Label">
182
+ <property name="visible">True</property>
183
+ <property name="can_focus">False</property>
184
+ <property name="label" translatable="yes">birth_date</property>
185
+ </object>
186
+ <packing>
187
+ <property name="left_attach">1</property>
188
+ <property name="top_attach">0</property>
189
+ </packing>
190
+ </child>
191
+ <child>
192
+ <object class="GtkComboBoxText" id="gender.ComboBoxText">
193
+ <property name="visible">True</property>
194
+ <property name="can_focus">False</property>
195
+ </object>
196
+ <packing>
197
+ <property name="left_attach">0</property>
198
+ <property name="top_attach">1</property>
199
+ </packing>
200
+ </child>
201
+ <child>
202
+ <object class="GtkBox">
203
+ <property name="visible">True</property>
204
+ <property name="can_focus">False</property>
205
+ <child>
206
+ <object class="GtkEntry" id="birth_date.Entry">
207
+ <property name="visible">True</property>
208
+ <property name="can_focus">True</property>
209
+ </object>
210
+ <packing>
211
+ <property name="expand">False</property>
212
+ <property name="fill">True</property>
213
+ <property name="position">0</property>
214
+ </packing>
215
+ </child>
216
+ <child>
217
+ <object class="GtkToggleButton" id="birth_date_picker.ToggleButton">
218
+ <property name="visible">True</property>
219
+ <property name="can_focus">True</property>
220
+ <property name="receives_default">True</property>
221
+ <property name="image">birth_date_picker.Image</property>
222
+ <property name="image_position">right</property>
223
+ <property name="always_show_image">True</property>
224
+ </object>
225
+ <packing>
226
+ <property name="expand">False</property>
227
+ <property name="fill">True</property>
228
+ <property name="position">1</property>
229
+ </packing>
230
+ </child>
231
+ </object>
232
+ <packing>
233
+ <property name="left_attach">1</property>
234
+ <property name="top_attach">1</property>
235
+ </packing>
236
+ </child>
237
+ <child>
238
+ <object class="GtkLabel" id="enrollment_status.Label">
239
+ <property name="visible">True</property>
240
+ <property name="can_focus">False</property>
241
+ <property name="label" translatable="yes">enrollment_status</property>
242
+ </object>
243
+ <packing>
244
+ <property name="left_attach">2</property>
245
+ <property name="top_attach">0</property>
246
+ </packing>
247
+ </child>
248
+ <child>
249
+ <object class="GtkComboBoxText">
250
+ <property name="visible">True</property>
251
+ <property name="can_focus">False</property>
252
+ </object>
253
+ <packing>
254
+ <property name="left_attach">2</property>
255
+ <property name="top_attach">1</property>
256
+ </packing>
257
+ </child>
258
+ </object>
259
+ <packing>
260
+ <property name="expand">False</property>
261
+ <property name="fill">True</property>
262
+ <property name="position">1</property>
263
+ </packing>
264
+ </child>
265
+ <child>
266
+ <placeholder/>
267
+ </child>
84
268
  </object>
85
269
  <packing>
86
- <property name="left_attach">0</property>
87
- <property name="top_attach">2</property>
270
+ <property name="expand">False</property>
271
+ <property name="fill">True</property>
272
+ <property name="position">0</property>
88
273
  </packing>
89
274
  </child>
90
275
  <child>
91
- <object class="GtkLabel" id="name_reading.label">
276
+ <object class="GtkBox">
92
277
  <property name="visible">True</property>
93
278
  <property name="can_focus">False</property>
94
- <property name="label" translatable="yes">name_reading</property>
279
+ <property name="orientation">vertical</property>
280
+ <property name="baseline_position">bottom</property>
281
+ <child>
282
+ <object class="GtkImage" id="photo.Image">
283
+ <property name="visible">True</property>
284
+ <property name="can_focus">False</property>
285
+ <property name="stock">gtk-missing-image</property>
286
+ </object>
287
+ <packing>
288
+ <property name="expand">True</property>
289
+ <property name="fill">True</property>
290
+ <property name="position">0</property>
291
+ </packing>
292
+ </child>
293
+ <child>
294
+ <object class="GtkFileChooserButton" id="photo.FileChooserButton">
295
+ <property name="visible">True</property>
296
+ <property name="can_focus">False</property>
297
+ <property name="title" translatable="yes"/>
298
+ </object>
299
+ <packing>
300
+ <property name="expand">False</property>
301
+ <property name="fill">True</property>
302
+ <property name="position">1</property>
303
+ </packing>
304
+ </child>
95
305
  </object>
96
306
  <packing>
97
- <property name="left_attach">1</property>
98
- <property name="top_attach">2</property>
307
+ <property name="expand">True</property>
308
+ <property name="fill">True</property>
309
+ <property name="pack_type">end</property>
310
+ <property name="position">1</property>
99
311
  </packing>
100
312
  </child>
101
313
  <child>
102
- <object class="GtkLabel" id="middle_name_reading.label">
314
+ <object class="GtkSeparator">
103
315
  <property name="visible">True</property>
104
316
  <property name="can_focus">False</property>
105
- <property name="label" translatable="yes">middle_name_reading</property>
106
- </object>
107
- <packing>
108
- <property name="left_attach">2</property>
109
- <property name="top_attach">2</property>
110
- </packing>
111
- </child>
112
- <child>
113
- <object class="GtkEntry" id="surname_reading.entry">
114
- <property name="visible">True</property>
115
- <property name="can_focus">True</property>
116
- </object>
117
- <packing>
118
- <property name="left_attach">0</property>
119
- <property name="top_attach">3</property>
120
- </packing>
121
- </child>
122
- <child>
123
- <object class="GtkEntry" id="name_reading.entry">
124
- <property name="visible">True</property>
125
- <property name="can_focus">True</property>
126
- </object>
127
- <packing>
128
- <property name="left_attach">1</property>
129
- <property name="top_attach">3</property>
130
- </packing>
131
- </child>
132
- <child>
133
- <object class="GtkEntry" id="middle_name_reading.entry">
134
- <property name="visible">True</property>
135
- <property name="can_focus">True</property>
136
317
  </object>
137
318
  <packing>
138
- <property name="left_attach">2</property>
139
- <property name="top_attach">3</property>
319
+ <property name="expand">False</property>
320
+ <property name="fill">True</property>
321
+ <property name="position">2</property>
140
322
  </packing>
141
323
  </child>
142
324
  </object>
143
325
  <packing>
144
- <property name="expand">False</property>
326
+ <property name="expand">True</property>
145
327
  <property name="fill">True</property>
146
328
  <property name="position">0</property>
147
329
  </packing>
148
330
  </child>
149
331
  <child>
150
- <object class="GtkGrid" id="student_details.grid">
151
- <property name="visible">True</property>
152
- <property name="can_focus">False</property>
153
- <child>
154
- <object class="GtkLabel" id="sex.label">
155
- <property name="visible">True</property>
156
- <property name="can_focus">False</property>
157
- <property name="label" translatable="yes">sex</property>
158
- </object>
159
- <packing>
160
- <property name="left_attach">0</property>
161
- <property name="top_attach">0</property>
162
- </packing>
163
- </child>
164
- <child>
165
- <object class="GtkLabel" id="birth_date.label">
166
- <property name="visible">True</property>
167
- <property name="can_focus">False</property>
168
- <property name="label" translatable="yes">birth_date</property>
169
- </object>
170
- <packing>
171
- <property name="left_attach">1</property>
172
- <property name="top_attach">0</property>
173
- </packing>
174
- </child>
175
- <child>
176
- <object class="GtkEntry" id="birth_date.entry">
177
- <property name="visible">True</property>
178
- <property name="can_focus">True</property>
179
- </object>
180
- <packing>
181
- <property name="left_attach">1</property>
182
- <property name="top_attach">1</property>
183
- </packing>
184
- </child>
185
- <child>
186
- <object class="GtkComboBoxText" id="sex.comboboxtext">
187
- <property name="visible">True</property>
188
- <property name="can_focus">False</property>
189
- </object>
190
- <packing>
191
- <property name="left_attach">0</property>
192
- <property name="top_attach">1</property>
193
- </packing>
194
- </child>
195
- <child>
196
- <placeholder/>
197
- </child>
198
- <child>
199
- <placeholder/>
200
- </child>
201
- </object>
202
- <packing>
203
- <property name="expand">False</property>
204
- <property name="fill">True</property>
205
- <property name="position">1</property>
206
- </packing>
207
- </child>
208
- <child>
209
- <object class="GtkButton" id="register.button">
332
+ <object class="GtkButton" id="register.Button">
210
333
  <property name="label" translatable="yes">register</property>
211
334
  <property name="visible">True</property>
212
335
  <property name="can_focus">True</property>
@@ -221,4 +344,20 @@
221
344
  </object>
222
345
  </child>
223
346
  </object>
347
+ <object class="GtkPopover" id="birth_date_picker.Popover">
348
+ <property name="can_focus">False</property>
349
+ <property name="relative_to">birth_date_picker.ToggleButton</property>
350
+ <property name="position">bottom</property>
351
+ <child>
352
+ <object class="GtkCalendar" id="birth_date_picker.Calendar">
353
+ <property name="visible">True</property>
354
+ <property name="can_focus">True</property>
355
+ <property name="year">1999</property>
356
+ </object>
357
+ </child>
358
+ </object>
359
+ <object class="GtkMenu" id="menu1">
360
+ <property name="visible">True</property>
361
+ <property name="can_focus">False</property>
362
+ </object>
224
363
  </interface>
@@ -2,10 +2,10 @@
2
2
  <!-- Generated with glade 3.20.0 -->
3
3
  <interface>
4
4
  <requires lib="gtk+" version="3.20"/>
5
- <object class="GtkWindow" id="toolbox.window">
5
+ <object class="GtkWindow" id="toolbox.Window">
6
6
  <property name="can_focus">False</property>
7
7
  <child>
8
- <object class="GtkIconView" id="tools.icons">
8
+ <object class="GtkIconView" id="tools.IconView">
9
9
  <property name="visible">True</property>
10
10
  <property name="can_focus">True</property>
11
11
  <property name="margin">6</property>
data/lib/screens/base.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require_relative '../tools'
2
+ require_relative '../windows'
2
3
  require 'gtk3'
3
4
 
4
5
  module ManabuDesktop
@@ -6,6 +7,9 @@ module ManabuDesktop
6
7
  class Base
7
8
  attr_accessor :window, :builder
8
9
 
10
+ @@gtk_initialized = false
11
+ @@gtk_main_quit_set = false
12
+
9
13
  def initialize(layout, locale = :c)
10
14
  @builder = Gtk::Builder.new()
11
15
  @builder.add_from_file("#{__dir__}/../../layouts/#{layout}.glade")
@@ -19,16 +23,24 @@ module ManabuDesktop
19
23
  end
20
24
  end
21
25
 
22
- @window = builder.get_object("#{layout}.window")
23
- @window.signal_connect('delete-event') do |_widget|
24
- @window.destroy()
25
- Gtk.main_quit()
26
+ @window = builder.get_object("#{layout}.Window")
27
+ @window.set_title(I18n.t("#{layout}.title"))
28
+ unless @@gtk_main_quit_set
29
+ @window.signal_connect('delete-event') do |_widget|
30
+ #@window.destroy()
31
+ ManabuDesktop::Windows.destroy_all()
32
+ Gtk.main_quit()
33
+ end
34
+ @@gtk_main_quit_set = true
26
35
  end
27
36
  end
28
37
 
29
38
  def _show()
30
39
  @window.show()
31
- Gtk.main()
40
+ unless @@gtk_initialized
41
+ Gtk.main()
42
+ @@gtk_initialized = true
43
+ end
32
44
  end
33
45
  end
34
46
  end
data/lib/screens/login.rb CHANGED
@@ -18,28 +18,28 @@ module ManabuDesktop
18
18
 
19
19
  @window.resizable = false
20
20
 
21
- @builder.get_object('server.label').set_label(I18n.t('login.server'))
22
- @builder.get_object('secure.label').set_label(I18n.t('login.secure'))
23
- @server_comboboxtext = @builder.get_object('server.comboboxtext')
24
- @server_secure_switch = @builder.get_object('secure.switch')
25
- @cache_info[:servers].each{ |server| @server_comboboxtext.append_text(server[:addr])}
21
+ @builder.get_object('server.Label').set_label(I18n.t('login.server'))
22
+ @builder.get_object('secure.Label').set_label(I18n.t('login.secure'))
23
+ @server_comboBoxText = @builder.get_object('server.ComboBoxText')
24
+ @server_secure_switch = @builder.get_object('secure.Switch')
25
+ @cache_info[:servers].each{ |server| @server_comboBoxText.append_text(server[:addr])}
26
26
  if (@cache_info[:servers].length > 0)
27
- @server_comboboxtext.set_active(0)
27
+ @server_comboBoxText.set_active(0)
28
28
  @server_secure_switch.active = @cache_info[:servers][0][:secure]
29
29
  end
30
30
  # TODO: set server details when selection is changed
31
31
  # TODO: allow deletion of a server entry
32
32
  # TODO: save new servers
33
33
 
34
- @builder.get_object('user.label').set_label(I18n.t('login.user'))
35
- @user_entry = @builder.get_object('user.entry')
36
- @builder.get_object('password.label').set_label(I18n.t('login.password'))
37
- @password_entry = @builder.get_object('password.entry')
34
+ @builder.get_object('user.Label').set_label(I18n.t('login.user'))
35
+ @user_entry = @builder.get_object('user.Entry')
36
+ @builder.get_object('password.Label').set_label(I18n.t('login.password'))
37
+ @password_entry = @builder.get_object('password.Entry')
38
38
 
39
- engage_button = @builder.get_object('engage.button')
39
+ engage_button = @builder.get_object('engage.Button')
40
40
  engage_button.set_label(I18n.t('login.engage'))
41
41
  engage_button.signal_connect('clicked') {
42
- _engage(@server_comboboxtext.active_text, @server_secure_switch.active?,
42
+ _engage(@server_comboBoxText.active_text, @server_secure_switch.active?,
43
43
  @user_entry.text, @password_entry.text)
44
44
  }
45
45
 
@@ -65,9 +65,12 @@ module ManabuDesktop
65
65
  port = /[^:]\d[^\D]*/.match(server).to_s.to_i # port part
66
66
  port = 80 if (port == 0)
67
67
  route = /\/.*$/.match(server) #route part
68
+
69
+ # TODO: first check if a session is already open to this server/port/user
68
70
  @client = Manabu::Client.new(user, password, "#{addr}#{route}", port,
69
71
  force_secure_connection: secure)
70
72
  if @client.status == :connected
73
+ ManabuDesktop::Sessions.add_session(@client)
71
74
  _open_toolbox(@client)
72
75
  end
73
76
  end