Skip to content

Commit

Permalink
debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
glucero committed Nov 10, 2012
1 parent 65b9cd6 commit 1c8f942
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
5 changes: 5 additions & 0 deletions source/lib/fusuma.rb
Expand Up @@ -55,7 +55,12 @@ def applicationDidFinishLaunching(notification)
configuration = Configuration.new

@layouts = configuration.layouts

log.debug 'Layouts created.'

@keymap = configuration.keymap(@layouts.first) # use only 1 layout right now

log.debug 'Keymaps created.'
rescue => error
log.error error.message
log.error error.backtrace.join("\n")
Expand Down
9 changes: 9 additions & 0 deletions source/lib/fusuma/configuration.rb
Expand Up @@ -2,6 +2,7 @@ module Fusuma

class Configuration

include Logger
include Properties

def layouts
Expand All @@ -12,7 +13,11 @@ def layouts
read_configuration do |layouts, keymap|
@keymap = keymap
layouts = layouts.map { |l| Layout.load(l) }

log.debug "#{layouts.count} layouts configured."

layouts.zip(Workspace.desktops) do |layout, desktop|

layout.scale_to desktop unless desktop.nil?
end

Expand All @@ -22,6 +27,9 @@ def layouts

def keymap(layout)
KeyMap.new(layout) do |keymap|

log.debug "#{@keymap.count} keymaps configured."

@keymap.each do |action, sequence|
keymap.add(action, sequence)
end
Expand All @@ -33,6 +41,7 @@ def keymap(layout)
def read_configuration
File.open(CONFIG, 'r') do |file|
file = JSON.parse(file.read)

yield file.values
end
end
Expand Down
7 changes: 6 additions & 1 deletion source/lib/fusuma/layout.rb
Expand Up @@ -2,6 +2,7 @@ module Fusuma

class Layout < Array

include Logger
include Properties

attr_accessor :frames, :scale
Expand All @@ -19,7 +20,11 @@ def self.all
end

def self.load(name)
config = Layout.all.find { |l| l.name.eql? name }
layouts = Layout.all

log.debug "#{layouts.count} layouts found."

config = layout.find { |l| l.name.eql? name }

Layout.new(config.scale, config.frames)
end
Expand Down
3 changes: 3 additions & 0 deletions source/lib/fusuma/status_bar_window.rb
Expand Up @@ -2,6 +2,7 @@ module Fusuma

class StatusBarWindow < NSWindow

include Logger
include Properties

X = Y = 0.0
Expand All @@ -10,6 +11,8 @@ class StatusBarWindow < NSWindow
def init(frame, controller)
@controller = controller

log.info 'Initializing StatusBarWindow'

window = create(Area(frame.origin.x, (frame.origin.y - H), W, H))
window.contentView.addSubview(create_button)
window
Expand Down

0 comments on commit 1c8f942

Please sign in to comment.