Cleanup output messages.

This commit is contained in:
Glenn Y. Rolland 2011-07-29 13:38:41 +02:00
parent e6be2a649b
commit ff25b66727
2 changed files with 11 additions and 14 deletions

View file

@ -91,21 +91,18 @@ module Qasim
# Action when map item triggered # Action when map item triggered
# #
def action_trigger_map_item map, item def action_trigger_map_item map, item
puts "%s => %s" % [map.path, item.checked ]
@connect_error[map.path] = Set.new @connect_error[map.path] = Set.new
@connect_running[map.path] = 0 @connect_running[map.path] = 0
if map.connected? then if map.connected? then
puts "disconnect !"
method = :disconnect method = :disconnect
else else
puts "connect !"
method = :connect method = :connect
end end
begin begin
map.send(method) do |linkname,cmd,cmd_args| map.send(method) do |linkname,cmd,cmd_args|
process = Qt::Process.new process = Qt::Process.new
process.connect(SIGNAL('finished(int, QProcess::ExitStatus)')) do |exitcode,exitstatus| process.connect(SIGNAL('finished(int, QProcess::ExitStatus)')) do |exitcode,exitstatus|
puts "exitcode = %s, exitstatus = %s" % [exitcode, exitstatus] #puts "exitcode = %s, exitstatus = %s" % [exitcode, exitstatus]
@connect_running[map.path] -= 1 @connect_running[map.path] -= 1
if exitcode != 0 then if exitcode != 0 then
@connect_error[map.path].add linkname @connect_error[map.path].add linkname
@ -134,7 +131,6 @@ module Qasim
rescue Map::ConnectError => e rescue Map::ConnectError => e
puts e.inspect puts e.inspect
end end
#FIXME: on error, setChecked false
end end
# #
@ -190,14 +186,17 @@ module Qasim
si.connect(SIGNAL('activated(QSystemTrayIcon::ActivationReason)')) do |reason| si.connect(SIGNAL('activated(QSystemTrayIcon::ActivationReason)')) do |reason|
case reason case reason
when Qt::SystemTrayIcon::Trigger when Qt::SystemTrayIcon::Trigger then
build_map_menu build_map_menu
@map_menu.popup(Qt::Cursor::pos()) @map_menu.popup(Qt::Cursor::pos())
#blinking = !blinking #blinking = !blinking
#si.icon = blinking ? alt_icon : std_icon #si.icon = blinking ? alt_icon : std_icon
when Qt::SystemTrayIcon::MiddleClick: puts 'Middle Click' when Qt::SystemTrayIcon::MiddleClick then
when Qt::SystemTrayIcon::Context: puts 'Right Click' #
when Qt::SystemTrayIcon::DoubleClick: puts 'Double Click' when Qt::SystemTrayIcon::Context then
#
when Qt::SystemTrayIcon::DoubleClick then
#
end end
end end
end end

View file

@ -30,7 +30,7 @@ module Qasim
@user = nil @user = nil
@cypher = :arcfour @cypher = :arcfour
@links = {} @links = {}
@debug = true @debug = false
@name = (File.basename map_path).gsub(/\.map$/,'') @name = (File.basename map_path).gsub(/\.map$/,'')
self.load @path self.load @path
@ -47,7 +47,7 @@ module Qasim
linect += 1 linect += 1
while line =~ /\$(\w+)/ do while line =~ /\$(\w+)/ do
puts "FOUND PATTERN %s => %s" % [$1, local_env[$1]] #puts "FOUND PATTERN %s => %s" % [$1, local_env[$1]]
case line case line
when /\$\{(.+)\}/ then when /\$\{(.+)\}/ then
pattern = $1 pattern = $1
@ -57,7 +57,7 @@ module Qasim
pattern = $1 pattern = $1
line.gsub!(/\$#{pattern}/,local_env[pattern]) line.gsub!(/\$#{pattern}/,local_env[pattern])
else else
puts "unknown pattern: %s" % line puts "w: unknown pattern: %s" % line
end end
end end
@ -143,7 +143,6 @@ module Qasim
# #
# FIXME: test connexion with Net::SSH + timeout or ask password # FIXME: test connexion with Net::SSH + timeout or ask password
@links.each do |name, remotepath| @links.each do |name, remotepath|
pp map
localpath = File.join ENV['HOME'], "mnt", name localpath = File.join ENV['HOME'], "mnt", name
cmd = "sshfs" cmd = "sshfs"
cmd_args = [ cmd_args = [
@ -175,7 +174,6 @@ module Qasim
def disconnect &block def disconnect &block
puts "Disconnecting map #{@path}" puts "Disconnecting map #{@path}"
@links.each do |name, remotepath| @links.each do |name, remotepath|
pp map
localpath = File.join ENV['HOME'], "mnt", name localpath = File.join ENV['HOME'], "mnt", name
cmd = "fusermount" cmd = "fusermount"
cmd_args = [ cmd_args = [