Class: RunQuery

Inherits:
Gtk::Window
  • Object
show all
Includes:
ManqodCommon
Defined in:
lib/RelationBuilder/RunQuery.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 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(rb) ⇒ RunQuery

Returns a new instance of RunQuery.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/RelationBuilder/RunQuery.rb', line 7

def initialize(rb)
	@rb=rb
	super()
	whsv=false
	begin
		whsv=Gtk::SourceView::BUILD_VERSION
		rescue => err
		einfo("no Gtk::SourceView, falling back")
	end
	set_size_request(600,300)
	set_destroy_with_parent(true)
	set_modal(true)
	set_window_position(Gtk::Window::POS_CENTER_ON_PARENT)
	set_decorated(true)
	#hide on escape
	signal_connect("key-release-event"){|me,ev| hide if ev.keyval == Gdk::Keyval::GDK_KEY_Escape}
	@ag=Gtk::AccelGroup.new
	@ag.connect(Gdk::Keyval::GDK_KEY_q, Gdk::Window::CONTROL_MASK, Gtk::ACCEL_VISIBLE){show_all}
	
	add(Gtk::VBox.new.
		pack_start(@widget=whsv ? Gtk::SourceView.new : Gtk::TextView.new,true,true).
		pack_start(Gtk::HBox.new.pack_start(Gtk::Label.new).
			pack_start(runb=Gtk::Button.new("Run"),false,false),false,false)
	)
	if whsv
		@widget.buffer.set_language(Gtk::SourceLanguageManager.new.get_language("sql"))
		@widget.set_auto_indent(true).
		set_highlight_current_line(true).
		set_indent_on_tab(true).
		set_show_line_numbers(true).
		set_indent_on_tab(true).
		set_indent_width(4)
	end
	@widget.set_editable(true)
	runb.signal_connect('clicked'){|me|
		client_query(@widget.buffer.text)
	}
end

Instance Method Details

#hideObject



46
47
48
49
# File 'lib/RelationBuilder/RunQuery.rb', line 46

def hide
	super
	@rb.set_focused_item(nil)
end

#update(win) ⇒ Object



50
51
52
53
# File 'lib/RelationBuilder/RunQuery.rb', line 50

def update(win)
	win.add_accel_group(@ag)
	set_transient_for(win)
end