-
Notifications
You must be signed in to change notification settings - Fork 0
/
static_gui.rb
executable file
·298 lines (240 loc) · 8.85 KB
/
static_gui.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
# Form implementation generated from reading ui file 'quickspec_new.ui'
#
# Created: Sun Aug 20 01:39:41 2006
# by: The QtRuby User Interface Compiler (rbuic)
#
# WARNING! All changes made in this file will be lost!
require 'Qt'
require 'gui_lib.rb'
require 'Classes.rb'
require 'profile_select.rb'
class FrmMain < Qt::MainWindow
slots 'languageChange()',
'fileExit()',
'helpIndex()',
'helpContents()',
'helpAbout()',
'extrasAddCommand()',
'extrasChangeProfile()',
'goBack()',
'goNext()',
'selectFile()',
'fileStartAgain()',
'fileImportTemplate()'
attr_reader :btnBack
attr_reader :btnNext
attr_reader :txtprocessoutput
attr_reader :btnQuit
attr_reader :frmMain
def initialize(parent = nil, name = nil, fl = WType_TopLevel)
super
statusBar()
if name.nil?
setName("FrmMain")
end
setCentralWidget(Qt::Widget.new(self, "qt_central_widget"))
@engine_count = 0
@btnBack = Qt::PushButton.new(centralWidget(), "btnBack")
@btnBack.setGeometry( Qt::Rect.new(180, 490, 81, 30) )
@btnNext = Qt::PushButton.new(centralWidget(), "btnNext")
@btnNext.setGeometry( Qt::Rect.new(280, 490, 81, 30) )
@txtprocessoutput = Qt::TextEdit.new(centralWidget(), "txtprocessoutput")
@txtprocessoutput.setEnabled( true )
@txtprocessoutput.setReadOnly( true )
@txtprocessoutput.setGeometry( Qt::Rect.new(21, 365, 500, 112) )
@lbltxtprocessoutput = Qt::Label.new(centralWidget(), "lblprocessoutput")
@lbltxtprocessoutput.setText("Messages")
@lbltxtprocessoutput.setGeometry( Qt::Rect.new(21, 350, 500, 15) )
@btnQuit = Qt::PushButton.new(centralWidget(), "btnQuit")
@btnQuit.setGeometry( Qt::Rect.new(420, 490, 81, 30) )
@frmMain = Qt::Frame.new(centralWidget(), "frmMain")
@frmMain.setGeometry( Qt::Rect.new(20, 25, 490, 310) )
@frmMain.setFrameShape( Qt::Frame::GroupBoxPanel )
@frmMain.setFrameShadow( Qt::Frame::Raised )
@vboxMain = Qt::VBoxLayout.new(@frmMain,0,-1,"vboxMain")
@fileExitAction= Qt::Action.new(self, "fileExitAction")
@helpContentsAction= Qt::Action.new(self, "helpContentsAction")
@helpIndexAction= Qt::Action.new(self, "helpIndexAction")
@helpAboutAction= Qt::Action.new(self, "helpAboutAction")
@fileNewImport_templateAction= Qt::Action.new(self, "fileNewImport_templateAction")
@extrasAddCommandAction= Qt::Action.new(self, "extrasAddCommandAction")
@extrasChangeProfileAction= Qt::Action.new(self, "extrasChangeProfileAction")
@fileStart_AgainAction= Qt::Action.new(self, "fileStart_AgainAction")
@MenuBar = Qt::MenuBar.new( self, "MenuBar" )
@fileMenu = Qt::PopupMenu.new( self )
@fileStart_AgainAction.addTo( @fileMenu )
@fileNewImport_templateAction.addTo( @fileMenu )
@fileMenu.insertSeparator()
@fileMenu.insertSeparator()
@fileExitAction.addTo( @fileMenu )
@MenuBar.insertItem( "", @fileMenu, 1 )
@Extras = Qt::PopupMenu.new( self )
@extrasAddCommandAction.addTo( @Extras )
@extrasChangeProfileAction.addTo( @Extras )
@MenuBar.insertItem( "", @Extras, 2 )
@helpMenu = Qt::PopupMenu.new( self )
@helpContentsAction.addTo( @helpMenu )
@helpIndexAction.addTo( @helpMenu )
@helpMenu.insertSeparator()
@helpAboutAction.addTo( @helpMenu )
@MenuBar.insertItem( "", @helpMenu, 3 )
languageChange()
resize( Qt::Size.new(540, 576).expandedTo(minimumSizeHint()) )
clearWState( WState_Polished )
Qt::Object.connect(@fileExitAction, SIGNAL("activated()"), self, SLOT("fileExit()") )
Qt::Object.connect(@helpIndexAction, SIGNAL("activated()"), self, SLOT("helpIndex()") )
Qt::Object.connect(@helpContentsAction, SIGNAL("activated()"), self, SLOT("helpContents()") )
Qt::Object.connect(@helpAboutAction, SIGNAL("activated()"), self, SLOT("helpAbout()") )
Qt::Object.connect(@btnQuit, SIGNAL("clicked()"), self, SLOT("close()") )
Qt::Object.connect(@extrasAddCommandAction, SIGNAL("activated()"), self, SLOT("extrasAddCommand()") )
Qt::Object.connect(@extrasChangeProfileAction, SIGNAL("activated()"), self, SLOT("extrasChangeProfile()") )
Qt::Object.connect(@btnBack, SIGNAL("clicked()"), self, SLOT("goBack()") )
Qt::Object.connect(@btnNext, SIGNAL("clicked()"), self, SLOT("goNext()") )
Qt::Object.connect(@fileStart_AgainAction, SIGNAL("activated()"), self, SLOT("fileStartAgain()") )
Qt::Object.connect(@fileNewImport_templateAction, SIGNAL("activated()"), self, SLOT("fileImportTemplate()") )
setTabOrder(@btnBack, @btnNext)
setTabOrder(@btnNext, @btnQuit)
setTabOrder(@btnQuit, @txtprocessoutput)
end
#
# Sets the strings of the subwidgets using the current
# language.
#
def languageChange()
setCaption(trUtf8("Template System - Build your packages Easily"))
@btnBack.setText( trUtf8("Bac&k") )
@btnBack.setAccel( Qt::KeySequence.new(trUtf8("Alt+K")) )
@btnNext.setText( trUtf8("Ne&xt") )
@btnNext.setAccel( Qt::KeySequence.new(trUtf8("Alt+X")) )
@btnQuit.setText( trUtf8("&Quit") )
@btnQuit.setAccel( Qt::KeySequence.new(trUtf8("Alt+Q")) )
@fileExitAction.setText(trUtf8("E&xit"))
@fileExitAction.setMenuText(trUtf8("E&xit"))
@fileExitAction.setAccel(Qt::KeySequence.new(nil))
@helpContentsAction.setText(trUtf8("Contents"))
@helpContentsAction.setMenuText(trUtf8("&Contents..."))
@helpContentsAction.setAccel(Qt::KeySequence.new(nil))
@helpIndexAction.setText(trUtf8("Index"))
@helpIndexAction.setMenuText(trUtf8("&Index..."))
@helpIndexAction.setAccel(Qt::KeySequence.new(nil))
@helpAboutAction.setText(trUtf8("About"))
@helpAboutAction.setMenuText(trUtf8("&About"))
@helpAboutAction.setAccel(Qt::KeySequence.new(nil))
@fileNewImport_templateAction.setText(trUtf8("From &Template"))
@fileNewImport_templateAction.setMenuText(trUtf8("From &Template"))
@fileNewImport_templateAction.setAccel(Qt::KeySequence.new(nil))
@extrasAddCommandAction.setText(trUtf8("Add Command"))
@extrasAddCommandAction.setMenuText(trUtf8("Add Command"))
@extrasChangeProfileAction.setText(trUtf8("Change Profile"))
@extrasChangeProfileAction.setMenuText(trUtf8("Change Profile"))
@fileStart_AgainAction.setText(trUtf8("&Start Again"))
@fileStart_AgainAction.setMenuText(trUtf8("&Start Again"))
if [email protected](1).nil?
@MenuBar.findItem(1).setText( trUtf8("&File") )
end
if [email protected](2).nil?
@MenuBar.findItem(2).setText( trUtf8("Extras") )
end
if [email protected](3).nil?
@MenuBar.findItem(3).setText( trUtf8("&Help") )
end
end
protected :languageChange
def fileExit(*k)
close
end
def helpIndex(*k)
not_implemented
end
def helpContents(*k)
not_implemented
end
def helpAbout(*k)
not_implemented
end
def extrasAddCommand(*k)
cmd_widget = Add_phase_widget.new
cmd_widget.show
end
def extrasChangeProfile(*k)
p = FrmProfile.new
p.show
Question.set_expertise(File.new("#{get_homedir}/.apbd/.profile").read)
end
def goBack(*k)
clear_vbox
Question.get_asked_list.each do |asked_item|
Question.get_question_byname(asked_item.get_name).unask
end
Question.clear_asked_list
@engine_count-=1
engine(self,@engine_count)
@btnNext.setEnabled(true)
end
def goNext(*k)
Question.commit_all_asked
clear_vbox
@engine_count+=1
Phase.run_phase_queue
engine(self,@engine_count)
end
def clear_vbox
Question.get_asked_list.each do |asked_item|
@vboxMain.remove(asked_item)
end
end
def engine_count_reduce
@engine_count-=1
end
def engine_count_increase
@engine_count+=1
end
def get_engine_count
return @engine_count
end
def selectFile(*k)
not_implemented
end
def fileStartAgain(*k)
while @engine_count>0
get_btnBack.clicked
end
end
def fileImportTemplate(*k)
not_implemented
end
def addwidget_to_frm(widget)
@vboxMain.addWidget(widget)
Question.get_asked_list.push(widget)
widget.show
end
def get_main_box
return @frmMain
end
def get_proc_outbox
return @txtprocessoutput
end
def proc_outbox_append(message)
@txtprocessoutput.append(message)
end
def get_btnBack
return @btnBack
end
def get_btnNext
return @btnNext
end
def not_implemented
msgbox=Qt::MessageBox.new()
msgbox.setText("Will be available soon")
msgbox.show
end
end
=begin
if $0 == __FILE__
a = Qt::Application.new(ARGV)
w = FrmMain.new
a.mainWidget = w
w.show
a.exec
end
=end