Skip to content

Commit

Permalink
#16 Updates from autohotkey testing
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanmelt committed Jan 27, 2015
1 parent 1546f84 commit b70c437
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 18 deletions.
7 changes: 5 additions & 2 deletions autohotkey/tools/script_runner2.ahk
@@ -1,10 +1,13 @@
SetWinDelay 500
WinWaitActive Script Runner
Sleep 1000

Send ^o ; File Open
WinWaitActive Select Script
Sleep 1000
Send script_test.rb{ENTER}
WinWaitActive Script Runner
Sleep 1000

Click 400 90 ; Start
WinWaitActive Telemetry Viewer
Expand All @@ -19,13 +22,13 @@ Click 400 90 ; Go
Sleep 3000

WinActivate Telemetry Viewer
Sleep 500
Sleep 1000
Send ^q ; File Quit
WinWaitActive Confirm
Send {Enter}

WinActivate Script Runner
Sleep 500
Sleep 2000
Send ^q ; File Quit
Sleep 500

3 changes: 3 additions & 0 deletions autohotkey/tools/test_runner.ahk
Expand Up @@ -253,7 +253,10 @@ Send {Enter} ; No
Sleep 2000
Send ^q ; File Quit
WinWaitActive Warning
Sleep 1000
Send {Tab}{Enter} ; Yes
Sleep 1000
WinWaitActive Results
Sleep 1000
Send {Enter}

1 change: 1 addition & 0 deletions autohotkey/tools/tlm_viewer2.ahk
Expand Up @@ -3,6 +3,7 @@ SetKeyDelay 10

Sleep 1000
WinActivate Screen
Sleep 2000
Send {Tab}
Sleep 500
Send {Enter}
Expand Down
2 changes: 1 addition & 1 deletion autohotkey/tools/tlm_viewer5.ahk
Expand Up @@ -14,7 +14,7 @@ Send {Enter}

; Quit Telemetry Viewer
WinActivate "INST ADCS"
Sleep 500
Sleep 2000
Click 497 10 ; Close the window
Sleep 500

2 changes: 1 addition & 1 deletion lib/cosmos/gui/line_graph/line_graph_drawing.rb
Expand Up @@ -194,7 +194,7 @@ def draw_y_label_and_grid_line(dc, value, index, show_line)
end
end

if show_line
if show_line and y
dc.addLineColor(@graph_left_x, y, @graph_right_x, y, Cosmos::DASHLINE_PEN)
end

Expand Down
7 changes: 7 additions & 0 deletions lib/cosmos/io/tcpip_server.rb
Expand Up @@ -122,6 +122,13 @@ def interface=(interface)
# spawn separate threads to process the reads and writes.
def connect
@cancel_threads = false
if @read_queue
# Empty the read queue of any residual
begin
@read_queue.pop(true) while @read_queue.length > 0
rescue
end
end
if @write_port == @read_port
# Handle one socket case
start_listen_thread(@read_port, true, true)
Expand Down
12 changes: 8 additions & 4 deletions lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_gui.rb
Expand Up @@ -234,16 +234,20 @@ def populate_interfaces(name)
if name == 'Routers'
button.connect(SIGNAL('clicked()')) do
if interface.thread
Logger.info "User disconnecting router #{interface_name}"
CmdTlmServer.instance.disconnect_router(interface_name)
else
Logger.info "User connecting router #{interface_name}"
CmdTlmServer.instance.connect_router(interface_name)
end
end
else
button.connect(SIGNAL('clicked()')) do
if interface.thread
Logger.info "User disconnecting interface #{interface_name}"
CmdTlmServer.instance.disconnect_interface(interface_name)
else
Logger.info "User connecting interface #{interface_name}"
CmdTlmServer.instance.connect_interface(interface_name)
end
end
Expand Down Expand Up @@ -947,10 +951,6 @@ def closeEvent(event)
kill_tab_thread()
CmdTlmServer.instance.stop_logging('ALL')
CmdTlmServer.instance.stop
@output_sleeper.cancel
Qt::CoreApplication.processEvents()
Cosmos.kill_thread(self, @output_thread)
handle_string_output()
super(event)
else
event.ignore()
Expand Down Expand Up @@ -1019,6 +1019,10 @@ def handle_string_output

