Class: Roebe::GUI::LibUI::TodoViewer
- Inherits:
-
Object
- Object
- Roebe::GUI::LibUI::TodoViewer
show all
- Includes:
- LibuiParadise::Extensions
- Defined in:
- lib/roebe/gui/libui/todo_viewer/todo_viewer.rb
Overview
Roebe::GUI::LibUI::TodoViewer
Constant Summary
collapse
- TITLE =
'Todo-Viewer'
- WIDTH =
600
- HEIGHT =
480
- TODO_DIRECTORY =
'/home/x/data/personal/todo/'
Instance Method Summary
collapse
Constructor Details
#initialize(run_already = true) ⇒ TodoViewer
43
44
45
46
47
48
|
# File 'lib/roebe/gui/libui/todo_viewer/todo_viewer.rb', line 43
def initialize(
run_already = true
)
reset
run if run_already
end
|
Instance Method Details
#do_read_in_data_from_this_todo_file(this_todo_file = :pc) ⇒ Object
#
do_read_in_data_from_this_todo_file
#
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
# File 'lib/roebe/gui/libui/todo_viewer/todo_viewer.rb', line 98
def do_read_in_data_from_this_todo_file(
this_todo_file = :pc
)
if this_todo_file.is_a? String
unless File.exist? this_todo_file
this_todo_file = "#{TODO_DIRECTORY}#{this_todo_file}.md"
end
end
if File.exist? this_todo_file
@work_on_this_file = this_todo_file
_ = File.read(@work_on_this_file)
@text_buffer.set_text(_.to_s)
end
end
|
53
54
55
|
# File 'lib/roebe/gui/libui/todo_viewer/todo_viewer.rb', line 53
def reset
title_width_height(TITLE, WIDTH, HEIGHT)
end
|
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
# File 'lib/roebe/gui/libui/todo_viewer/todo_viewer.rb', line 60
def run
if File.directory? TODO_DIRECTORY
cd(TODO_DIRECTORY)
end
window = ui_padded_main_window(title?, width?, height?, 0)
outer_vbox = padded_vbox
button_open_file = button('Open file')
button_open_file.on_clicked {
begin
filename = ui_open_file(window).to_s
do_read_in_data_from_this_todo_file(filename)
rescue ArgumentError => error end
}
hbox_on_top = padded_hbox
button_quit = quit_button
hbox_on_top.maximal(button_open_file)
hbox_on_top.maximal(button_quit)
outer_vbox.minimal(hbox_on_top)
outer_vbox.add_hsep
@text_buffer = ui_text_view
outer_vbox.minimal(hspacer, 0)
outer_vbox << @text_buffer
window.add(outer_vbox)
window.intelligent_exit
end
|