Class: DragonsKeep::GeneratePasswordDialog

Inherits:
Wx::Dialog
  • Object
show all
Defined in:
lib/dragons_keep/generate_password_dialog.rb

Constant Summary collapse

ID_SPECIAL =
201
ID_SIZE =
202

Instance Method Summary collapse

Constructor Details

#initialize(parent, id, title) ⇒ GeneratePasswordDialog

Returns a new instance of GeneratePasswordDialog.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/dragons_keep/generate_password_dialog.rb', line 10

def initialize(parent, id, title)
  super(parent, id, title)
  self.set_size(Wx::Size.new(400, 150))
  main_sizer = Wx::VBoxSizer.new
  grid_sizer = Wx::FlexGridSizer.new(2,2,5,5)
  grid_sizer.add_growable_col(1)
  # add spacer to grid
  grid_sizer.add(25, 25)
  @use_special_chars = Wx::CheckBox.new self, ID_SPECIAL,:label=> "Use special Characters"
  grid_sizer.add @use_special_chars, 1 , Wx::EXPAND
  @length_password = Wx::SpinCtrl.new self, ID_SIZE, :value=>"8"
  grid_sizer.add Wx::StaticText.new(self, :label=>"Length of Password:"), 0, Wx::ALL |Wx::ALIGN_RIGHT
  grid_sizer.add @length_password, 1, Wx::EXPAND
  main_sizer.add grid_sizer, 1, Wx::EXPAND
  main_sizer.add( self.create_separated_button_sizer(Wx::OK|Wx::CANCEL), 1, Wx::ALIGN_RIGHT)
  set_sizer main_sizer
end

Instance Method Details

#password_lengthObject



31
32
33
# File 'lib/dragons_keep/generate_password_dialog.rb', line 31

def password_length
  @length_password.value
end

#use_special_chars?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/dragons_keep/generate_password_dialog.rb', line 28

def use_special_chars?
  @use_special_chars.value
end