Class: Cosmos::CmdExtractor
- Inherits:
-
QtTool
show all
- Defined in:
- lib/cosmos/tools/cmd_extractor/cmd_extractor.rb
Overview
Breaks a binary log of commands into readable text.
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from QtTool
#about, #closeEvent, #complete_initialize, create_default_options, graceful_kill, #initialize_help_menu, post_options_parsed_hook, pre_window_new_hook, redirect_io, restore_io
Constructor Details
Returns a new instance of CmdExtractor.
Class Method Details
.run(option_parser = nil, options = nil) ⇒ Object
105
106
107
108
109
110
111
112
113
114
115
116
|
# File 'lib/cosmos/tools/cmd_extractor/cmd_extractor.rb', line 105
def self.run(option_parser = nil, options = nil)
Cosmos.catch_fatal_exception do
unless option_parser and options
option_parser, options = create_default_options()
options.width = 700
options.height = 425
options.title = "Command Extractor"
end
super(option_parser, options)
end
end
|
Instance Method Details
#initialize_actions ⇒ Object
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/cosmos/tools/cmd_extractor/cmd_extractor.rb', line 52
def initialize_actions
super()
@include_raw = Qt::Action.new(tr('Include &Raw Data'), self)
@include_raw_keyseq = Qt::KeySequence.new(tr('Ctrl+R'))
@include_raw.shortcut = @include_raw_keyseq
@include_raw.statusTip = tr('Include raw packet data in the text output')
@include_raw.setCheckable(true)
end
|
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
|
# File 'lib/cosmos/tools/cmd_extractor/cmd_extractor.rb', line 77
def initialize_central_widget
@central_widget = Qt::Widget.new
setCentralWidget(@central_widget)
@top_layout = Qt::VBoxLayout.new(@central_widget)
@packet_log_frame = PacketLogFrame.new(self, @log_dir, System.default_packet_log_reader.new, @input_filenames, @output_filename, true, true, true, Cosmos::CMD_FILE_PATTERN, Cosmos::TXT_FILE_PATTERN)
@packet_log_frame.change_callback = method(:change_callback)
@top_layout.addWidget(@packet_log_frame)
@sep2 = Qt::Frame.new(@central_widget)
@sep2.setFrameStyle(Qt::Frame::HLine | Qt::Frame::Sunken)
@top_layout.addWidget(@sep2)
@button_layout = Qt::HBoxLayout.new
@process_button = Qt::PushButton.new('&Process Files')
@process_button.connect(SIGNAL('clicked()')) { process_log_files() }
@button_layout.addWidget(@process_button)
@open_button = Qt::PushButton.new('&Open in Text Editor')
@open_button.connect(SIGNAL('clicked()')) { open_button() }
@open_button.setEnabled(false)
@button_layout.addWidget(@open_button)
@top_layout.addLayout(@button_layout)
end
|
63
64
65
66
67
68
69
70
71
72
73
74
75
|
# File 'lib/cosmos/tools/cmd_extractor/cmd_extractor.rb', line 63
def
@file_menu = .(tr('&File'))
@file_menu.addAction(@exit_action)
@mode_menu = .(tr('&Mode'))
@mode_menu.addAction(@include_raw)
@about_string = "Command Extractor extracts commands from a binary command log file into a human readable text file."
()
end
|