tangsalesparser 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/bin/Alert.rb ADDED
@@ -0,0 +1,16 @@
1
+ class Alert
2
+
3
+ include GladeGUI
4
+
5
+ def initialize(parent, message)
6
+ @parent = parent
7
+ load_glade(__FILE__)
8
+ @builder['label_message'].set_label(message)
9
+ show_window()
10
+ end
11
+
12
+ def button_close__clicked(*args)
13
+ destroy_window()
14
+ end
15
+
16
+ end
data/bin/App.rb ADDED
@@ -0,0 +1,78 @@
1
+ class App
2
+
3
+ include GladeGUI
4
+
5
+ attr_accessor :input_file_path, :output_file_path
6
+
7
+ def show()
8
+ load_glade(__FILE__)
9
+ set_glade_all()
10
+ show_window()
11
+ end
12
+
13
+ def button_start__clicked(*args)
14
+ # Check if input file exists
15
+ if file_exists?(@builder['entry_input_path'].text) then
16
+ # Check to see if config file exists, if not create a blank one
17
+ if !file_exists?('./config.txt') then
18
+ create_config_file
19
+ end
20
+ # Process the file using TangSalesParser and write output
21
+ input_file_path = @builder['entry_input_path'].text
22
+ output_file_path = @builder['entry_output_path'].text
23
+ tc = TangSalesParser.new
24
+ tc.process(input_file_path, output_file_path)
25
+ alert("Success. Your file is at: #{output_file_path}")
26
+ else
27
+ alert("ERROR: The data file you specified does not exist.")
28
+ end
29
+ end
30
+
31
+ def create_config_file
32
+ file = File.open('./config.txt', 'w')
33
+ file.write("")
34
+ file.close
35
+ end
36
+
37
+ def alert(msg)
38
+ modal_win = Alert.new(self, msg)
39
+ end
40
+
41
+ def file_exists?(file_path)
42
+ File.exist?(file_path)
43
+ end
44
+
45
+ def button_edit_config__clicked(*args)
46
+ modal_win = ConfigEditor.new(self)
47
+ end
48
+
49
+ def button_input_location__clicked(*args)
50
+ modal_win = InputDialog.new(self)
51
+ modal_win.show(self)
52
+ @builder['entry_input_path'].text = @input_file_path
53
+ allow_start?
54
+ end
55
+
56
+ def button_output_location__clicked(*args)
57
+ modal_win = OutputDialog.new(self)
58
+ modal_win.show(self)
59
+ @builder['entry_output_path'].text = @output_file_path
60
+ allow_start?
61
+ end
62
+
63
+ def entry_output_path__changed(*args)
64
+ allow_start?
65
+ end
66
+
67
+ def entry_input_path__changed(*args)
68
+ allow_start?
69
+ end
70
+
71
+ def allow_start?
72
+ if @builder['entry_input_path'].text != "" && @builder['entry_output_path'].text != "" then
73
+ @builder['button_start'].sensitive = true
74
+ else
75
+ @builder['button_start'].sensitive = false
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,34 @@
1
+ class ConfigEditor
2
+
3
+ include GladeGUI
4
+
5
+ def initialize(parent)
6
+ @config_file = "./config.txt"
7
+
8
+ @parent = parent
9
+ load_glade(__FILE__)
10
+ load_config_file
11
+ show_window()
12
+ end
13
+
14
+ def load_config_file
15
+ text_buffer = @builder['textview_config'].buffer
16
+ file = File.open(@config_file, 'r')
17
+ text_buffer.text = file.read
18
+ file.close
19
+ end
20
+
21
+ def button_save__clicked(*args)
22
+ data = @builder['textview_config'].buffer.text
23
+ data.gsub!(/^$\n/,"") #remove blank lines
24
+ file = File.open('./config.txt','w')
25
+ file.write(data)
26
+ file.close
27
+ destroy_window()
28
+ end
29
+
30
+ def button_cancel__clicked(*args)
31
+ destroy_window()
32
+ end
33
+
34
+ end
@@ -0,0 +1,23 @@
1
+ class InputDialog
2
+
3
+ include GladeGUI
4
+
5
+ def initialize(parent)
6
+ @parent = parent
7
+ end
8
+
9
+ def show(parent)
10
+ load_glade(__FILE__)
11
+ show_window()
12
+ end
13
+
14
+ def button_open__clicked(*args)
15
+ @parent.input_file_path = @builder['filechooserwidget_input'].filename
16
+ destroy_window()
17
+ end
18
+
19
+ def button_cancel__clicked(*args)
20
+ destroy_window()
21
+ end
22
+
23
+ end
@@ -0,0 +1,23 @@
1
+ class OutputDialog
2
+
3
+ include GladeGUI
4
+
5
+ def initialize(parent)
6
+ @parent = parent
7
+ end
8
+
9
+ def show(parent)
10
+ load_glade(__FILE__)
11
+ show_window()
12
+ end
13
+
14
+ def button_save__clicked(*args)
15
+ @parent.output_file_path = @builder['filechooserwidget_output'].filename
16
+ destroy_window()
17
+ end
18
+
19
+ def button_cancel__clicked(*args)
20
+ destroy_window()
21
+ end
22
+
23
+ end
data/bin/TangConfig.rb ADDED
@@ -0,0 +1,33 @@
1
+ class TangConfig
2
+
3
+ attr_accessor :string, :num_commas, :location
4
+
5
+ def initialize(location = 'after', string = "", num_commas = 0)
6
+ self.location = location
7
+ self.string = string
8
+ self.num_commas = num_commas
9
+ end
10
+
11
+ def num_commas=(val)
12
+ if val.is_a? String
13
+ val = val.strip
14
+ end
15
+ @num_commas = val.to_i
16
+ end
17
+
18
+ def string=(val)
19
+ @string = val.strip.gsub("_", " ")
20
+ end
21
+
22
+ def location=(val)
23
+ @location = val.strip
24
+ end
25
+
26
+ def to_s
27
+ "location = #{@location}, string = #{@string}, num_commas = #{@num_commas}"
28
+ end
29
+
30
+ def ==(other)
31
+ self.location == other.location && self.string == other.string && self.num_commas == other.num_commas
32
+ end
33
+ end
@@ -0,0 +1,83 @@
1
+ class TangSalesParser
2
+
3
+ attr_accessor :data, :configs
4
+
5
+ def initialize
6
+ @configs = []
7
+ end
8
+
9
+ def process(input_file_path, output_file_path)
10
+ self.read_file(input_file_path)
11
+ self.clear_commas
12
+ self.compress_spaces
13
+ self.split_numbers
14
+ self.fix_percentage_symbol
15
+ self.read_configs
16
+ self.run_configs
17
+ self.collapse_spaces_following_comma #run this at the very end of the process only
18
+ self.write_file(output_file_path)
19
+ end
20
+
21
+ def read_file(file_path)
22
+ file = File.open(file_path, 'r')
23
+ @data = file.read
24
+ end
25
+
26
+ def count(substring)
27
+ @data.scan(substring).length
28
+ end
29
+
30
+ def clear_commas
31
+ @data.gsub!(/,/,"")
32
+ end
33
+
34
+ def compress_spaces
35
+ @data.squeeze!(" ")
36
+ end
37
+
38
+ def collapse_spaces_following_comma
39
+ @data.gsub!(/, +/, ",")
40
+ end
41
+
42
+ def read_configs
43
+ file = File.open("./config.txt", 'r')
44
+ file.each do |line|
45
+ values = line.split(",")
46
+ config = TangConfig.new
47
+ config.location = values[0]
48
+ config.string = values[1]
49
+ config.num_commas = values[2]
50
+ @configs << config
51
+ end
52
+ file.close
53
+ end
54
+
55
+ def run_configs
56
+ @configs.each do |config|
57
+ replacement = ""
58
+ if config.location == 'after' then
59
+ replacement = config.string + "," * config.num_commas
60
+ elsif config.location == 'before' then
61
+ replacement = ","*config.num_commas + config.string
62
+ end
63
+
64
+ s = '(?<![A-Za-z])' + config.string + '(?![A-Za-z0-9%])'
65
+ regex = Regexp.new s
66
+ @data.gsub!(regex, replacement)
67
+ end
68
+ end
69
+
70
+ def fix_percentage_symbol
71
+ @data.gsub!(/ +%/, "%")
72
+ end
73
+
74
+ def split_numbers
75
+ @data.gsub!(/(?<![\/\:\-\d[A-Za-z]])[-+]?[0-9]*\.?[0-9]+(?![\d\:\/\-]|( or)|( and))/,'\0,')
76
+ end
77
+
78
+ def write_file(file_path)
79
+ file = File.open(file_path, 'w')
80
+ file.write(@data)
81
+ file.close
82
+ end
83
+ end
@@ -0,0 +1,72 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <interface>
3
+ <requires lib="gtk+" version="2.16"/>
4
+ <!-- interface-naming-policy project-wide -->
5
+ <object class="GtkWindow" id="window1">
6
+ <property name="visible">True</property>
7
+ <property name="can_focus">False</property>
8
+ <property name="title" translatable="yes">Alert</property>
9
+ <property name="resizable">False</property>
10
+ <property name="modal">True</property>
11
+ <property name="window_position">center</property>
12
+ <signal name="destroy" handler="destroy_window" swapped="no"/>
13
+ <child>
14
+ <object class="GtkHBox" id="hbox1">
15
+ <property name="visible">True</property>
16
+ <property name="can_focus">False</property>
17
+ <child>
18
+ <object class="GtkVBox" id="vbox1">
19
+ <property name="visible">True</property>
20
+ <property name="can_focus">False</property>
21
+ <child>
22
+ <object class="GtkLabel" id="label_message">
23
+ <property name="visible">True</property>
24
+ <property name="can_focus">False</property>
25
+ <property name="label" translatable="yes">default message</property>
26
+ <property name="justify">center</property>
27
+ <property name="wrap">True</property>
28
+ </object>
29
+ <packing>
30
+ <property name="expand">True</property>
31
+ <property name="fill">True</property>
32
+ <property name="padding">20</property>
33
+ <property name="position">0</property>
34
+ </packing>
35
+ </child>
36
+ <child>
37
+ <object class="GtkHButtonBox" id="hbuttonbox1">
38
+ <property name="visible">True</property>
39
+ <property name="can_focus">False</property>
40
+ <child>
41
+ <object class="GtkButton" id="button_close">
42
+ <property name="label" translatable="yes">Close</property>
43
+ <property name="visible">True</property>
44
+ <property name="can_focus">True</property>
45
+ <property name="receives_default">True</property>
46
+ </object>
47
+ <packing>
48
+ <property name="expand">False</property>
49
+ <property name="fill">False</property>
50
+ <property name="position">0</property>
51
+ </packing>
52
+ </child>
53
+ </object>
54
+ <packing>
55
+ <property name="expand">False</property>
56
+ <property name="fill">False</property>
57
+ <property name="padding">10</property>
58
+ <property name="position">1</property>
59
+ </packing>
60
+ </child>
61
+ </object>
62
+ <packing>
63
+ <property name="expand">True</property>
64
+ <property name="fill">True</property>
65
+ <property name="padding">20</property>
66
+ <property name="position">0</property>
67
+ </packing>
68
+ </child>
69
+ </object>
70
+ </child>
71
+ </object>
72
+ </interface>
@@ -0,0 +1,205 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <interface>
3
+ <requires lib="gtk+" version="2.16"/>
4
+ <!-- interface-naming-policy project-wide -->
5
+ <object class="GtkWindow" id="window1">
6
+ <property name="visible">True</property>
7
+ <property name="can_focus">False</property>
8
+ <property name="title" translatable="yes">Tang's Sales Parser</property>
9
+ <property name="resizable">False</property>
10
+ <property name="modal">True</property>
11
+ <property name="window_position">center</property>
12
+ <property name="default_width">600</property>
13
+ <signal name="destroy" handler="destroy_window" swapped="no"/>
14
+ <child>
15
+ <object class="GtkVBox" id="vbox1">
16
+ <property name="width_request">500</property>
17
+ <property name="visible">True</property>
18
+ <property name="can_focus">False</property>
19
+ <property name="spacing">1</property>
20
+ <child>
21
+ <object class="GtkHBox" id="hbox1">
22
+ <property name="visible">True</property>
23
+ <property name="can_focus">False</property>
24
+ <child>
25
+ <object class="GtkVBox" id="vbox2">
26
+ <property name="visible">True</property>
27
+ <property name="can_focus">False</property>
28
+ <property name="spacing">20</property>
29
+ <child>
30
+ <object class="GtkHBox" id="hbox3">
31
+ <property name="visible">True</property>
32
+ <property name="can_focus">False</property>
33
+ <child>
34
+ <object class="GtkButton" id="button_input_location">
35
+ <property name="label" translatable="yes">...</property>
36
+ <property name="visible">True</property>
37
+ <property name="can_focus">True</property>
38
+ <property name="receives_default">True</property>
39
+ </object>
40
+ <packing>
41
+ <property name="expand">False</property>
42
+ <property name="fill">False</property>
43
+ <property name="padding">10</property>
44
+ <property name="pack_type">end</property>
45
+ <property name="position">0</property>
46
+ </packing>
47
+ </child>
48
+ <child>
49
+ <object class="GtkEntry" id="entry_input_path">
50
+ <property name="visible">True</property>
51
+ <property name="can_focus">True</property>
52
+ <property name="invisible_char">•</property>
53
+ <property name="primary_icon_activatable">False</property>
54
+ <property name="secondary_icon_activatable">False</property>
55
+ <property name="primary_icon_sensitive">True</property>
56
+ <property name="secondary_icon_sensitive">True</property>
57
+ </object>
58
+ <packing>
59
+ <property name="expand">True</property>
60
+ <property name="fill">True</property>
61
+ <property name="pack_type">end</property>
62
+ <property name="position">1</property>
63
+ </packing>
64
+ </child>
65
+ <child>
66
+ <object class="GtkLabel" id="label_data">
67
+ <property name="width_request">75</property>
68
+ <property name="visible">True</property>
69
+ <property name="can_focus">False</property>
70
+ <property name="label" translatable="yes">Data:</property>
71
+ </object>
72
+ <packing>
73
+ <property name="expand">False</property>
74
+ <property name="fill">False</property>
75
+ <property name="padding">10</property>
76
+ <property name="pack_type">end</property>
77
+ <property name="position">2</property>
78
+ </packing>
79
+ </child>
80
+ </object>
81
+ <packing>
82
+ <property name="expand">False</property>
83
+ <property name="fill">False</property>
84
+ <property name="position">0</property>
85
+ </packing>
86
+ </child>
87
+ <child>
88
+ <object class="GtkHBox" id="hbox2">
89
+ <property name="visible">True</property>
90
+ <property name="can_focus">False</property>
91
+ <child>
92
+ <object class="GtkButton" id="button_output_location">
93
+ <property name="label" translatable="yes">...</property>
94
+ <property name="visible">True</property>
95
+ <property name="can_focus">True</property>
96
+ <property name="receives_default">True</property>
97
+ </object>
98
+ <packing>
99
+ <property name="expand">False</property>
100
+ <property name="fill">False</property>
101
+ <property name="padding">10</property>
102
+ <property name="pack_type">end</property>
103
+ <property name="position">0</property>
104
+ </packing>
105
+ </child>
106
+ <child>
107
+ <object class="GtkEntry" id="entry_output_path">
108
+ <property name="visible">True</property>
109
+ <property name="can_focus">True</property>
110
+ <property name="invisible_char">•</property>
111
+ <property name="primary_icon_activatable">False</property>
112
+ <property name="secondary_icon_activatable">False</property>
113
+ <property name="primary_icon_sensitive">True</property>
114
+ <property name="secondary_icon_sensitive">True</property>
115
+ </object>
116
+ <packing>
117
+ <property name="expand">True</property>
118
+ <property name="fill">True</property>
119
+ <property name="pack_type">end</property>
120
+ <property name="position">1</property>
121
+ </packing>
122
+ </child>
123
+ <child>
124
+ <object class="GtkLabel" id="label_output">
125
+ <property name="width_request">75</property>
126
+ <property name="visible">True</property>
127
+ <property name="can_focus">False</property>
128
+ <property name="label" translatable="yes">Output:</property>
129
+ </object>
130
+ <packing>
131
+ <property name="expand">False</property>
132
+ <property name="fill">False</property>
133
+ <property name="padding">10</property>
134
+ <property name="pack_type">end</property>
135
+ <property name="position">2</property>
136
+ </packing>
137
+ </child>
138
+ </object>
139
+ <packing>
140
+ <property name="expand">False</property>
141
+ <property name="fill">False</property>
142
+ <property name="position">1</property>
143
+ </packing>
144
+ </child>
145
+ <child>
146
+ <object class="GtkHButtonBox" id="hbuttonbox1">
147
+ <property name="visible">True</property>
148
+ <property name="can_focus">False</property>
149
+ <property name="homogeneous">True</property>
150
+ <property name="layout_style">spread</property>
151
+ <child>
152
+ <object class="GtkButton" id="button_edit_config">
153
+ <property name="label" translatable="yes">Edit Configuration</property>
154
+ <property name="visible">True</property>
155
+ <property name="can_focus">True</property>
156
+ <property name="receives_default">True</property>
157
+ </object>
158
+ <packing>
159
+ <property name="expand">False</property>
160
+ <property name="fill">False</property>
161
+ <property name="position">0</property>
162
+ </packing>
163
+ </child>
164
+ <child>
165
+ <object class="GtkButton" id="button_start">
166
+ <property name="label" translatable="yes">Start</property>
167
+ <property name="visible">True</property>
168
+ <property name="sensitive">False</property>
169
+ <property name="can_focus">True</property>
170
+ <property name="receives_default">True</property>
171
+ </object>
172
+ <packing>
173
+ <property name="expand">False</property>
174
+ <property name="fill">False</property>
175
+ <property name="position">1</property>
176
+ </packing>
177
+ </child>
178
+ </object>
179
+ <packing>
180
+ <property name="expand">True</property>
181
+ <property name="fill">False</property>
182
+ <property name="padding">10</property>
183
+ <property name="position">2</property>
184
+ </packing>
185
+ </child>
186
+ </object>
187
+ <packing>
188
+ <property name="expand">True</property>
189
+ <property name="fill">True</property>
190
+ <property name="padding">20</property>
191
+ <property name="position">0</property>
192
+ </packing>
193
+ </child>
194
+ </object>
195
+ <packing>
196
+ <property name="expand">True</property>
197
+ <property name="fill">True</property>
198
+ <property name="padding">10</property>
199
+ <property name="position">0</property>
200
+ </packing>
201
+ </child>
202
+ </object>
203
+ </child>
204
+ </object>
205
+ </interface>
@@ -0,0 +1,92 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <interface>
3
+ <requires lib="gtk+" version="2.16"/>
4
+ <!-- interface-naming-policy project-wide -->
5
+ <object class="GtkWindow" id="window1">
6
+ <property name="visible">True</property>
7
+ <property name="can_focus">False</property>
8
+ <property name="title" translatable="yes">Config Editor</property>
9
+ <property name="modal">True</property>
10
+ <property name="window_position">center</property>
11
+ <property name="default_width">700</property>
12
+ <property name="default_height">400</property>
13
+ <signal name="destroy" handler="destroy_window" swapped="no"/>
14
+ <child>
15
+ <object class="GtkHBox" id="hbox1">
16
+ <property name="visible">True</property>
17
+ <property name="can_focus">False</property>
18
+ <child>
19
+ <object class="GtkVBox" id="vbox1">
20
+ <property name="visible">True</property>
21
+ <property name="can_focus">False</property>
22
+ <child>
23
+ <object class="GtkScrolledWindow" id="scrolledwindow1">
24
+ <property name="visible">True</property>
25
+ <property name="can_focus">True</property>
26
+ <property name="hscrollbar_policy">automatic</property>
27
+ <property name="vscrollbar_policy">automatic</property>
28
+ <child>
29
+ <object class="GtkTextView" id="textview_config">
30
+ <property name="visible">True</property>
31
+ <property name="can_focus">True</property>
32
+ </object>
33
+ </child>
34
+ </object>
35
+ <packing>
36
+ <property name="expand">True</property>
37
+ <property name="fill">True</property>
38
+ <property name="padding">10</property>
39
+ <property name="position">0</property>
40
+ </packing>
41
+ </child>
42
+ <child>
43
+ <object class="GtkHButtonBox" id="hbuttonbox1">
44
+ <property name="visible">True</property>
45
+ <property name="can_focus">False</property>
46
+ <property name="layout_style">spread</property>
47
+ <child>
48
+ <object class="GtkButton" id="button_save">
49
+ <property name="label" translatable="yes">Save</property>
50
+ <property name="visible">True</property>
51
+ <property name="can_focus">True</property>
52
+ <property name="receives_default">True</property>
53
+ </object>
54
+ <packing>
55
+ <property name="expand">False</property>
56
+ <property name="fill">False</property>
57
+ <property name="position">0</property>
58
+ </packing>
59
+ </child>
60
+ <child>
61
+ <object class="GtkButton" id="button_cancel">
62
+ <property name="label" translatable="yes">Cancel</property>
63
+ <property name="visible">True</property>
64
+ <property name="can_focus">True</property>
65
+ <property name="receives_default">True</property>
66
+ </object>
67
+ <packing>
68
+ <property name="expand">False</property>
69
+ <property name="fill">False</property>
70
+ <property name="position">1</property>
71
+ </packing>
72
+ </child>
73
+ </object>
74
+ <packing>
75
+ <property name="expand">False</property>
76
+ <property name="fill">False</property>
77
+ <property name="padding">10</property>
78
+ <property name="position">1</property>
79
+ </packing>
80
+ </child>
81
+ </object>
82
+ <packing>
83
+ <property name="expand">True</property>
84
+ <property name="fill">True</property>
85
+ <property name="padding">8</property>
86
+ <property name="position">0</property>
87
+ </packing>
88
+ </child>
89
+ </object>
90
+ </child>
91
+ </object>
92
+ </interface>
@@ -0,0 +1,86 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <interface>
3
+ <requires lib="gtk+" version="2.16"/>
4
+ <!-- interface-naming-policy project-wide -->
5
+ <object class="GtkWindow" id="window1">
6
+ <property name="visible">True</property>
7
+ <property name="can_focus">False</property>
8
+ <property name="title" translatable="yes">Select Data File</property>
9
+ <property name="modal">True</property>
10
+ <property name="window_position">center</property>
11
+ <property name="default_width">700</property>
12
+ <signal name="destroy" handler="destroy_window" swapped="no"/>
13
+ <child>
14
+ <object class="GtkHBox" id="hbox1">
15
+ <property name="height_request">500</property>
16
+ <property name="visible">True</property>
17
+ <property name="can_focus">False</property>
18
+ <property name="spacing">10</property>
19
+ <child>
20
+ <object class="GtkVBox" id="vbox1">
21
+ <property name="visible">True</property>
22
+ <property name="can_focus">False</property>
23
+ <child>
24
+ <object class="GtkFileChooserWidget" id="filechooserwidget_input">
25
+ <property name="visible">True</property>
26
+ <property name="can_focus">False</property>
27
+ <property name="orientation">vertical</property>
28
+ </object>
29
+ <packing>
30
+ <property name="expand">True</property>
31
+ <property name="fill">True</property>
32
+ <property name="position">0</property>
33
+ </packing>
34
+ </child>
35
+ <child>
36
+ <object class="GtkHButtonBox" id="hbuttonbox1">
37
+ <property name="visible">True</property>
38
+ <property name="can_focus">False</property>
39
+ <property name="layout_style">spread</property>
40
+ <child>
41
+ <object class="GtkButton" id="button_open">
42
+ <property name="label" translatable="yes">Open</property>
43
+ <property name="visible">True</property>
44
+ <property name="can_focus">True</property>
45
+ <property name="receives_default">True</property>
46
+ </object>
47
+ <packing>
48
+ <property name="expand">False</property>
49
+ <property name="fill">False</property>
50
+ <property name="position">0</property>
51
+ </packing>
52
+ </child>
53
+ <child>
54
+ <object class="GtkButton" id="button_cancel">
55
+ <property name="label" translatable="yes">Cancel</property>
56
+ <property name="visible">True</property>
57
+ <property name="can_focus">True</property>
58
+ <property name="receives_default">True</property>
59
+ </object>
60
+ <packing>
61
+ <property name="expand">False</property>
62
+ <property name="fill">False</property>
63
+ <property name="position">1</property>
64
+ </packing>
65
+ </child>
66
+ </object>
67
+ <packing>
68
+ <property name="expand">False</property>
69
+ <property name="fill">False</property>
70
+ <property name="padding">10</property>
71
+ <property name="pack_type">end</property>
72
+ <property name="position">1</property>
73
+ </packing>
74
+ </child>
75
+ </object>
76
+ <packing>
77
+ <property name="expand">True</property>
78
+ <property name="fill">True</property>
79
+ <property name="padding">10</property>
80
+ <property name="position">0</property>
81
+ </packing>
82
+ </child>
83
+ </object>
84
+ </child>
85
+ </object>
86
+ </interface>
@@ -0,0 +1,89 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <interface>
3
+ <requires lib="gtk+" version="2.16"/>
4
+ <!-- interface-naming-policy project-wide -->
5
+ <object class="GtkWindow" id="window1">
6
+ <property name="visible">True</property>
7
+ <property name="can_focus">False</property>
8
+ <property name="title" translatable="yes">Output Location</property>
9
+ <property name="modal">True</property>
10
+ <property name="window_position">center</property>
11
+ <property name="default_width">700</property>
12
+ <signal name="destroy" handler="destroy_window" swapped="no"/>
13
+ <child>
14
+ <object class="GtkHBox" id="hbox1">
15
+ <property name="visible">True</property>
16
+ <property name="can_focus">False</property>
17
+ <child>
18
+ <object class="GtkVBox" id="vbox1">
19
+ <property name="height_request">500</property>
20
+ <property name="visible">True</property>
21
+ <property name="can_focus">False</property>
22
+ <property name="spacing">10</property>
23
+ <child>
24
+ <object class="GtkFileChooserWidget" id="filechooserwidget_output">
25
+ <property name="visible">True</property>
26
+ <property name="can_focus">False</property>
27
+ <property name="orientation">vertical</property>
28
+ <property name="spacing">10</property>
29
+ <property name="action">save</property>
30
+ </object>
31
+ <packing>
32
+ <property name="expand">True</property>
33
+ <property name="fill">True</property>
34
+ <property name="padding">10</property>
35
+ <property name="position">0</property>
36
+ </packing>
37
+ </child>
38
+ <child>
39
+ <object class="GtkHButtonBox" id="hbuttonbox1">
40
+ <property name="visible">True</property>
41
+ <property name="can_focus">False</property>
42
+ <property name="spacing">10</property>
43
+ <property name="layout_style">spread</property>
44
+ <child>
45
+ <object class="GtkButton" id="button_save">
46
+ <property name="label" translatable="yes">Save</property>
47
+ <property name="visible">True</property>
48
+ <property name="can_focus">True</property>
49
+ <property name="receives_default">True</property>
50
+ </object>
51
+ <packing>
52
+ <property name="expand">False</property>
53
+ <property name="fill">False</property>
54
+ <property name="position">0</property>
55
+ </packing>
56
+ </child>
57
+ <child>
58
+ <object class="GtkButton" id="button_cancel">
59
+ <property name="label" translatable="yes">Cancel</property>
60
+ <property name="visible">True</property>
61
+ <property name="can_focus">True</property>
62
+ <property name="receives_default">True</property>
63
+ </object>
64
+ <packing>
65
+ <property name="expand">False</property>
66
+ <property name="fill">False</property>
67
+ <property name="position">1</property>
68
+ </packing>
69
+ </child>
70
+ </object>
71
+ <packing>
72
+ <property name="expand">False</property>
73
+ <property name="fill">False</property>
74
+ <property name="padding">10</property>
75
+ <property name="position">1</property>
76
+ </packing>
77
+ </child>
78
+ </object>
79
+ <packing>
80
+ <property name="expand">True</property>
81
+ <property name="fill">True</property>
82
+ <property name="padding">10</property>
83
+ <property name="position">0</property>
84
+ </packing>
85
+ </child>
86
+ </object>
87
+ </child>
88
+ </object>
89
+ </interface>
@@ -0,0 +1,66 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <interface>
3
+ <requires lib="gtk+" version="2.24"/>
4
+ <!-- interface-naming-policy project-wide -->
5
+ <object class="GtkFileChooserDialog" id="filechooserdialog1">
6
+ <property name="can_focus">False</property>
7
+ <property name="border_width">5</property>
8
+ <property name="role">GtkFileChooserDialog</property>
9
+ <property name="type_hint">dialog</property>
10
+ <property name="opacity">0.71999999999999997</property>
11
+ <property name="action">save</property>
12
+ <child internal-child="vbox">
13
+ <object class="GtkVBox" id="dialog-vbox1">
14
+ <property name="visible">True</property>
15
+ <property name="can_focus">False</property>
16
+ <property name="spacing">2</property>
17
+ <child internal-child="action_area">
18
+ <object class="GtkHButtonBox" id="dialog-action_area1">
19
+ <property name="visible">True</property>
20
+ <property name="can_focus">False</property>
21
+ <property name="layout_style">end</property>
22
+ <child>
23
+ <object class="GtkButton" id="button_save">
24
+ <property name="label" translatable="yes">Save</property>
25
+ <property name="visible">True</property>
26
+ <property name="can_focus">True</property>
27
+ <property name="receives_default">True</property>
28
+ </object>
29
+ <packing>
30
+ <property name="expand">False</property>
31
+ <property name="fill">False</property>
32
+ <property name="position">0</property>
33
+ </packing>
34
+ </child>
35
+ <child>
36
+ <object class="GtkButton" id="button_cancel">
37
+ <property name="label" translatable="yes">Cancel</property>
38
+ <property name="visible">True</property>
39
+ <property name="can_focus">True</property>
40
+ <property name="receives_default">True</property>
41
+ </object>
42
+ <packing>
43
+ <property name="expand">False</property>
44
+ <property name="fill">False</property>
45
+ <property name="position">1</property>
46
+ </packing>
47
+ </child>
48
+ </object>
49
+ <packing>
50
+ <property name="expand">False</property>
51
+ <property name="fill">True</property>
52
+ <property name="pack_type">end</property>
53
+ <property name="position">0</property>
54
+ </packing>
55
+ </child>
56
+ <child>
57
+ <placeholder/>
58
+ </child>
59
+ </object>
60
+ </child>
61
+ <action-widgets>
62
+ <action-widget response="0">button_save</action-widget>
63
+ <action-widget response="0">button_cancel</action-widget>
64
+ </action-widgets>
65
+ </object>
66
+ </interface>
data/tsp ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/ruby
2
+
3
+ require 'vrlib'
4
+
5
+ #make program output in real time so errors visible in VR.
6
+ STDOUT.sync = true
7
+ STDERR.sync = true
8
+
9
+ #everything in these directories will be included
10
+ my_path = File.expand_path(File.dirname(__FILE__))
11
+ require_all Dir.glob(my_path + "/bin/**/*.rb")
12
+
13
+ App.new.show
14
+
metadata ADDED
@@ -0,0 +1,118 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tangsalesparser
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Leo Tumwattana
9
+ autorequire:
10
+ bindir:
11
+ - .
12
+ cert_chain: []
13
+ date: 2013-02-07 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: vrlib
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: 0.0.1
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: 0.0.1
31
+ - !ruby/object:Gem::Dependency
32
+ name: gtk2
33
+ requirement: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: 0.0.1
39
+ type: :runtime
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: 0.0.1
47
+ - !ruby/object:Gem::Dependency
48
+ name: require_all
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: 0.0.1
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: 0.0.1
63
+ description: ! "Copyright (c) <''2013''> <''Leo Tumwattana''>\n\nThis software is
64
+ provided 'as-is', without any express or implied\nwarranty. In no event will the
65
+ authors be held liable for any damages\narising from the use of this software.\n\nPermission
66
+ is granted to anyone to use this software for any purpose,\nincluding commercial
67
+ applications, and to alter it and redistribute it\nfreely, subject to the following
68
+ restrictions:\n\n 1. The origin of this software must not be misrepresented; you
69
+ must not\n claim that you wrote the original software. If you use this software\n
70
+ \ in a product, an acknowledgment in the product documentation would be\n appreciated
71
+ but is not required.\n\n 2. Altered source versions must be plainly marked as
72
+ such, and must not be\n misrepresented as being the original software.\n\n 3.
73
+ This notice may not be removed or altered from any source\n distribution."
74
+ email: leo.tumwattana@gmail.com
75
+ executables:
76
+ - tsp
77
+ extensions: []
78
+ extra_rdoc_files: []
79
+ files:
80
+ - bin/Alert.rb
81
+ - bin/App.rb
82
+ - bin/ConfigEditor.rb
83
+ - bin/InputDialog.rb
84
+ - bin/OutputDialog.rb
85
+ - bin/TangConfig.rb
86
+ - bin/TangSalesParser.rb
87
+ - bin/glade/Alert.glade
88
+ - bin/glade/App.glade
89
+ - bin/glade/ConfigEditor.glade
90
+ - bin/glade/InputDialog.glade
91
+ - bin/glade/OutputDialog.glade
92
+ - bin/glade/Save_Dialog.glade
93
+ - ./tsp
94
+ homepage: ''
95
+ licenses: []
96
+ post_install_message:
97
+ rdoc_options: []
98
+ require_paths:
99
+ - .
100
+ required_ruby_version: !ruby/object:Gem::Requirement
101
+ none: false
102
+ requirements:
103
+ - - ! '>='
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ required_rubygems_version: !ruby/object:Gem::Requirement
107
+ none: false
108
+ requirements:
109
+ - - ! '>='
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ requirements: []
113
+ rubyforge_project: nowarning
114
+ rubygems_version: 1.8.25
115
+ signing_key:
116
+ specification_version: 3
117
+ summary: ''
118
+ test_files: []