etti 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,405 @@
1
+ #encoding: UTF-8
2
+
3
+
4
+ module Etti
5
+ class PageLayout < Gtk::Box
6
+ include GetText
7
+ GetText.bindtextdomain 'etti', :path => Etti::LOCALE_PATH
8
+
9
+ LABELS_H = 3
10
+ LABELS_V = 3
11
+ LABEL_PADDING = 24.0
12
+ def initialize pageDatas
13
+ super(:vertical)
14
+ @pageDatas = pageDatas
15
+ @entryChanged = false
16
+ self.border_width = 0
17
+ @pageSizes = ['a4']
18
+ @entries = {}
19
+ @boxes = []
20
+ @lcNumeric = I18nToolbox::LcNumeric.new
21
+
22
+ @dimensionData = {:borderTop =>
23
+ {:pos => [2, 3, 0, 1],
24
+ :label => _('top border'),
25
+ :tooltip => _('The distance from the label to the top leaf margin'),
26
+ :range => 0.0..50.0},
27
+ :borderLeft =>
28
+ {:pos => [0, 1, 2, 3],
29
+ :label => _('left border'),
30
+ :tooltip => _('The distance from the label to the left leaf margin'),
31
+ :range => 0.0..50.0},
32
+ :height =>
33
+ {:pos => [2, 3, 1, 2],
34
+ :label => _('label height'),
35
+ :tooltip => _('The height of a single label'),
36
+ :range => 3.0..500.0},
37
+ :width =>
38
+ {:pos => [1, 2, 2, 3],
39
+ :label => _('label width'),
40
+ :tooltip => _('The width of a single label'),
41
+ :range => 3.0..500.0},
42
+ :paddingH =>
43
+ {:pos => [2,3, 3, 4],
44
+ :label => _('horizontal distance'),
45
+ :tooltip => _('The horizontal distance between the labels'),
46
+ :range => 0.0..20.0},
47
+ :paddingV =>
48
+ {:pos => [3, 4, 2, 3],
49
+ :label => _('vertical distance'),
50
+ :tooltip => _('The vertical distance between the labels'),
51
+ :range => 0.0..20.0}
52
+ }
53
+
54
+ @descriptionData = {:manufacture =>
55
+ {:label => _('manufacturer'),
56
+ :tooltip => _('Manufacturer of the label')},
57
+ :orderNr =>
58
+ {:label => _('order number'),
59
+ :tooltip => _('The manufacturers order number')},
60
+ :description =>
61
+ {:label => _('description'),
62
+ :tooltip => _('An aditional description for the label')},
63
+ :pageSize =>
64
+ {:label => _('page size'),
65
+ :tooltip => _('The size of the sheet, i.e. "a4"')}
66
+ }
67
+
68
+
69
+ @sizeGroup = Gtk::SizeGroup.new :both
70
+ widget = make_entry :name, _('Name'), _("The name of the label\nIt has to be unique")
71
+
72
+ @saveButton = Gtk::Button.new :stock_id => Gtk::Stock::SAVE
73
+ @saveButton.tooltip_text = _('Save the changes of the label sheet')
74
+ @saveButton.signal_connect(:clicked) {on_save}
75
+ widget.pack_end @saveButton, :expand => false, :fill => false, :padding => 32
76
+ self.pack_start widget, :expand => false, :fill => false, :padding => 12
77
+
78
+
79
+ # create the dimension entries
80
+ @table = Gtk::Table.new 4, 4, true
81
+ hbox = Gtk::Box.new :horizontal
82
+ hbox.pack_start @table, :expand => false, :fill => false
83
+ self.pack_start hbox, :expand => false, :fill => false
84
+
85
+ @dimensionData.each_pair do |key, val|
86
+ box = Gtk::Box.new :vertical
87
+ @boxes << box
88
+
89
+ @table.attach box, *val[:pos], 0, 0, LABEL_PADDING, LABEL_PADDING
90
+
91
+ box.pack_start Gtk::Label.new(val[:label]), :expand => false, :fill => false
92
+
93
+ entry = Rgw::RestrictedEntry.new
94
+ entry.restriction = :float
95
+ entry.range = val[:range]
96
+ @entries[key] = entry
97
+ entry.name = key
98
+ box.pack_start entry, :expand => false, :fill => false
99
+
100
+ entry.set_max_length 7
101
+ entry.width_chars = 8
102
+
103
+ entry.tooltip_text = val[:tooltip]
104
+ entry.editable = true
105
+
106
+ entry.signal_connect(:changed) {|entry| on_entry_changed entry}
107
+ end
108
+
109
+
110
+ # create the page size combo box
111
+ val = @descriptionData[:pageSize]
112
+ cbox = Gtk::Box.new :horizontal
113
+ self.pack_start cbox, :expand => false, :fill => false
114
+ label = Gtk::Label.new.set_markup(_("<b>%s</b>: " % val[:label]))
115
+ label.xalign = 0.0
116
+ cbox.pack_start label, :expand => false, :fill => false, :padding => 6
117
+ @sizeGroup.add_widget label
118
+ @pageSizeCombo = Gtk::ComboBoxText.new
119
+ cbox.pack_start @pageSizeCombo, :expand => false, :fill => false, :padding => 4
120
+ @pageSizes.each do |pz|
121
+ @pageSizeCombo.append_text pz
122
+ end
123
+ @pageSizeCombo.signal_connect(:changed) do
124
+ @pageData[:pageSize] = @pageSizes[@pageSizeCombo.active]
125
+ end
126
+
127
+ # create the page description entries
128
+ [:manufacture, :orderNr, :description].each do |key|
129
+ val = @descriptionData[key]
130
+ widget = make_entry key, val[:label], val[:tooltip]
131
+ self.pack_start widget, :expand => false, :fill => false, :padding => 4
132
+ end
133
+ signal_connect(:map) {on_map}
134
+ signal_connect(:draw) do |widget|
135
+ draw_bg
136
+ false
137
+ end
138
+ signal_connect_after(:draw) {on_draw}
139
+ end
140
+ attr_reader :entryChanged
141
+
142
+
143
+ def update_page_data pageData
144
+ @pageData = pageData
145
+ [:name, :manufacture, :orderNr, :description, :pageSize,
146
+ :cols, :rows, :size, :borders, :padding].each do |key|
147
+ case key
148
+ when :name, :manufacture, :orderNr, :description
149
+ @entries[key].text = @pageData[key] #.instance_variable_get '@' + key.to_s
150
+ when :borders
151
+ left, top = *@pageData[key]
152
+ @entries[:borderTop].text = @lcNumeric.to_s top
153
+ @entries[:borderLeft].text = @lcNumeric.to_s left
154
+ when :padding
155
+ h, v = *@pageData[key]
156
+ @entries[:paddingH].text = @lcNumeric.to_s h
157
+ @entries[:paddingV].text = @lcNumeric.to_s v
158
+ when :size
159
+ w, h = *@pageData[key]
160
+ @entries[:width].text = @lcNumeric.to_s w
161
+ @entries[:height].text = @lcNumeric.to_s h
162
+ when :pageSize
163
+ @pageSizeCombo.active = @pageSizes.index @pageData[:pageSize]
164
+ end
165
+ end
166
+ @saveButton.sensitive = false
167
+ @entryChanged = false
168
+ end
169
+
170
+
171
+ def save
172
+ on_save
173
+ end
174
+
175
+ private
176
+ def make_entry id, label, tooltip, head=nil
177
+ hbox = Gtk::Box.new :horizontal
178
+
179
+ label = Gtk::Label.new.set_markup("<b>#{label}</b>: ")
180
+ hbox.pack_start label, :expand => false, :fill => false, :padding => 6
181
+ @sizeGroup.add_widget label
182
+ label.xalign = 0.0
183
+
184
+ entry = Rgw::RestrictedEntry.new
185
+ entry.range = id == :name ? 1..250 : 0..250
186
+ entry.name = id
187
+ @entries[id] = entry
188
+ hbox.pack_start entry, :expand => false, :fill => false
189
+ entry.tooltip_text = tooltip
190
+ entry.signal_connect(:changed) {|entry| on_entry_changed entry}
191
+ hbox
192
+ end
193
+
194
+
195
+ def on_entry_changed entry
196
+ return if @pageData.nil?
197
+ key = entry.name.to_sym
198
+ text = @entries[key].text
199
+ return if text.nil?
200
+ @entryChanged = true
201
+ @saveButton.sensitive = true
202
+ val = @lcNumeric.to_f text
203
+
204
+ case key
205
+ when :name, :manufacture, :orderNr, :description
206
+ @pageData[key] = text
207
+ when :paddingH
208
+ @pageData[:padding][0] = val
209
+ when :paddingV
210
+ @pageData[:padding][1] = val
211
+ when :borderLeft
212
+ @pageData[:borders][0] = val
213
+ when :borderTop
214
+ @pageData[:borders][1] = val
215
+ when :width
216
+ @pageData[:size][0] = val
217
+ when :height
218
+ @pageData[:size][1] = val
219
+ end
220
+ end
221
+
222
+
223
+ def on_save
224
+ @entries.each do |entry|
225
+ if entry[1].text.nil?
226
+ message = _('Some of the entries are invalid.')
227
+ dialog = Etti::MessageDialog.new self.toplevel, :buttons => [:close],
228
+ :type => :info, :message => message,
229
+ :title => _('Invalid Entries')
230
+ dialog.run
231
+ return
232
+ end
233
+ end
234
+ @pageDatas.save_page_data(@pageData) do |type, answers, message|
235
+ if answers == :yes_no
236
+ dialog = Etti::MessageDialog.new self.toplevel, :buttons => [:yes, :no],
237
+ :type => :info, :message => message
238
+ dialog.run
239
+ end
240
+ end
241
+ end
242
+
243
+
244
+ def draw_bg
245
+ box_allocation = @table.allocation
246
+ bx = box_allocation.x
247
+ by = box_allocation.y
248
+ bw = box_allocation.width
249
+ bh = box_allocation.height
250
+
251
+ @cc = @table.window.create_cairo_context
252
+
253
+ @cc.set_source_rgb *$colors.bg
254
+ @cc.paint
255
+ @cc.set_source_rgb 1.0, 1.0, 1.0
256
+ @cc.rectangle bx + 8, by + 8, bw - 12, bh - 12
257
+ @cc.fill.stroke
258
+ end
259
+
260
+
261
+ def on_map
262
+ @boxW = 0
263
+ @boxH = 0
264
+ @boxes.each do |box|
265
+ allo = box.allocation
266
+ @boxW = allo.width if allo.width > @boxW
267
+ @boxH = allo.height if allo.height > @boxH
268
+ end
269
+ end
270
+
271
+
272
+ def on_draw
273
+ box_allocation = @boxes.first.allocation
274
+
275
+ bw = box_allocation.width
276
+ bh = box_allocation.height
277
+
278
+
279
+ bw = @boxW
280
+ bh = @boxH
281
+
282
+ @cc = @table.window.create_cairo_context
283
+ # we don't have an own window
284
+ @cc.translate(@table.allocation.x, @table.allocation.y)
285
+ @cc.antialias = :none
286
+
287
+ # border
288
+ @cc.set_source_rgb 0.5, 0.5, 0.5
289
+ @cc.line_width = 2.0
290
+
291
+ @cc.move_to (bw + LABEL_PADDING * 2.0) * (LABELS_H + 1), 8
292
+ @cc.line_to 8, 8
293
+ @cc.line_to 8, (bh + LABEL_PADDING * 2.0) * (LABELS_V + 1)
294
+ @cc.stroke
295
+
296
+
297
+ @cc.set_source_rgb 0.4, 0.4, 0.9
298
+ @cc.line_width = 1.0
299
+
300
+ 1.upto(LABELS_V) do |y|
301
+ 1.upto(LABELS_H) do |x|
302
+
303
+ @cc.rectangle (bw + LABEL_PADDING * 2.0) * x,
304
+ (bh + LABEL_PADDING * 2.0) * y,
305
+ bw + LABEL_PADDING * 1.5,
306
+ bh + LABEL_PADDING * 1.5
307
+ @cc.stroke
308
+ end
309
+ end
310
+
311
+ # border arrows
312
+ draw_arrow :h, 8, (bh + LABEL_PADDING * 2.0) * 2.0 + 24, bw + LABEL_PADDING * 2.0 - 8
313
+ draw_arrow :v, (bw + LABEL_PADDING * 2.0) * 2.0 + 24, 8, bh + LABEL_PADDING * 2.0 - 8
314
+ # cell arrows
315
+ draw_arrow :h, (bw + LABEL_PADDING * 2.0), (bh + LABEL_PADDING * 2.0) * 2.0 + 24.0,
316
+ bw + LABEL_PADDING * 1.5
317
+ draw_arrow :v, (bw + LABEL_PADDING * 2.0) * 2.0 + 24, bh + LABEL_PADDING * 2.0, bh + LABEL_PADDING * 1.5
318
+
319
+ # padding arrows
320
+ draw_arrow :h, (bw + LABEL_PADDING * 2.0) * 2.0 - LABEL_PADDING * 0.5,
321
+ (bh + LABEL_PADDING * 2.0) * 3.0 + 24, LABEL_PADDING * 0.5, true
322
+ draw_arrow :v, (bw + LABEL_PADDING * 2.0) * 3.0 + 24,
323
+ (bh + LABEL_PADDING * 2.0) * 2.0 - LABEL_PADDING * 0.5, LABEL_PADDING * 0.5, true
324
+ end
325
+
326
+
327
+ ARROW_SIZE = 8.0
328
+ def draw_arrow dir, x, y, lg, out=false
329
+ @cc.set_source_rgb 0.2, 0.2, 0.2
330
+ @cc.line_width = 1.0
331
+ unless out
332
+ if dir == :h
333
+ @cc.antialias = :none
334
+ @cc.move_to x, y
335
+ @cc.line_to x + lg, y
336
+ @cc.stroke
337
+
338
+ @cc.antialias = :subpixel
339
+ @cc.move_to x, y
340
+ @cc.line_to x + ARROW_SIZE, y - (ARROW_SIZE / 4.0)
341
+ @cc.line_to x + ARROW_SIZE, y + (ARROW_SIZE / 4.0)
342
+ @cc.fill.stroke
343
+
344
+ @cc.move_to x + lg, y
345
+ @cc.line_to x + lg - ARROW_SIZE, y - (ARROW_SIZE / 4.0)
346
+ @cc.line_to x + lg - ARROW_SIZE, y + (ARROW_SIZE / 4.0)
347
+ @cc.fill.stroke
348
+
349
+ else
350
+ @cc.antialias = :none
351
+ @cc.move_to x, y
352
+ @cc.line_to x, y + lg
353
+ @cc.stroke
354
+
355
+ @cc.antialias = :subpixel
356
+ @cc.move_to x, y
357
+ @cc.line_to x - (ARROW_SIZE / 4.0), y + ARROW_SIZE
358
+ @cc.line_to x + (ARROW_SIZE / 4.0), y + ARROW_SIZE
359
+ @cc.fill.stroke
360
+
361
+ @cc.move_to x, y + lg
362
+ @cc.line_to x - (ARROW_SIZE / 4.0), y + lg - ARROW_SIZE
363
+ @cc.line_to x + (ARROW_SIZE / 4.0), y + lg - ARROW_SIZE
364
+ @cc.fill.stroke
365
+ end
366
+ else
367
+ if dir == :h
368
+ @cc.antialias = :none
369
+ @cc.move_to x - ARROW_SIZE * 2.0, y
370
+ @cc.line_to x + lg + ARROW_SIZE * 8.0, y
371
+ @cc.stroke
372
+
373
+ @cc.antialias = :subpixel
374
+ @cc.move_to x, y
375
+ @cc.line_to x - ARROW_SIZE, y - (ARROW_SIZE / 4.0)
376
+ @cc.line_to x - ARROW_SIZE, y + (ARROW_SIZE / 4.0)
377
+ @cc.fill.stroke
378
+
379
+ @cc.move_to x + lg, y
380
+ @cc.line_to x + lg + ARROW_SIZE, y - (ARROW_SIZE / 4.0)
381
+ @cc.line_to x + lg + ARROW_SIZE, y + (ARROW_SIZE / 4.0)
382
+ @cc.fill.stroke
383
+
384
+ else
385
+ @cc.antialias = :none
386
+ @cc.move_to x, y - ARROW_SIZE * 2.0
387
+ @cc.line_to x, y + lg + ARROW_SIZE * 8.0
388
+ @cc.stroke
389
+
390
+ @cc.antialias = :subpixel
391
+ @cc.move_to x, y
392
+ @cc.line_to x - (ARROW_SIZE / 4.0), y - ARROW_SIZE
393
+ @cc.line_to x + (ARROW_SIZE / 4.0), y - ARROW_SIZE
394
+ @cc.fill.stroke
395
+
396
+ @cc.move_to x, y + lg
397
+ @cc.line_to x - (ARROW_SIZE / 4.0), y + lg + ARROW_SIZE
398
+ @cc.line_to x + (ARROW_SIZE / 4.0), y + lg + ARROW_SIZE
399
+ @cc.fill.stroke
400
+ end
401
+ end
402
+ end
403
+ end
404
+ end
405
+
@@ -0,0 +1,92 @@
1
+ # encoding: UTF-8
2
+
3
+ # all dimensions are in milimeters!
4
+
5
+
6
+ module Etti
7
+ module PropertyEditorData
8
+ include GetText
9
+ GetText.bindtextdomain 'etti', :path => Etti::LOCALE_PATH
10
+
11
+ DEFAULT_TEXTS_TEXT = ''
12
+ DEFAULT_TEXTS_POS_X = 0.0
13
+ DEFAULT_TEXTS_POS_Y = 0.0
14
+ DEFAULT_TEXTS_SIZE = 4.0
15
+ DEFAULT_TEXTS_ROTATION = 0.0
16
+ DEFAUTL_TEXTS_COLOR = [0.0, 0.0, 0.0, 1.0]
17
+
18
+ TEXTS_PROPS = [
19
+ {label: _('text'), type: :entry, useDefault: false,
20
+ id0: 'text', default0: DEFAULT_TEXTS_TEXT},
21
+
22
+ {label: _('position'), type: :sSpin, useDefault: false,
23
+ id0: 'pos_x', id1: 'pos_y', range: -1000.0..1000.0, step: 0.05,
24
+ default0: DEFAULT_TEXTS_POS_X, default1: DEFAULT_TEXTS_POS_Y, synced: false},
25
+
26
+ {label: _('size'), type: :spin, useDefault: false,
27
+ id0: 'size', range: 0.1..100.0, step: 0.05,
28
+ default0: DEFAULT_TEXTS_SIZE},
29
+
30
+ {label: _('rotation'), type: :spin, useDefault: true,
31
+ id0: 'rotation', range: 0.0..360.0, step: 1.0,
32
+ default0: DEFAULT_TEXTS_ROTATION}
33
+ ]
34
+
35
+
36
+ DEFAULT_DATA_SHOW_AS = 0
37
+ DEFAULT_QR_WIDTH = 10
38
+ DEFAULT_QR_HEIGHT = 10
39
+ DEFAULT_QR_VERSION = 1
40
+ DEFAULT_QR_ERROR_CORRECTION = 1
41
+ DEFAULT_QR_ENCODING = 3
42
+
43
+ DATA_PROPS = [
44
+ {label: _('position'), type: :sSpin, useDefault: false,
45
+ id0: 'pos_x', id1: 'pos_y', range: -1000.0..1000.0, step: 0.05,
46
+ default0: DEFAULT_TEXTS_POS_X, default1: DEFAULT_TEXTS_POS_Y, synced: false},
47
+
48
+ {label: _('rotation'), type: :spin, useDefault: true,
49
+ id0: 'rotation', range: 0.0..360.0, step: 1.0,
50
+ default0: DEFAULT_TEXTS_ROTATION},
51
+
52
+ {label: _('color'), type: :color, useDefault: true,
53
+ id0: 'color', default0: DEFAUTL_TEXTS_COLOR},
54
+
55
+ {label: _('show as'), type: :radioRevealer,
56
+ id0: 'showAs', default0: DEFAULT_DATA_SHOW_AS,
57
+ revealSections: [
58
+
59
+ {section: 'text',
60
+ data: [
61
+ {label: _('size'), type: :spin, useDefault: false,
62
+ id0: 'size', range: 0.1..100.0, step: 0.05,
63
+ default0: DEFAULT_TEXTS_SIZE}
64
+ ]},
65
+
66
+ {section: 'QR-Code',
67
+ data: [
68
+ {label: _('display size'), type: :sSpin, useDefault: false,
69
+ id0: 'qrWidth', id1: 'qrHeight', range: 1.0..1000.0, step: 0.1,
70
+ default0: DEFAULT_QR_WIDTH, default1: DEFAULT_QR_HEIGHT, synced: true},
71
+
72
+ {label: _('version'), type: :spin, useDefault: false,
73
+ id0: 'qrVersion', range: 1..40, step: 1, default0: DEFAULT_QR_VERSION},
74
+
75
+ {label: _('correction'), type: :combo, useDefault: true,
76
+ id0: 'qrErrorCorrection', default0: DEFAULT_QR_ERROR_CORRECTION,
77
+ entries: ['low', 'medium', 'quarter', 'high']},
78
+
79
+ {label: _('encoding'), type: :combo, useDefault: true,
80
+ id0: 'qrEncoding', default0: DEFAULT_QR_ENCODING,
81
+ entries: ['automatic', 'numeric', 'alphanumeric', 'ascii', 'kanji']}
82
+ ]
83
+ }
84
+ ]
85
+ }
86
+ ]
87
+
88
+
89
+ # this is a dummy entry if no element is selected
90
+ NONE_PROPS = []
91
+ end
92
+ end
@@ -0,0 +1,117 @@
1
+ #encoding: UTF-8
2
+
3
+ module Etti
4
+ class Window < Gtk::Window
5
+ include GetText
6
+ GetText.bindtextdomain 'etti', :path => Etti::LOCALE_PATH
7
+
8
+ def initialize
9
+ super()
10
+ signal_connect(:delete_event) {on_quit false}
11
+ signal_connect(:destroy) {on_quit true}
12
+ signal_connect_after(:draw) {paint_logo}
13
+ self.border_width = 3
14
+ self.title = 'Etti'
15
+ set_default_size 1200, 900
16
+ self.icon = Etti::PIXMAP_PATH + 'win-logo.png'
17
+
18
+ @logoPixbuf = Gdk::Pixbuf.new Etti::PIXMAP_PATH + 'logo.png'
19
+
20
+ @accelGroup = Gtk::AccelGroup.new
21
+ add_accel_group @accelGroup
22
+
23
+ create_data_page
24
+ create_label_selection_page
25
+ create_label_layout_page
26
+ create_about_page
27
+
28
+ @labelSelectionPage.signal_connect(:page_changed) do |widget, pageData|
29
+ @labelLayoutPage.update_page_data pageData
30
+ end
31
+ @labelLayoutPage.update_page_data @labelSelectionPage.pageData
32
+
33
+ @notebook = Gtk::Notebook.new
34
+ add @notebook
35
+ notebook_append_page @dataPage, _("<b> Data \n Input </b>")
36
+ notebook_append_page @labelSelectionPage, _("<b> Label \n Selection </b>")
37
+ notebook_append_page @labelLayoutPage, _("<b> Label \n Formatting </b>")
38
+ notebook_append_page @aboutPage, _("<b> About Etti </b>")
39
+
40
+ end
41
+ attr_reader :dataPage, :labelLayoutPage, :labelSelectionPage
42
+
43
+
44
+ def notebook_append_page page, label
45
+ ali = Gtk::Alignment.new 0, 0, 1, 1
46
+ ali.set_padding 8, 8, 8, 8
47
+ ali.add page
48
+ @notebook.append_page ali, Gtk::Label.new.set_markup(label)
49
+
50
+ pg = @notebook.n_pages
51
+ return if pg > 9
52
+ @accelGroup.connect(Gdk::Keyval.from_name(pg.to_s), :mod1_mask, :visible) {@notebook.page = pg - 1}
53
+ @accelGroup.connect(Gdk::Keyval.from_name('KP_' + pg.to_s), :mod1_mask, :visible) {@notebook.page = pg - 1}
54
+ end
55
+
56
+
57
+ def create_data_page
58
+ @dataPage = Etti::DataPage.new
59
+ @dataPage.signal_connect(:data_changed) {|widget, head, data| @labelLayoutPage.set_element_data head, data}
60
+ end
61
+
62
+
63
+ def create_label_selection_page
64
+ @labelSelectionPage = Etti::LabelSelectionPage.new
65
+ end
66
+
67
+
68
+ def create_label_layout_page
69
+ @labelLayoutPage = Etti::LabelLayoutPage.new
70
+ end
71
+
72
+
73
+ def create_about_page
74
+ @aboutPage = Gtk::Box.new :vertical
75
+ img = Gtk::Image.new :pixbuf => @logoPixbuf
76
+ @aboutPage.pack_start img, :expand => false, :fill => false, :padding => 36
77
+
78
+ label = Gtk::Label.new
79
+ @aboutPage.pack_start label, :expand => false, :fill => false, :padding => 6
80
+ label.selectable = true
81
+ label.can_focus = false
82
+ label.markup = _("Copyright © 2014 Detlef Reichl detlef!reichl()gmx!org\n\n\n" +
83
+
84
+ "QR Code is a registered trademark of DENSO WAVE INCORPORATED.\n\n") +
85
+
86
+ "This program is free software; you can redistribute it and/or modify\n" +
87
+ "it under the terms of the GNU General Public License as published by\n" +
88
+ "the Free Software Foundation; either version 2 of the License, or\n" +
89
+ "(at your option) any later version.\n\n" +
90
+
91
+ "This program is distributed in the hope that it will be useful,\n" +
92
+ "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" +
93
+ "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" +
94
+ "GNU General Public License for more details.\n\n" +
95
+
96
+ "You should have received a copy of the GNU General Public License along\n" +
97
+ "with this program; if not, write to the Free Software Foundation, Inc.,\n" +
98
+ "51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA."
99
+ end
100
+
101
+
102
+ def on_quit destroy
103
+ # @project.save_project
104
+ Gtk.main_quit
105
+ end
106
+
107
+
108
+ def paint_logo
109
+ return if self.window.nil?
110
+ cc = window.create_cairo_context
111
+ cc.set_source_pixbuf @logoPixbuf, allocation.width - 70, 12
112
+ cc.paint
113
+ false
114
+
115
+ end
116
+ end
117
+ end
@@ -0,0 +1,3 @@
1
+ module Etti
2
+ VERSION = [0, 3, 0]
3
+ end
data/lib/etti.rb ADDED
@@ -0,0 +1,45 @@
1
+ module Etti
2
+ DATA_PATH = File.expand_path(File.dirname(__FILE__) + '/../lib/data') + '/'
3
+ PIXMAP_PATH = DATA_PATH + 'pixmaps/'
4
+ LOCALE_PATH = DATA_PATH + 'locale/'
5
+ end
6
+
7
+
8
+ require 'fileutils'
9
+ require 'cairo'
10
+ require 'gettext'
11
+ require 'gtk3'
12
+ require 'json'
13
+ require 'qrencoder'
14
+ require 'filemagic'
15
+
16
+ require 'rgw/big-list'
17
+ require 'rgw/property-editor'
18
+ require 'rgw/radio-revealer'
19
+ require 'rgw/restricted-entry'
20
+
21
+ #require 'etti/config'
22
+ require 'etti/colors'
23
+ require 'etti/dnd-data'
24
+ require 'etti/page-datas'
25
+ require 'etti/print-view'
26
+
27
+ require 'etti/monkeys/array'
28
+ require 'etti/monkeys/cairo-context'
29
+ require 'etti/monkeys/gtk-event-box'
30
+
31
+ require 'etti/elements/base'
32
+ require 'etti/elements/text'
33
+ require 'etti/elements/data'
34
+
35
+ require 'etti/file/data-reader'
36
+
37
+ require 'etti/ui/data-page'
38
+ require 'etti/ui/label-elements'
39
+ require 'etti/ui/label-layout'
40
+ require 'etti/ui/label-layout-page'
41
+ require 'etti/ui/label-selection-page'
42
+ require 'etti/ui/message-dialog'
43
+ require 'etti/ui/page-layout'
44
+ require 'etti/ui/property-editor-data'
45
+ require 'etti/ui/window'