Skip to content

Commit

Permalink
Add search to CmdSequence
Browse files Browse the repository at this point in the history
  • Loading branch information
jmthomas committed May 29, 2018
1 parent 06c2a7b commit 710ff36
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 30 deletions.
41 changes: 21 additions & 20 deletions autohotkey/tools/cmd_sequence.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Send !a ; Actions menu
Sleep 500
Send c ; Collapse all
Sleep 1000
Click 300 210 ; Click on sequence item to display it
Click 300 234 ; Click on sequence item to display it
Sleep 1000
Send !a ; Actions menu
Sleep 500
Expand All @@ -57,28 +57,28 @@ Sleep 500
Send s ; Show ignored items
Sleep 500

Click right 170 309 ; Right click collect type
Click right 170 355 ; Right click collect type
Sleep 500
Send {Tab}{Enter}
WinWaitActive INST
Sleep 500
Send {Enter}
WinWaitActive Command Sequence

Click right 170 309 ; Right click collect type
Click right 170 355 ; Right click collect type
Sleep 500
Send {Tab 2}{Enter} ; Insert filename
WinWaitActive Insert
Sleep 500
Send {Esc}
WinWaitActive Command Sequence

Click 260 311 2 ; Double click the collect type manual entry
Click 260 355 2 ; Double click the collect type manual entry
Sleep 500
Send 9{Enter}
Sleep 500

Click 170 309 2 ; Double click the collect Type
Click 170 355 2 ; Double click the collect Type
Sleep 500
Click ; Click again to activate the drop down
Sleep 500
Expand Down Expand Up @@ -116,39 +116,40 @@ WinWaitActive Save
Send {Tab}{Enter} ; Yes
WinWaitActive Command Sequence

Click 100 100 ; Click the Target dropdown
Click 100 124 ; Click the Target dropdown
Sleep 500

Send {Down}{Enter} ; Change the target
Sleep 500
Click 610 100 ; Add Abort command
Click 610 124 ; Add Abort command
Sleep 500
Click 633 155 ; Delete the command
Click 633 179 ; Delete the command
Sleep 500
Click 610 100 ; Add Abort command
Click 610 124 ; Add Abort command
Sleep 500
Click 610 100 ; Add Abort command
Click 610 124 ; Add Abort command
Sleep 500
Click 450 100 ; Click the command dropdown
Click 450 124 ; Click the command dropdown
Sleep 500
Send {Down 2}{Enter} ; ASCIICMD
Sleep 500
Click 610 100 ; Add ASCIICMD
Click 610 124 ; Add ASCIICMD
Sleep 500
Click 300 210 ; Click on the ASCIICMD to expand it
Click 300 234 ; Click on the ASCIICMD to expand it
Sleep 500

Click 170 330 2 ; Click in the BINARY field
Click 170 354 2 ; Click in the BINARY field
Send testtest{Enter}
WinWaitActive Error
Send {Enter}
WinWaitActive Command Sequence

Click 170 330 2 ; Double click in the BINARY field
Click 170 354 2 ; Double click in the BINARY field
Sleep 500
Send test{Enter}
Sleep 500

Click 170 330 2 ; Double click in the BINARY field
Click 170 354 2 ; Double click in the BINARY field
Sleep 500
Send 0xDEADBEEF{Enter}
Sleep 500
Expand All @@ -163,19 +164,19 @@ WinWaitActive Save
Send {Tab 2}{Enter} ; No
; Script should execute and complete

Click 80 155 ; First command Time field
Click 80 174 ; First command Time field
Sleep 500
Send {Backspace 5}2.5{Enter} ; 2.5s delay
Click right 85 180
Click right 85 204
WinWaitActive Select
Send {Esc} ; Cancel absolute time select
WinWaitActive Command Sequence
Click right 80 180
Click right 80 204
WinWaitActive Select
Min := 1 + A_Min ; One minute in the future
Send {Tab 2}%Min%{Enter} ; Set the future time
WinWaitActive Command Sequence
Click right 80 210
Click right 80 234
WinWaitActive Select
Send {Tab 5}{Enter} ; Select time now
WinWaitActive Command Sequence
Expand Down
2 changes: 1 addition & 1 deletion autohotkey/tools/cmd_sequence2.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Sleep 2000

