Class: PdfParadise::GUI::LibUI::RotatePdfFile
- Inherits:
-
Object
- Object
- PdfParadise::GUI::LibUI::RotatePdfFile
- Includes:
- LibuiParadise::Extensions
- Defined in:
- lib/pdf_paradise/gui/libui/rotate_pdf_file/rotate_pdf_file.rb
Overview
PdfParadise::GUI::LibUI::RotatePdfFile
Constant Summary collapse
- TITLE =
#
TITLE
#
'Rotate .pdf file'
- WIDTH =
#
WIDTH
#
800
- HEIGHT =
#
HEIGHT
#
680
Instance Method Summary collapse
-
#create_skeleton ⇒ Object
# === create_skeleton (create tag, skeleton tag) ========================================================================= #.
-
#create_the_entries ⇒ Object
# === create_the_entries ========================================================================= #.
-
#do_parse_the_commandline_arguments ⇒ Object
# === do_parse_the_commandline_arguments ========================================================================= #.
-
#do_rotate_the_pdf_file(this_pdf_file = @entry_work_on_this_pdf_file.text?) ⇒ Object
# === do_rotate_the_pdf_file ========================================================================= #.
-
#initialize(optional_commandline_arguments = [], run_already = true) ⇒ RotatePdfFile
constructor
# === initialize ========================================================================= #.
-
#main_entry? ⇒ Boolean
# === main_entry? ========================================================================= #.
-
#reset ⇒ Object
# === reset (reset tag) ========================================================================= #.
-
#return_the_file_open_button ⇒ Object
# === return_the_file_open_button ========================================================================= #.
-
#run ⇒ Object
# === run ========================================================================= #.
-
#set_work_on_this_file(i) ⇒ Object
# === set_work_on_this_file ========================================================================= #.
Constructor Details
#initialize(optional_commandline_arguments = [], run_already = true) ⇒ RotatePdfFile
#
initialize
#
46 47 48 49 50 51 52 53 |
# File 'lib/pdf_paradise/gui/libui/rotate_pdf_file/rotate_pdf_file.rb', line 46 def initialize( optional_commandline_arguments = [], run_already = true ) reset @commandline_arguments = [optional_commandline_arguments].flatten.compact run if run_already end |
Instance Method Details
#create_skeleton ⇒ Object
#
create_skeleton (create tag, skeleton tag)
#
69 70 71 72 73 74 75 |
# File 'lib/pdf_paradise/gui/libui/rotate_pdf_file/rotate_pdf_file.rb', line 69 def create_skeleton # ======================================================================= # # === @window # ======================================================================= # @window = ui_padded_main_window(title?, width?, height?, 0) create_the_entries end |
#create_the_entries ⇒ Object
#
create_the_entries
#
80 81 82 83 84 85 |
# File 'lib/pdf_paradise/gui/libui/rotate_pdf_file/rotate_pdf_file.rb', line 80 def create_the_entries # ======================================================================= # # === @entry_work_on_this_pdf_file # ======================================================================= # @entry_work_on_this_pdf_file = entry end |
#do_parse_the_commandline_arguments ⇒ Object
#
do_parse_the_commandline_arguments
#
197 198 199 200 201 202 203 204 205 206 |
# File 'lib/pdf_paradise/gui/libui/rotate_pdf_file/rotate_pdf_file.rb', line 197 def do_parse_the_commandline_arguments _ = @commandline_arguments if _ and _.is_a?(Array) and !_.empty? _.each {|entry| if File.exist? entry set_work_on_this_file(entry) end } end end |
#do_rotate_the_pdf_file(this_pdf_file = @entry_work_on_this_pdf_file.text?) ⇒ Object
#
do_rotate_the_pdf_file
#
115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/pdf_paradise/gui/libui/rotate_pdf_file/rotate_pdf_file.rb', line 115 def do_rotate_the_pdf_file( this_pdf_file = @entry_work_on_this_pdf_file.text? ) PdfParadise.cd_to_the_log_dir # Make sure we are in the log dir. @_.do_rotate_the_pdf_file(this_pdf_file) # , :be_quiet) LibuiParadise.( 'If everything went fine then you should now be able '\ 'to see the newly rotated .pdf file in the '\ 'directory `'+return_pwd+'`.'+ "\n\nFull path should be at:\n\n"\ " #{return_pwd.strip}#{rotated_pdf_file_.pdf}\n" ) end |
#main_entry? ⇒ Boolean
#
main_entry?
#
90 91 92 |
# File 'lib/pdf_paradise/gui/libui/rotate_pdf_file/rotate_pdf_file.rb', line 90 def main_entry? @entry_work_on_this_pdf_file end |
#reset ⇒ Object
#
reset (reset tag)
#
58 59 60 61 62 63 64 |
# File 'lib/pdf_paradise/gui/libui/rotate_pdf_file/rotate_pdf_file.rb', line 58 def reset title_width_height(TITLE, WIDTH, HEIGHT) # ======================================================================= # # === @_ # ======================================================================= # @_ = PdfParadise::RotatePdfFile.new(:do_not_run_yet) end |
#return_the_file_open_button ⇒ Object
#
return_the_file_open_button
#
97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/pdf_paradise/gui/libui/rotate_pdf_file/rotate_pdf_file.rb', line 97 def = ('Open file') .on_clicked { begin filename = ui_open_file(@window).to_s # This is the part that will open a local file. if filename and !filename.empty? filename = File.absolute_path(filename) main_entry?.set_text(filename) end rescue Exception end } return end |
#run ⇒ Object
#
run
#
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
# File 'lib/pdf_paradise/gui/libui/rotate_pdf_file/rotate_pdf_file.rb', line 132 def run PdfParadise.ensure_that_the_log_directory_exists PdfParadise.cd_to_the_log_directory create_skeleton_then_connect_skeleton outer_vbox = padded_vbox # ======================================================================= # # First add the two buttons on top: # ======================================================================= # = ('Rotate the .pdf file') .on_clicked { do_rotate_the_pdf_file } outer_vbox.add_hsep grid = ui_padded_grid # widget, left, top, xspan, yspan, hexpand, halign, vexpand, valign grid.ui_grid_append(text('Work on this .pdf file → '), 0, 0, 1, 1, 0, 0.5, 0, 0) grid.ui_grid_append(main_entry?, 1, 0, 2, 1, 1, 0.5, 0, 0) grid.hash_grid( , left: 0, top: 1, xspan: 1, yspan: 1, hexpand: 0, halign: 0.5, vexpand: 0, valign: 0 ) grid.hash_grid( , left: 1, top: 1, xspan: 1, yspan: 1, hexpand: 0, halign: 0.5, vexpand: 0, valign: 0 ) grid.hash_grid( text('Current working directory: '+return_pwd), left: 2, top: 1, xspan: 1, yspan: 1, hexpand: 0, halign: 0.5, vexpand: 0, valign: 0 ) outer_vbox.minimal(grid, 0) outer_vbox.add_hsep outer_vbox.minimal() outer_vbox.add_hsep ::LibuiParadise.set_main_window(@window) do_parse_the_commandline_arguments @window.add(outer_vbox) @window.intelligent_exit end |
#set_work_on_this_file(i) ⇒ Object
#
set_work_on_this_file
#
211 212 213 |
# File 'lib/pdf_paradise/gui/libui/rotate_pdf_file/rotate_pdf_file.rb', line 211 def set_work_on_this_file(i) @entry_work_on_this_pdf_file.set_text(i) end |