Class: FXLoginWizzard

Inherits:
FXDialogBox
  • Object
show all
Defined in:
lib/watobo/gui/login_wizzard.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(owner, project) ⇒ FXLoginWizzard

Returns a new instance of FXLoginWizzard.


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
299
300
# File 'lib/watobo/gui/login_wizzard.rb', line 193

def initialize(owner, project)
  @project = project
  # Invoke base class initialize function first
#  super(owner, "LoginScript Wizzard", DECOR_TITLE|DECOR_BORDER,:width=>800, :height=>600)
  super(owner, "LoginScript Wizzard", DECOR_ALL,:width=>800, :height=>600)
  
  #self.icon = icon
#  @project = nil
  @sid_patterns = []
  @requestids = []
  @pattern = FXDataTarget.new("")
  
  @sid_patterns = @project.settings[:sid_patterns].clone
  @requestids = @project.loginscript_ids.clone 
  
  
  @lastid=-1
  @lastpattern=-1
  
  lw_main = FXPacker.new(self, :opts => LAYOUT_FILL)
  lw_bottom = FXHorizontalFrame.new(lw_main, :opts => LAYOUT_FILL_X|LAYOUT_SIDE_BOTTOM)
  lw_body = FXHorizontalFrame.new(lw_main, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_SIDE_TOP)
  
  
  #=============================================================================================
  # body
  
  lw_left = FXVerticalFrame.new(lw_body, :opts => LAYOUT_FILL_Y|LAYOUT_SIDE_LEFT)
  lw_right = FXVerticalFrame.new(lw_body, :opts => LAYOUT_FILL_Y|LAYOUT_SIDE_RIGHT|LAYOUT_FILL_X)
  
  
  #=============================================================================================
  # lw_right
  
  req_frame = FXVerticalFrame.new(lw_right, :opts => LAYOUT_FILL_X| LAYOUT_FILL_Y|FRAME_GROOVE)
  resp_frame = FXVerticalFrame.new(lw_right, :opts => LAYOUT_FILL_X| LAYOUT_FILL_Y|FRAME_GROOVE)
  
  FXLabel.new(req_frame, "Requests:" )                      
  @requestView = FXText.new(req_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
  
  # Construct some hilite styles
  hs_red = FXHiliteStyle.new
  hs_red.normalForeColor = FXRGBA(255,255,255,255) #FXColor::Red
  hs_red.normalBackColor = FXRGBA(255,0,0,1)   # FXColor::White
  hs_red.style = FXText::STYLE_BOLD
  # Enable the style buffer for this text widget
  @requestView.styled = true
  # Set the styles
  @requestView.hiliteStyles = [hs_red]
  
  
  
  FXLabel.new(resp_frame, "Response:" )                      
  @responseView = FXText.new(resp_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
  @responseView.styled = true
  # Set the styles
  @responseView.hiliteStyles = [hs_red]
  
  #=============================================================================================
  # sid-pattern
  sid_frame = FXVerticalFrame.new(lw_left, :opts => LAYOUT_FILL_X|FRAME_GROOVE)
  lw_sid = FXHorizontalFrame.new(sid_frame, :opts => LAYOUT_FILL_X)
  FXLabel.new(lw_sid, "Pattern:" )
  FXTextField.new(lw_sid, 20,
                  :target => @pattern, :selector => FXDataTarget::ID_VALUE,
                  :opts => TEXTFIELD_NORMAL|LAYOUT_SIDE_LEFT)
  
  addPattern=FXButton.new(lw_sid, " + " , :opts => BUTTON_NORMAL|LAYOUT_LEFT)
  addPattern.connect(SEL_COMMAND, method(:addPattern))
  
  remPattern=FXButton.new(lw_sid, " - " , :opts => BUTTON_NORMAL|LAYOUT_LEFT)
  remPattern.connect(SEL_COMMAND, method(:remPattern))
  
  @pattern_list = FXList.new(sid_frame, :opts => LIST_EXTENDEDSELECT|LAYOUT_FILL_X|LAYOUT_FILL_Y)
  @pattern_list.numVisible = 8
  
  @pattern_list.connect(SEL_COMMAND,method(:onPatternClick))
  
  updatePatternList
  
  
  
  #=============================================================================================
  # request-list
  
  lw_req_list = FXVerticalFrame.new(lw_left, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_GROOVE)
  lw_request_list_header = FXHorizontalFrame.new(lw_req_list, :opts => LAYOUT_FILL_X)
  FXLabel.new(lw_request_list_header, "Login-Requests:" )
  
  @request_list = FXList.new(lw_req_list, :opts => LIST_EXTENDEDSELECT|LAYOUT_FILL_X|LAYOUT_FILL_Y)
  @request_list.connect(SEL_COMMAND,method(:onRequestClick))
  
  remRequest=FXButton.new(lw_request_list_header, " - " , :opts => BUTTON_NORMAL|LAYOUT_RIGHT)
  remRequest.connect(SEL_COMMAND, method(:remRequest))
  #=============================================================================================
  
  
  
  #=============================================================================================
  # lw_bottom    
  
  FXButton.new(lw_bottom, "OK" ,
  :target => self, :selector => FXDialogBox::ID_ACCEPT,
  :opts => BUTTON_NORMAL|LAYOUT_RIGHT)
  FXButton.new(lw_bottom, "Cancel" ,
  :target => self, :selector => FXDialogBox::ID_CANCEL,
  :opts => BUTTON_NORMAL|LAYOUT_RIGHT)    
end

Instance Attribute Details

#projectObject

Returns the value of attribute project


31
32
33
# File 'lib/watobo/gui/login_wizzard.rb', line 31

def project
  @project
end

#requestidsObject

Returns the value of attribute requestids


30
31
32
# File 'lib/watobo/gui/login_wizzard.rb', line 30

def requestids
  @requestids
end

#sid_patternsObject

Returns the value of attribute sid_patterns


29
30
31
# File 'lib/watobo/gui/login_wizzard.rb', line 29

def sid_patterns
  @sid_patterns
end

Instance Method Details

#add_request(chatid) ⇒ Object


172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/watobo/gui/login_wizzard.rb', line 172

def add_request(chatid)
  
  @requestids.push "#{chatid}"
  chat = nil
  
  
  @project.chat_list.each do |c|
    chat = c
    # puts "#{chat.id} : #{chatid}"
    break if c.id == chatid
  end
  
  
  show_chat(chat)
  update_request_list(@requestids)
  
end