Click 610 70 ; Click Stop
Sleep 2000
Click 80 155 ; Time field
Click 80 179 ; Time field
Sleep 500
Send {Backspace 5}61{Enter}
Click 450 70 ; Click Start
Expand Down
2 changes: 2 additions & 0 deletions demo/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,12 @@ def create_crc_file(official)
puts "Created config/data/crc.txt with #{count} CRCs"
end

desc 'Updates the config/data/crc.txt file with USER_MODIFIED (unofficial)'
task :crc do
create_crc_file(false)
end

desc 'Updates the config/data/crc.txt file (official)'
task :crc_official do
create_crc_file(true)
end
35 changes: 28 additions & 7 deletions lib/cosmos/tools/cmd_sequence/cmd_sequence.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
require 'cosmos/gui/widgets/realtime_button_bar'
require 'cosmos/gui/choosers/file_chooser'
require 'cosmos/tools/cmd_sequence/sequence_list'
require 'cosmos/gui/widgets/full_text_search_line_edit'
end

module Cosmos
Expand Down Expand Up @@ -85,6 +86,20 @@ def initialize(options)
@target_select.setCurrentText(options.packet[0]) if options.packet
update_commands()
@cmd_select.setCurrentText(options.packet[1]) if options.packet

# Handle searching entries
@search_box.completion_list = System.commands.all_packet_strings(true, splash)
@search_box.callback = lambda do |cmd|
split_cmd = cmd.split(" ")
if split_cmd.length == 2
target_name = split_cmd[0].upcase
@target_select.setCurrentText(target_name)
update_commands()
command_name = split_cmd[1]
@cmd_select.setCurrentText(command_name)
add_command()
end
end
end
# Unconfigure CosmosConfig to interact with splash screen
ConfigParser.splash = nil
Expand Down Expand Up @@ -205,6 +220,10 @@ def initialize_central_widget
@realtime_button_bar.state = 'Stopped'
central_layout.addWidget(@realtime_button_bar)

# Mnemonic Search Box
@search_box = FullTextSearchLineEdit.new(self)
central_layout.addWidget(@search_box)

@target_select = Qt::ComboBox.new
@target_select.setMaxVisibleItems(6)
@target_select.connect(SIGNAL('activated(const QString&)')) do |target|
Expand All @@ -219,13 +238,7 @@ def initialize_central_widget
cmd_label.setBuddy(@cmd_select)

add = Qt::PushButton.new("Add")
add.connect(SIGNAL('clicked()')) do
command = System.commands.packet(@target_select.text, @cmd_select.text).dup
command.restore_defaults
item = @sequence_list.add(command)
item.show_ignored(@show_ignored.isChecked())
item.states_in_hex(@states_in_hex.isChecked())
end
add.connect(SIGNAL('clicked()')) { add_command() }

# Layout the target and command selection with Add button
select_layout = Qt::HBoxLayout.new
Expand Down Expand Up @@ -264,6 +277,14 @@ def initialize_central_widget
splitter.setStretchFactor(1,0)
end

def add_command
command = System.commands.packet(@target_select.text, @cmd_select.text).dup
command.restore_defaults
item = @sequence_list.add(command)
item.show_ignored(@show_ignored.isChecked())
item.states_in_hex(@states_in_hex.isChecked())
end

# Export the sequence list into a custom binary format
def file_export
return if @sequence_list.empty? || @exporter.nil?
Expand Down
5 changes: 3 additions & 2 deletions tasks/gemfile_stats.rake
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ task :gemfile_stats do
# This is useful for testing to prevent server round trips
#File.open("gemdata.marshall", 'w') {|file| file.write(Marshal.dump(get_latest_gem_data)) }
gem_data = Marshal.load(File.read("gemdata.marshall"))

#gem_data = get_latest_gem_data()

# Convert all the date text into Ruby Dates
gem_data.map! {|x| [Date.strptime(x[0], "%Y-%m"), x[1], x[2]]}
# Sort first by date and then version number
Expand Down Expand Up @@ -68,7 +68,8 @@ task :gemfile_stats do

# Reduce the number of labels due to overlap
labels.each do |i, label|
labels[i] = '' if i % 2 == 0
# Increase the modulus value if you get an ArgumentError: no text to measure
labels[i] = '' if i % 4 != 0
end
g.labels = labels
g.marker_font_size = 12
Expand Down

0 comments on commit 710ff36

Please sign in to comment.