def stop_callback
handle_string_output()
@output_sleeper.cancel
Qt::CoreApplication.processEvents()
Cosmos.kill_thread(self, @output_thread)
handle_string_output()
end

def graceful_kill
Expand Down
3 changes: 2 additions & 1 deletion lib/cosmos/tools/cmd_tlm_server/interface_thread.rb
Expand Up @@ -72,6 +72,7 @@ def start
begin
packet = @interface.read
unless packet
Logger.info "Clean disconnect from #{@interface.name} (returned nil)"
handle_connection_lost(nil)
if @cancel_thread
break
Expand Down Expand Up @@ -197,7 +198,7 @@ def handle_connection_lost(err)
if @connection_lost_callback
@connection_lost_callback.call(err)
else
Logger.error "Connection Lost for #{@interface.name}"
Logger.info "Connection Lost for #{@interface.name}"
if err
case err
when Errno::ECONNABORTED, Errno::ECONNRESET, Errno::ETIMEDOUT
Expand Down
8 changes: 4 additions & 4 deletions lib/cosmos/tools/script_runner/script_runner_frame.rb
Expand Up @@ -1217,6 +1217,10 @@ def handle_output_io(filename = @current_filename, line_number = @current_line_n
end
end

def graceful_kill
# Just to avoid warning
end

protected

def initialize_variables
Expand Down Expand Up @@ -1432,10 +1436,6 @@ def run_text(text,
end
end

def self.graceful_kill
# Just to avoid warning
end

def handle_potential_tab_change(filename)
# Make sure the correct file is shown in script runner
if @current_file != filename and @tab_book_shown
Expand Down
8 changes: 6 additions & 2 deletions lib/cosmos/tools/tlm_viewer/screen.rb
Expand Up @@ -223,7 +223,7 @@ def initialize(full_name, filename, notify_on_close = nil, mode = :REALTIME, x_p

@widgets = Widgets.new(self, mode)
@window = process(filename)
@@open_screens << self
@@open_screens << self if @window
end

def widgets
Expand Down Expand Up @@ -311,6 +311,7 @@ def process(filename)
rescue => err
ExceptionDialog.new(self, err, "Screen #{File.basename(filename)}", false)
end
shutdown()
return nil
end

Expand Down Expand Up @@ -427,7 +428,10 @@ def process_widget(parser, keyword, parameters, layout_stack, global_settings, g
def closeEvent(event)
super(event)
@@open_screens.delete(self)
shutdown()
end

def shutdown
# Shutdown Value Gathering Thread
@widgets.shutdown

Expand Down Expand Up @@ -465,7 +469,7 @@ def self.close_all_screens(closer)
Widgets.closing_all = true
screens = @@open_screens.clone
screens.each do |screen|
screen.window.graceful_kill
screen.window.graceful_kill if screen.window
end
screens.each do |screen|
begin
Expand Down
18 changes: 15 additions & 3 deletions lib/cosmos/tools/tlm_viewer/tlm_viewer.rb
Expand Up @@ -439,6 +439,10 @@ def closeEvent(event)
@json_drb.stop_service if @json_drb
super(event)
end
else
shutdown_cmd_tlm()
@json_drb.stop_service if @json_drb
super(event)
end
end

Expand All @@ -458,9 +462,12 @@ def display(screen_full_name, x_pos = nil, y_pos = nil)
success = false
Qt.execute_in_main_thread(true) do
begin
screen_info.screen.window.raise
screen_info.screen.window.showNormal
success = true
if screen_info.screen.window
screen_info.screen.window.raise
screen_info.screen.window.activateWindow
screen_info.screen.window.showNormal
success = true
end
rescue
# Screen probably was closed - continue
screen_info.screen = nil
Expand All @@ -476,6 +483,11 @@ def display(screen_full_name, x_pos = nil, y_pos = nil)
else
screen_info.screen = Screen.new(screen_info.full_name, screen_info.filename, self, :REALTIME, screen_info.x_pos, screen_info.y_pos, screen_info.original_target_name, screen_info.substitute, screen_info.force_substitute)
end
if screen_info.screen.window
screen_info.screen.window.raise
screen_info.screen.window.activateWindow
screen_info.screen.window.showNormal
end
end
end

Expand Down

0 comments on commit b70c437

Please sign in to comment.