Class: PdfParadise::GUI::UniversalWidgets::DeleteTheFirstOrTheLastPageOfThisPdfFile
- Inherits:
-
Base
- Object
- Base
- PdfParadise::GUI::UniversalWidgets::DeleteTheFirstOrTheLastPageOfThisPdfFile
show all
- Includes:
- UniversalWidgets::BaseModule
- Defined in:
- lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb
Overview
PdfParadise::GUI::UniversalWidgets::DeleteTheFirstOrTheLastPageOfThisPdfFile
Constant Summary
collapse
- TITLE =
'Remove a specific page from a .pdf file.'
- DENOTE_WHICH_PDF_PAGE_IS_TO_BE_REMOVED =
#
DENOTE_WHICH_PDF_PAGE_IS_TO_BE_REMOVED
#
'Denote which .pdf page (as a number) is to be removed '
- FONT_SIZE_LARGE =
30
- FONT_SIZE =
18
- USE_THIS_FONT =
:dejavu_condensed_24
- SMALLER_FONT =
:dejavu_condensed_22
- HEIGHT_FOR_THE_SECOND_ENTRY =
#
HEIGHT_FOR_THE_SECOND_ENTRY
#
40
- LABEL_SET_THE_PATH_TO_THE_PDF_FILE_BELOW_THIS_TEXT_HERE =
#
LABEL_SET_THE_PATH_TO_THE_PDF_FILE_BELOW_THIS_TEXT_HERE
#
'Set the path to the .pdf file below this text here.'
- ARRAY_ADD_THESE_SHORTCUT_FOLDERS =
#
ARRAY_ADD_THESE_SHORTCUT_FOLDERS
#
[
'/',
'/Depot/j/',
'/Depot/PDF/'
]
- USE_THIS_FONT_FOR_THE_DISPLAY_AREA =
#
USE_THIS_FONT_FOR_THE_DISPLAY_AREA
#
'DejaVu Sans Mono 18'
- WIDTH =
'52% or minimum 1500px'
- HEIGHT =
'45% or minimum 500px'
- LARGER_FONT =
:hack_24
Constants inherited
from Base
Base::NAMESPACE
Class Method Summary
collapse
-
.[](i = ARGV) ⇒ Object
# === PdfParadise::GUI::UniversalWidgets::DeleteTheFirstOrTheLastPageOfThisPdfFile[] ========================================================================= #.
-
.run(i = ARGV) ⇒ Object
# === PdfParadise::GUI::Gtk::DeleteTheFirstOrTheLastPageOfThisPdfFile.run ========================================================================= #.
Instance Method Summary
collapse
Methods inherited from Base
#basename, #be_verbose?, #change_directory, #commandline_arguments?, #copy_file, #delete_file, #e, #ecomment, #esystem, #first_argument?, #gold, #infer_the_namespace, #input_without_leading_hyphens?, #internal_hash?, #is_an_image_file?, #is_on_roebe?, #lightsteelblue, #log_dir?, #mkdir, #mv, #n_pages?, #namespace?, #no_file_at, #opne, #opnn, #orange, #reset_the_internal_hash, #return_commandline_arguments_starting_with_hyphens, #return_files_from_the_commandline_arguments, #return_pwd, #rev, #set_be_quiet, #set_commandline_arguments, #steelblue, #try_to_ensure_that_this_directory_exists, #write_what_into
Constructor Details
111
112
113
114
115
116
117
118
119
120
121
122
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 111
def initialize(
commandline_arguments = nil,
run_already = true
)
super(:vertical) if use_gtk3?
determine_the_GUI_to_be_used(commandline_arguments) reset
set_commandline_arguments(
commandline_arguments
)
run if run_already
end
|
Class Method Details
.[](i = ARGV) ⇒ Object
#
PdfParadise::GUI::UniversalWidgets::DeleteTheFirstOrTheLastPageOfThisPdfFile[]
#
743
744
745
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 743
def self.[](i = ARGV)
new(i)
end
|
.run(i = ARGV) ⇒ Object
#
PdfParadise::GUI::Gtk::DeleteTheFirstOrTheLastPageOfThisPdfFile.run
#
728
729
730
731
732
733
734
735
736
737
738
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 728
def self.run(
i = ARGV
)
require 'gtk_paradise/run'
_ = ::PdfParadise::GUI::Gtk::DeleteTheFirstOrTheLastPageOfThisPdfFile.new(i)
r = ::Gtk.run
r << _
r.automatic_size
r.automatic_title
r.top_left_then_run
end
|
Instance Method Details
#border_size? ⇒ Boolean
493
494
495
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 493
def border_size?
2
end
|
#button_remove_the_specified_page? ⇒ Boolean
#
button_remove_the_specified_page?
#
557
558
559
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 557
def button_remove_the_specified_page?
@button_remove_the_specified_page
end
|
#checkbox_shall_we_overwrite_the_original_pdf_file? ⇒ Boolean
Also known as:
main_checkbox?
#
checkbox_shall_we_overwrite_the_original_pdf_file
#
379
380
381
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 379
def checkbox_shall_we_overwrite_the_original_pdf_file?
@checkbox_shall_we_overwrite_the_original_pdf_file
end
|
#connect_the_skeleton ⇒ Object
#
connect_the_skeleton (connect tag)
#
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 171
def connect_the_skeleton
abort_on_exception
outer_vbox = create_vbox
grid = default_grid grid.uniform_spacing(18)
populate_the_grid(grid)
right_side = create_vbox right_side.minimal(@button_remove_the_first_page_of_the_pdf_file, 2)
right_side.minimal(@button_remove_the_last_page_of_the_pdf_file, 2)
right_side.minimal(@button_remove_the_specified_page_of_the_pdf_file, 2)
right_side.minimal(@button_pdf_viewer, 2)
right_side.minimal(@button_file_chooser, 2)
right_side.show_all
_ = drag_from_left_to_right(
grid,
right_side
)
outer_vbox.minimal(_)
window = create_window_or_runner(
widget: outer_vbox,
width: width?,
height: height?,
title: title?,
font: font?
)
window.set_padding(padding?)
window.set_border_size(border_size?)
window.show_all
Thread.new {
sleep 0.001
main_entry?.do_focus
}
do_parse_the_commandline_arguments
run_main
end
|
#create_and_then_return_the_label_that_shows_how_many_pages_are_in_the_given_pdf_file ⇒ Object
#
create_and_then_return_the_label_that_shows_how_many_pages_are_in_the_given_pdf_file
#
682
683
684
685
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 682
def create_and_then_return_the_label_that_shows_how_many_pages_are_in_the_given_pdf_file
@label_n_pages_in_the_pdf_file = text
return @label_n_pages_in_the_pdf_file
end
|
#
This method can be used to create all buttons in this small application.
#
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 614
def create_the_buttons
create_the_open_in_pdf_viewer_button
create_the_remove_the_first_page_of_the_pdf_file_button
create_the_remove_the_last_page_of_the_pdf_file_button
create_the_remove_the_specified_page_of_the_pdf_file_button
create_the_file_chooser_button
create_the_remove_the_specified_page_button
@extra_button = button('_Extra button')
@extra_button.on_clicked { e ' > Extra button was clicked' }
end
|
#create_the_checkboxes ⇒ Object
#
create_the_checkboxes
#
386
387
388
389
390
391
392
393
394
395
396
397
398
399
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 386
def create_the_checkboxes
@checkbox_shall_we_overwrite_the_original_pdf_file = create_checkbox(:is_checked)
@checkbox_shall_we_overwrite_the_original_pdf_file.set_text(
'overwrite the original .pdf file'
)
@checkbox_shall_we_overwrite_the_original_pdf_file.hint =
'If this checkbox is active, then the original .pdf file '\
'will NOT be overwritten. This is sometimes necessary, such as '\
'on windows if you lack proper permission to do the file operation '\
'at hand.'
end
|
#create_the_entries ⇒ Object
Also known as:
create_entries
#
create_the_entries (entries tag)
#
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 531
def create_the_entries
_ = create_entry('')
_.highlight_on_click_event
_.add_css_class('BG_floralwhite')
_.pad4px
_.width_height(200, HEIGHT_FOR_THE_SECOND_ENTRY)
@entry_for_the_path_to_the_pdf_file = _
@entry_remove_this_pdf_page = create_entry
@entry_remove_this_pdf_page.highlight_on_click_event
@entry_remove_this_pdf_page.bblack1
@entry_remove_this_pdf_page.add_css_class(
'BG_floralwhite'
)
@entry_remove_this_pdf_page.align_to_the_center
@entry_remove_this_pdf_page.set_size_request(160, HEIGHT_FOR_THE_SECOND_ENTRY)
end
|
214
215
216
217
218
219
220
221
222
223
224
225
226
227
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 214
def create_the_file_chooser_button
@button_file_chooser = bold_button('🗄️ _Choose a file', self, :use_mnemonics) {
:open_file_chooser_dialog
}
@button_file_chooser.hint =
'Click this button to select a file. It will then appear in the '\
'entry on the top-left part of this widget.'
@button_file_chooser.clear_background
@button_file_chooser.skyblue
@button_file_chooser.bblack2
end
|
#create_the_labels ⇒ Object
514
515
516
517
518
519
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 514
def create_the_labels
@text_for_notifications = text
end
|
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 690
def create_the_open_in_pdf_viewer_button
@button_pdf_viewer = button('Open in pdf viewer')
@button_pdf_viewer.hint =
'Click this button to open the .pdf file in the pdf viewer.'
@button_pdf_viewer.clear_background
@button_pdf_viewer.skyblue
@button_pdf_viewer.bblack2
@button_pdf_viewer.on_clicked {
target_file = main_entry?.text?.to_s
if target_file and File.exist?(target_file)
do_determine_how_many_pages_are_in_the_pdf_file
system("evince #{target_file}")
else
bold_popover_message = bold_text(
'Please assign an existing .pdf file in the top-left entry.'
)
bold_popover_message.set_font(default_font?)
popover_message(
bold_popover_message,
main_entry?
).
end
}
end
|
#create_the_remove_the_first_page_of_the_pdf_file_button ⇒ Object
#
create_the_remove_the_first_page_of_the_pdf_file_button
#
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 659
def create_the_remove_the_first_page_of_the_pdf_file_button
_ = bold_button('Remove the _first page')
_.clear_background
_.skyblue
_.bblack2
_.do_use_mnemonic
_.hint =
"<b>Click</b> on this button to remove the first page of the "\
"designated <b>.pdf</b> file.\n\n"\
"Do not forget to make sure that the .pdf file exists at that "\
"location.\n"\
"Note that the program called qpdf has to be installed as well."
_.on_clicked {
do_determine_how_many_pages_are_in_the_pdf_file
do_remove_the_first_page_of_the_pdf_file
do_determine_how_many_pages_are_in_the_pdf_file
}
@button_remove_the_first_page_of_the_pdf_file = _
end
|
#create_the_remove_the_last_page_of_the_pdf_file_button ⇒ Object
#
create_the_remove_the_last_page_of_the_pdf_file_button
#
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 254
def create_the_remove_the_last_page_of_the_pdf_file_button
@button_remove_the_last_page_of_the_pdf_file = bold_button('Remove the _last page')
@button_remove_the_last_page_of_the_pdf_file.clear_background
@button_remove_the_last_page_of_the_pdf_file.skyblue
@button_remove_the_last_page_of_the_pdf_file.bblack2
@button_remove_the_last_page_of_the_pdf_file.do_use_mnemonic
@button_remove_the_last_page_of_the_pdf_file.hint =
" <b>Click</b> on this button to remove the last page of the pdf file.\n"\
"Do not forget to make sure that the .pdf file exists at that location."
@button_remove_the_last_page_of_the_pdf_file.on_clicked {
do_determine_how_many_pages_are_in_the_pdf_file
do_remove_the_last_page_of_the_pdf_file
do_determine_how_many_pages_are_in_the_pdf_file
}
end
|
#create_the_remove_the_specified_page_button ⇒ Object
#
create_the_remove_the_specified_page_button
#
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 640
def create_the_remove_the_specified_page_button
@button_remove_the_specified_page = button('🗙')
@button_remove_the_specified_page.hint =
'Click this button in order to remove the specified page '\
'from the .pdf document at hand.'
@button_remove_the_specified_page.on_clicked {
do_determine_how_many_pages_are_in_the_pdf_file
do_remove_this_page(entry_remove_this_pdf_page?.text?)
do_determine_how_many_pages_are_in_the_pdf_file
}
@button_remove_the_specified_page.set_size_request(100, HEIGHT_FOR_THE_SECOND_ENTRY)
@button_remove_the_specified_page.bblack1
@button_remove_the_specified_page.disallow_resizing
return @button_remove_the_specified_page
end
|
#create_the_remove_the_specified_page_of_the_pdf_file_button ⇒ Object
#
create_the_remove_the_specified_page_of_the_pdf_file_button
#
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 232
def create_the_remove_the_specified_page_of_the_pdf_file_button
_ = bold_button('Remove the _specified page')
_.clear_background
_.skyblue
_.bblack2
_.do_use_mnemonic
_.hint =
" <b>Click</b> on this button to remove the specified page of the pdf file.\n"\
"Do not forget to make sure that the .pdf file exists at that location, in "\
"the top-left entry; and make sure that a number is input in the second "\
"entry below."
_.on_clicked {
do_determine_how_many_pages_are_in_the_pdf_file
do_remove_the_specified_page_of_the_pdf_file
do_determine_how_many_pages_are_in_the_pdf_file
}
@button_remove_the_specified_page_of_the_pdf_file = _
end
|
#create_the_skeleton ⇒ Object
#
create_the_skeleton (create tag, skeleton tag)
#
161
162
163
164
165
166
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 161
def create_the_skeleton
create_the_entries
create_the_buttons
create_the_labels
create_the_checkboxes
end
|
#create_the_text_above_the_main_entry ⇒ Object
#
create_the_text_above_the_main_entry
#
597
598
599
600
601
602
603
604
605
606
607
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 597
def create_the_text_above_the_main_entry
@text_above_the_main_entry = bold_label(
LABEL_SET_THE_PATH_TO_THE_PDF_FILE_BELOW_THIS_TEXT_HERE
) {{
tooltip: 'You need to supply the path to the .pdf file '\
'into the entry below this text.'
}}
end
|
#default_font? ⇒ Boolean
507
508
509
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 507
def default_font?
USE_THIS_FONT
end
|
#do_determine_how_many_pages_are_in_the_pdf_file ⇒ Object
Also known as:
update_n_pages
#
do_determine_how_many_pages_are_in_the_pdf_file
This method should ideally be called only when the .pdf file at hand exists.
#
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 279
def do_determine_how_many_pages_are_in_the_pdf_file
main_entry = main_entry?
if main_entry and main_entry.respond_to?(:text?)
this_file = main_entry?.text?.to_s
if File.exist? this_file
n_pages = PdfParadise.n_pages_in_this_pdf_file?(this_file)
_ = 'The <b>.pdf</b> file at <b>'+this_file+'</b> contains '\
'<b>'+n_pages.to_s+'</b> pages.'
@label_n_pages_in_the_pdf_file.set_text(_)
else
@label_n_pages_in_the_pdf_file.set_text('')
end
@label_n_pages_in_the_pdf_file.do_markify
@label_n_pages_in_the_pdf_file.make_selectable
end
end
|
#do_parse_the_commandline_arguments ⇒ Object
#
do_parse_the_commandline_arguments
#
348
349
350
351
352
353
354
355
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 348
def do_parse_the_commandline_arguments
commandline_arguments?.each {|this_entry|
if this_entry and File.exist?(this_entry)
this_entry = File.absolute_path(this_entry)
set_use_this_pdf_file(this_entry)
end
}
end
|
#do_remove_the_first_page_of_the_pdf_file ⇒ Object
#
do_remove_the_first_page_of_the_pdf_file
This is the main action of this class.
#
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 318
def do_remove_the_first_page_of_the_pdf_file
e 'Now removing the first .pdf page.'
target_file = entry_for_the_path_to_the_pdf_file?.text?
if File.exist?(target_file)
PdfParadise.remove_the_first_page_of_this_pdf_file(
target_file
)
update_all_done_finished_at
else
no_file_was_found_at(target_file)
end
end
|
#do_remove_the_last_page_of_the_pdf_file ⇒ Object
#
do_remove_the_last_page_of_the_pdf_file
#
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 578
def do_remove_the_last_page_of_the_pdf_file
e 'Now removing the last .pdf page.'
target_file = entry_for_the_path_to_the_pdf_file?.text.to_s
if File.exist?(target_file)
PdfParadise.remove_the_last_page_of_this_pdf_file(
target_file
)
update_all_done_finished_at
else
no_file_was_found_at(target_file)
end
end
|
#do_remove_the_specified_page_of_the_pdf_file ⇒ Object
#
do_remove_the_specified_page_of_the_pdf_file
#
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 360
def do_remove_the_specified_page_of_the_pdf_file
_ = main_entry?.text?
this_page = which_page?
if File.exist? _
update_n_pages
if checkbox_shall_we_overwrite_the_original_pdf_file?.is_active?
PdfParadise.remove_this_page_from_that_pdf_file(this_page, _) {
:do_not_overwrite_the_original_pdf_file
}
else
PdfParadise.remove_this_page_from_that_pdf_file(this_page, _)
end
update_n_pages
end
end
|
#do_remove_this_page(i = entry_remove_this_pdf_page?.text?, target_file = entry_for_the_path_to_the_pdf_file?.text.to_s) ⇒ Object
299
300
301
302
303
304
305
306
307
308
309
310
311
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 299
def do_remove_this_page(
i = entry_remove_this_pdf_page?.text?,
target_file = entry_for_the_path_to_the_pdf_file?.text.to_s
)
if File.exist?(target_file)
PdfParadise.remove_this_page_of_that_pdf_file(
i, target_file
)
update_all_done_finished_at
else
no_file_was_found_at(target_file)
end
end
|
#entry_for_the_path_to_the_pdf_file? ⇒ Boolean
Also known as:
main_entry?, top_entry?
#
entry_for_the_path_to_the_pdf_file?
#
469
470
471
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 469
def entry_for_the_path_to_the_pdf_file?
@entry_for_the_path_to_the_pdf_file
end
|
#entry_remove_this_pdf_page? ⇒ Boolean
#
entry_remove_this_pdf_page?
#
500
501
502
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 500
def entry_remove_this_pdf_page?
@entry_remove_this_pdf_page
end
|
#open_file_chooser_dialog ⇒ Object
#
open_file_chooser_dialog (open tag)
#
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 432
def open_file_chooser_dialog
current_directory = return_pwd
if is_on_roebe? and File.directory?('/Depot/j/')
current_directory = '/Depot/j/'
end
filename = ::Gtk.select_file(parent_widget?) {{
current_directory: current_directory,
show_hidden: true,
extra_widget: @extra_button,
add_these_shortcut_folders: ARRAY_ADD_THESE_SHORTCUT_FOLDERS,
use_this_file_filter: '*.pdf'
}}
if filename and filename.end_with? '.pdf'
entry_for_the_path_to_the_pdf_file?.set_text(filename.to_s)
do_determine_how_many_pages_are_in_the_pdf_file
else
bold_popover_message = bold_text(
'Please assign an existing .pdf file in the top-left entry.'
)
bold_popover_message.set_font(default_font?)
popover_message(
bold_popover_message,
main_entry?
).
end
end
|
#padding? ⇒ Boolean
486
487
488
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 486
def padding?
4
end
|
564
565
566
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 564
def parent_widget?
@parent_widget
end
|
#populate_the_grid(grid) ⇒ Object
#
populate_the_grid (grid tag)
#
150
151
152
153
154
155
156
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 150
def populate_the_grid(grid)
grid.full_row(return_set_the_path_to_the_pdf_file_below_widget)
grid.full_row(return_text_and_entry_remove_this_pdf_page)
grid.full_row(checkbox_shall_we_overwrite_the_original_pdf_file?)
grid.full_row(create_and_then_return_the_label_that_shows_how_many_pages_are_in_the_given_pdf_file)
grid.full_row(text_for_notifications?)
end
|
#reset ⇒ Object
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 127
def reset
super() if respond_to?(:super)
reset_the_base_module
reset_the_internal_variables
infer_the_namespace
@configuration = [true, __dir__, namespace?]
title_width_height_font(TITLE, WIDTH, HEIGHT, USE_THIS_FONT)
if use_gtk3?
append_project_css_file
use_gtk_paradise_project_css_file
end
infer_the_size_automatically
end
|
421
422
423
424
425
426
427
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 421
def return_set_the_path_to_the_pdf_file_below_widget
_ = create_vbox
create_the_text_above_the_main_entry
_.minimal(@text_above_the_main_entry, 4)
_.minimal(main_entry?, 4)
return _
end
|
#return_text_and_entry_remove_this_pdf_page ⇒ Object
#
return_text_and_entry_remove_this_pdf_page
#
404
405
406
407
408
409
410
411
412
413
414
415
416
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 404
def return_text_and_entry_remove_this_pdf_page
_ = create_vbox
_.minimal(
left_aligned_bold_text(
DENOTE_WHICH_PDF_PAGE_IS_TO_BE_REMOVED
), 4
)
mini_hbox = create_hbox
mini_hbox.maximal(@entry_remove_this_pdf_page, 4)
mini_hbox.minimal(@button_remove_the_specified_page, 4)
_.maximal(mini_hbox)
return _
end
|
#run ⇒ Object
721
722
723
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 721
def run
run_super
end
|
571
572
573
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 571
def set_parent_widget(i)
@parent_widget = i
end
|
#set_use_this_pdf_file(i, main_entry = main_entry?
) ⇒ Object
#
set_use_this_pdf_file
#
477
478
479
480
481
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 477
def set_use_this_pdf_file(
i, main_entry = main_entry?
)
main_entry.set_text(i.to_s) if main_entry
end
|
#text_for_notifications? ⇒ Boolean
#
text_for_notifications?
#
524
525
526
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 524
def text_for_notifications?
@text_for_notifications
end
|
#update_all_done_finished_at ⇒ Object
#
update_all_done_finished_at
#
337
338
339
340
341
342
343
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 337
def update_all_done_finished_at
@text_for_notifications.set_text(
'All done! Finished at <b>'+Time.now.to_s+'</b>'
)
@text_for_notifications.do_markify
@text_for_notifications.make_selectable
end
|
#which_page? ⇒ Boolean
462
463
464
|
# File 'lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb', line 462
def which_page?
entry_remove_this_pdf_page?.text?.to_i
end
|