Class: MainRouter

Inherits:
Gtk::Frame
  • Object
show all
Includes:
ManqodCommon
Defined in:
lib/MainRouter.rb

Overview

this file is part of manqod manqod is distributed under the CDDL licence the author of manqod is Dobai-Pataky Balint([email protected])

Constant Summary

Constants included from ManqodCommon

ManqodCommon::CRITICAL, ManqodCommon::DEBUG, ManqodCommon::ERROR, ManqodCommon::INFO, ManqodCommon::NORMAL, ManqodCommon::WARNING

Constants included from Eprint

Eprint::DOMAIN, Eprint::LEVEL

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ManqodCommon

#add_where, #admin, #admin_cache, #admin_qrow, #admin_rows, #backtrace_to_debug, #cache, #changed_ids_of_base, #client, #client_fields, #client_image_of_id, #client_qrow, #client_query, #client_rows, #eeval, #escape_string, #getBinding, #guess_base, #guess_table, #image_of_id, #lzero, #manqod_db, #measure, #myexec, #nick, #nick_id, #number_format, #qrow, #query, #reconnect_manqod_db, #rows, #run_events, #send_message, #sendmail, #set_manqod_db_uri, #set_nick

Methods included from Eprint

#ecode, #edebug, #eerror, #einfo, #enormal, #eprint, #ewarn, #gtk_set_edebug, #set_edebug, #tell_exception

Constructor Details

#initialize(mainwindow) ⇒ MainRouter

Returns a new instance of MainRouter.



7
8
9
10
11
12
# File 'lib/MainRouter.rb', line 7

def initialize(mainwindow)
	@mainwindow=mainwindow
	@last_notifier=nil
	@mymodule=nil
	super()
end

Instance Attribute Details

#last_notifierObject

Returns the value of attribute last_notifier.



15
16
17
# File 'lib/MainRouter.rb', line 15

def last_notifier
  @last_notifier
end

#mainwindowObject

Returns the value of attribute mainwindow.



13
14
15
# File 'lib/MainRouter.rb', line 13

def mainwindow
  @mainwindow
end

#mymoduleObject

Returns the value of attribute mymodule.



14
15
16
# File 'lib/MainRouter.rb', line 14

def mymodule
  @mymodule
end

#notifierObject

Returns the value of attribute notifier.



15
16
17
# File 'lib/MainRouter.rb', line 15

def notifier
  @notifier
end

Instance Method Details

#reset_childObject



17
18
19
20
21
22
23
24
# File 'lib/MainRouter.rb', line 17

def reset_child
	#used by F5 refresh
unless mymodule.nil?
	child.destroy unless child.destroyed?
	@mymodule=nil
end
@last_notifier=nil
end

#update(notifier) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/MainRouter.rb', line 26

def update(notifier)
	if ['help','quit'].include?(notifier.modname)
		case notifier.modname
			when "quit"
				notifier=last_notifier
				@mainwindow.destroy if @mainwindow.shut_down?
			when "help" then 
				notifier=last_notifier
				ManqodHelp.new.populate.show_all
		end
		else
	mainwindow.window.set_cursor(Gdk::Cursor.new(Gdk::Cursor::WATCH))
	child.destroy unless child.nil?
	@mymodule=nil
	@notifier=notifier
	case notifier.modname
		when "listing" then set_child(Mylist::MyListHolder.new(self))
		when "about" then set_child(About.new())
		when "config" then set_child(MyConfig.new())
		when "relation_builder" then set_child(RelationBuilder.new())
		when "form" then set_child(Myform::MyFormHolder.new("embedded",notifier,"dry",notifier.target))
  end
  @mymodule=child.destroyed? ? nil : child
  Gtk.show_thread_changes

	unless mymodule.nil? || @mainwindow.destroyed?
		begin
			mymodule.update(notifier)
		rescue => err
			tell_exception("internal error occured",backtrace_to_debug(err),"main","error")
		end
		@mainwindow.set_title(mymodule.title)
		mymodule.show_all
		@last_notifier=@notifier
	end
	mainwindow.window.set_cursor(nil) unless @mainwindow.destroyed?
	end
end