Class: Watobo::Gui::PluginBoard

Inherits:
FXVerticalFrame
  • Object
show all
Includes:
Icons
Defined in:
lib/watobo/gui/plugin_board.rb

Constant Summary

Constants included from Icons

Icons::ICON_ADD_PROJECT, Icons::ICON_BROWSER_MEDIUM, Icons::ICON_BROWSER_SMALL, Icons::ICON_BTN_DOWN, Icons::ICON_BTN_UP, Icons::ICON_CB_CHECKED, Icons::ICON_CB_CHECKED_ORANGE, Icons::ICON_CB_UNCHECKED, Icons::ICON_CONVERSATION, Icons::ICON_DASHBOARD, Icons::ICON_DIFFER, Icons::ICON_FOLDER, Icons::ICON_FOLDER_SMALL, Icons::ICON_FUZZER, Icons::ICON_FUZZER_MEDIUM, Icons::ICON_FUZZER_SMALL, Icons::ICON_FUZZ_FILTER, Icons::ICON_FUZZ_GENERATOR, Icons::ICON_FUZZ_TAG, Icons::ICON_HINTS, Icons::ICON_HINTS_INFO, Icons::ICON_HINTS_INFO_SMALL, Icons::ICON_HINTS_SMALL, Icons::ICON_INFO, Icons::ICON_INFO_INFO, Icons::ICON_INFO_INFO_SMALL, Icons::ICON_INFO_SMALL, Icons::ICON_INFO_USER, Icons::ICON_INFO_USER_SMALL, Icons::ICON_INTERCEPTOR, Icons::ICON_LOGIN_WIZZARD, Icons::ICON_MANUAL_REQUEST, Icons::ICON_MANUAL_REQUEST_MEDIUM, Icons::ICON_MANUAL_REQUEST_SMALL, Icons::ICON_PAUSE, Icons::ICON_PLUGIN, Icons::ICON_PROJECT, Icons::ICON_PROJECT_SMALL, Icons::ICON_REPORT, Icons::ICON_REQUEST, Icons::ICON_REQUEST_SMALL, Icons::ICON_SEND_REQUEST, Icons::ICON_SITE, Icons::ICON_SITE_SMALL, Icons::ICON_START, Icons::ICON_STOP, Icons::ICON_TOKEN, Icons::ICON_TRANSCODER, Icons::ICON_VULN, Icons::ICON_VULN_BP, Icons::ICON_VULN_BP_SMALL, Icons::ICON_VULN_CRITICAL, Icons::ICON_VULN_CRITICAL_SMALL, Icons::ICON_VULN_HIGH, Icons::ICON_VULN_HIGH_SMALL, Icons::ICON_VULN_LOW, Icons::ICON_VULN_LOW_SMALL, Icons::ICON_VULN_MEDIUM, Icons::ICON_VULN_MEDIUM_SMALL, Icons::ICON_VULN_SMALL, Icons::ICON_WATOBO, Icons::SIBERAS_ICON, Icons::TBL_ICON_LOCK, Icons::WATOBO_LOGO

Instance Method Summary collapse

Constructor Details

#initialize(parent) ⇒ PluginBoard

Returns a new instance of PluginBoard.



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
# File 'lib/watobo/gui/plugin_board.rb', line 92

def initialize(parent)
  begin

    super(parent, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN)
    # db_title = FXLabel.new(self, "PLUGIN-BOARD", :opts => LAYOUT_LEFT)
    main = FXVerticalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_GROOVE)
    main.backColor = FXColor::White

    frame  = FXHorizontalFrame.new(main, :opts => LAYOUT_FILL_X|FRAME_GROOVE)
    frame.backColor = FXColor::White
    title_icon = FXButton.new(frame, '', ICON_PLUGIN, :opts => FRAME_NONE)
    title_icon.backColor = FXColor::White

    @font_title = FXFont.new(getApp(), "helvetica", 14, FONTWEIGHT_BOLD, FONTSLANT_ITALIC, FONTENCODING_DEFAULT)
    title  = FXLabel.new(frame, "Plugin-Board", nil, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
    title.backColor = FXColor::White
    title.setFont(@font_title)
    title.justify = JUSTIFY_LEFT|JUSTIFY_CENTER_Y

    @plugin_frame = FXVerticalFrame.new(main, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_GROOVE)

    @plugin_frame.backColor = FXColor::White

    @matrix = FXMatrix.new(@plugin_frame, 7, :opts => MATRIX_BY_COLUMNS|LAYOUT_FILL_X)
    @matrix.backColor = FXColor::White
  rescue => bang
    puts bang
    puts bang.backtrace if $DEBUG
  end
# update(nil)
end

Instance Method Details

#updateBoardObject



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
# File 'lib/watobo/gui/plugin_board.rb', line 27

def updateBoard()

  return false unless Watobo::Gui.plugins.first.respond_to? :plugin_name
  begin
    @matrix.each_child do |child|
      @matrix.removeChild(child)
    end

    loaded = []

    Watobo::Gui.plugins.each do |p|
      plugin_name = p.respond_to?(:get_plugin_name) ? p.get_plugin_name : p.plugin_name
      next if loaded.include? plugin_name
      loaded << plugin_name
      icon =p.respond_to?(:icon) ? p.icon : p.gui.icon
      pbtn = FXButton.new( @matrix, "\n" + plugin_name, icon, nil, 0,
      :opts => ICON_ABOVE_TEXT|FRAME_RAISED|FRAME_THICK|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT|LAYOUT_RIGHT,
      :width => 80, :height => 80)
      pbtn.create

      pbtn.connect(SEL_COMMAND) {
        gui =  p.respond_to?(:create) ? p : p.gui
        gui.create
        gui.show(Fox::PLACEMENT_SCREEN)
      # gui.updateView()
      }

      pbtn.connect(SEL_RIGHTBUTTONPRESS) { |sender, sel, event|
        description = nil
        description = p.get_description if p.respond_to?(:get_description)
        description = "No description available." if description.nil?

        plugin_name = p.respond_to?(:get_plugin_name) ? p.get_plugin_name : p.plugin_name
        unless event.moved?
          FXMenuPane.new(self) do |menu_pane|
            #title = FXMenuCaption.new(menu_pane, "Description: #{plugin_name}")
            #title.backColor = 'red'
             #f = FXVerticalFrame.new(menu_pane, :opts=>LAYOUT_FILL_X|LAYOUT_FILL_Y)
            t = FXLabel.new(menu_pane, "#{plugin_name}")
           # t.justify = JUSTIFY_LEFT
            t.font = FXFont.new(getApp(), "courier", 12, FONTWEIGHT_BOLD)

            f = FXVerticalFrame.new(menu_pane, :opts=>LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_THICK|FRAME_SUNKEN)
            FXLabel.new(f, description).justify = JUSTIFY_LEFT

            menu_pane.create
            menu_pane.popup(nil, event.root_x, event.root_y)
            app.runModalWhileShown(menu_pane)
          end
        end
      }

      frame = FXFrame.new(@matrix, :opts => FRAME_NONE|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT, :width => 80, :height => 80)
      frame.backColor = FXColor::White
    end

    @plugin_frame.recalc
    @plugin_frame.update

  rescue => bang
    puts bang
    puts bang.backtrace if $DEBUG
  end
end