pdf_paradise 0.3.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +933 -0
- data/bin/automatic_pdf_title +7 -0
- data/bin/burst_this_pdf_file +7 -0
- data/bin/combine_these_pdf_pages +7 -0
- data/bin/compress_via_hexapdf +7 -0
- data/bin/convert_markdown_to_pdf +7 -0
- data/bin/convert_pdf_to_text +7 -0
- data/bin/delete_first_page_of_this_pdf_file +7 -0
- data/bin/djvu_to_pdf +7 -0
- data/bin/merge_then_open +7 -0
- data/bin/n_pages +10 -0
- data/bin/open_main_pdf +7 -0
- data/bin/pdf_paradise +9 -0
- data/bin/rotate_pdf +7 -0
- data/bin/set_main_book +7 -0
- data/bin/set_title_of_this_pdf_file +15 -0
- data/doc/README.gen +871 -0
- data/doc/todo/todo.md +13 -0
- data/images/Logo_for_the_pdf_paradise_project.avif +0 -0
- data/lib/pdf_paradise/base/base.rb +344 -0
- data/lib/pdf_paradise/base/colours.rb +67 -0
- data/lib/pdf_paradise/colours/colours.rb +27 -0
- data/lib/pdf_paradise/commandline/commandline.rb +109 -0
- data/lib/pdf_paradise/commandline/help.rb +77 -0
- data/lib/pdf_paradise/commandline/menu.rb +173 -0
- data/lib/pdf_paradise/compress/compress_this_pdf_file.rb +108 -0
- data/lib/pdf_paradise/compress/compress_via_hexapdf.rb +27 -0
- data/lib/pdf_paradise/compress/compress_via_qpdf.rb +32 -0
- data/lib/pdf_paradise/constants/constants.rb +76 -0
- data/lib/pdf_paradise/convert_text_to_pdf.rb +94 -0
- data/lib/pdf_paradise/css/project.css +17 -0
- data/lib/pdf_paradise/fpdf/README.md +2 -0
- data/lib/pdf_paradise/fpdf/bookmark.rb +129 -0
- data/lib/pdf_paradise/fpdf/chinese.rb +454 -0
- data/lib/pdf_paradise/fpdf/fpdf.rb +1902 -0
- data/lib/pdf_paradise/fpdf/fpdf_eps.rb +138 -0
- data/lib/pdf_paradise/fpdf/makefont.rb +1794 -0
- data/lib/pdf_paradise/gui/README.md +6 -0
- data/lib/pdf_paradise/gui/fox/split_pdf_file.rb +77 -0
- data/lib/pdf_paradise/gui/gtk2/pdf_viewer/pdf_viewer.rb +34 -0
- data/lib/pdf_paradise/gui/gtk2/split_pdf_file/split_pdf_file.rb +34 -0
- data/lib/pdf_paradise/gui/gtk2/statistics_widget/statistics_widget.rb +34 -0
- data/lib/pdf_paradise/gui/gtk3/controller/controller.rb +214 -0
- data/lib/pdf_paradise/gui/gtk3/pdf_viewer/pdf_viewer.rb +34 -0
- data/lib/pdf_paradise/gui/gtk3/split_pdf_file/split_pdf_file.rb +34 -0
- data/lib/pdf_paradise/gui/jruby/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb +167 -0
- data/lib/pdf_paradise/gui/jruby/remove_the_first_page_of_this_pdf_file/remove_the_first_page_of_this_pdf_file.rb +103 -0
- data/lib/pdf_paradise/gui/libui/extract_all_images_from_this_pdf_file/extract_all_images_from_this_pdf_file.rb +223 -0
- data/lib/pdf_paradise/gui/libui/remove_the_first_page_of_this_pdf_file/remove_the_first_page_of_this_pdf_file.rb +267 -0
- data/lib/pdf_paradise/gui/libui/rotate_pdf_file/rotate_pdf_file.rb +219 -0
- data/lib/pdf_paradise/gui/libui/statistics_widget/statistics_widget.rb +233 -0
- data/lib/pdf_paradise/gui/shared_code/pdf_viewer/pdf_viewer.css +5 -0
- data/lib/pdf_paradise/gui/shared_code/pdf_viewer/pdf_viewer_module.rb +287 -0
- data/lib/pdf_paradise/gui/shared_code/remove_the_first_page_of_this_pdf_file_module/remove_the_first_page_of_this_pdf_file_module.rb +31 -0
- data/lib/pdf_paradise/gui/shared_code/split_pdf_file/split_pdf_file_module.rb +295 -0
- data/lib/pdf_paradise/gui/universal_widgets/convert_pdf_to_text/convert_pdf_to_text.rb +366 -0
- data/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 +776 -0
- data/lib/pdf_paradise/gui/universal_widgets/statistics_widget/statistics_widget.rb +407 -0
- data/lib/pdf_paradise/gui/universal_widgets/to_pdf/to_pdf.rb +351 -0
- data/lib/pdf_paradise/hexapdf/001_rainbow_pattern_example.rb +0 -0
- data/lib/pdf_paradise/hexapdf/hexapdf.rb +123 -0
- data/lib/pdf_paradise/images/PDF_PARADISE_LOGO.png +0 -0
- data/lib/pdf_paradise/main_pdf/main_pdf.rb +474 -0
- data/lib/pdf_paradise/merge_pdf/menu.rb +63 -0
- data/lib/pdf_paradise/merge_pdf/merge_pdf.rb +307 -0
- data/lib/pdf_paradise/merge_pdf_namespace.rb +9 -0
- data/lib/pdf_paradise/merge_then_open/merge_then_open.rb +105 -0
- data/lib/pdf_paradise/prawn_addons/README.md +2 -0
- data/lib/pdf_paradise/prawn_addons/prawn_addons.rb +17 -0
- data/lib/pdf_paradise/project/project.rb +22 -0
- data/lib/pdf_paradise/remove_pdf_password.rb +391 -0
- data/lib/pdf_paradise/requires/batch_require_toplevel_files.rb +22 -0
- data/lib/pdf_paradise/requires/colours.rb +11 -0
- data/lib/pdf_paradise/requires/colours_and_esystem_and_save_file_and_fileutils_and_opn.rb +13 -0
- data/lib/pdf_paradise/requires/esystem_and_colours.rb +11 -0
- data/lib/pdf_paradise/requires/esystem_and_opn_and_colours.rb +10 -0
- data/lib/pdf_paradise/requires/require_the_whole_project.rb +30 -0
- data/lib/pdf_paradise/requires/require_utility_scripts.rb +9 -0
- data/lib/pdf_paradise/set_main_book.rb +156 -0
- data/lib/pdf_paradise/set_pdf_title.rb +220 -0
- data/lib/pdf_paradise/sinatra/embeddable_interface.rb +389 -0
- data/lib/pdf_paradise/toplevel_methods/convert_epub_to_pdf.rb +27 -0
- data/lib/pdf_paradise/toplevel_methods/convert_markdown_to_pdf.rb +45 -0
- data/lib/pdf_paradise/toplevel_methods/convert_ppt_to_pdf.rb +35 -0
- data/lib/pdf_paradise/toplevel_methods/e.rb +16 -0
- data/lib/pdf_paradise/toplevel_methods/esystem.rb +20 -0
- data/lib/pdf_paradise/toplevel_methods/misc.rb +228 -0
- data/lib/pdf_paradise/toplevel_methods/number_pages.rb +38 -0
- data/lib/pdf_paradise/toplevel_methods/opened_pdf_files.rb +221 -0
- data/lib/pdf_paradise/toplevel_methods/query_pdf_title.rb +201 -0
- data/lib/pdf_paradise/toplevel_methods/reduce_size_of_this_pdf_file.rb +46 -0
- data/lib/pdf_paradise/toplevel_methods/roebe.rb +17 -0
- data/lib/pdf_paradise/toplevel_methods/to_pdf.rb +12 -0
- data/lib/pdf_paradise/utility_scripts/README.md +3 -0
- data/lib/pdf_paradise/utility_scripts/automatic_pdf_title.rb +104 -0
- data/lib/pdf_paradise/utility_scripts/check_syntax_of_pdf_files.rb +106 -0
- data/lib/pdf_paradise/utility_scripts/combine_these_pdf_pages.rb +118 -0
- data/lib/pdf_paradise/utility_scripts/convert_pdf_to_text.rb +179 -0
- data/lib/pdf_paradise/utility_scripts/delete_last_page_of_this_pdf_file.rb +180 -0
- data/lib/pdf_paradise/utility_scripts/delete_the_first_page_of_this_pdf_file/delete_the_first_page_of_this_pdf_file.rb +429 -0
- data/lib/pdf_paradise/utility_scripts/delete_this_page_of_this_pdf_file.rb +356 -0
- data/lib/pdf_paradise/utility_scripts/djvu_to_pdf.rb +87 -0
- data/lib/pdf_paradise/utility_scripts/extract_all_images_from_this_pdf_file.rb +129 -0
- data/lib/pdf_paradise/utility_scripts/extract_pdf_page.rb +283 -0
- data/lib/pdf_paradise/utility_scripts/pdf_file_n_total_pages.rb +348 -0
- data/lib/pdf_paradise/utility_scripts/pdf_optimizer.rb +111 -0
- data/lib/pdf_paradise/utility_scripts/pdf_statistics.rb +148 -0
- data/lib/pdf_paradise/utility_scripts/pdf_to_html.rb +75 -0
- data/lib/pdf_paradise/utility_scripts/remove_images.rb +110 -0
- data/lib/pdf_paradise/utility_scripts/rotate_pdf_file.rb +303 -0
- data/lib/pdf_paradise/utility_scripts/split_pdf.rb +364 -0
- data/lib/pdf_paradise/utility_scripts/to_pdf.rb +130 -0
- data/lib/pdf_paradise/utility_scripts/to_qdf.rb +66 -0
- data/lib/pdf_paradise/version/version.rb +19 -0
- data/lib/pdf_paradise/www/README.md +2 -0
- data/lib/pdf_paradise/www/sinatra/app.rb +304 -0
- data/lib/pdf_paradise/yaml/working_on_these_pdf_files.yml +4 -0
- data/lib/pdf_paradise.rb +5 -0
- data/pdf_paradise.gemspec +61 -0
- data/test/fpdf/001_minimal_example.rb +12 -0
- data/test/fpdf/002.pdf +0 -0
- data/test/fpdf/002_header_and_footer_example.rb +64 -0
- data/test/fpdf/003.pdf +98 -0
- data/test/fpdf/003_justified_paragraphs.rb +96 -0
- data/test/fpdf/file1.md +3 -0
- data/test/fpdf/file2.md +3 -0
- data/test/fpdf/test.pdf +0 -0
- data/test/testing_pdf_paradise.rb +12 -0
- metadata +239 -0
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
# =========================================================================== #
|
|
5
|
+
# === PdfParadise::GUI::UniversalWidgets::StatisticsWidget
|
|
6
|
+
#
|
|
7
|
+
# Usage example:
|
|
8
|
+
#
|
|
9
|
+
# PdfParadise::GUI::UniversalWidgets::StatisticsWidget.new(ARGV)
|
|
10
|
+
#
|
|
11
|
+
# =========================================================================== #
|
|
12
|
+
# require 'pdf_paradise/gui/universal_widgets/statistics_widget/statistics_widget.rb'
|
|
13
|
+
# =========================================================================== #
|
|
14
|
+
require 'pdf_paradise/base/base.rb'
|
|
15
|
+
|
|
16
|
+
module PdfParadise
|
|
17
|
+
|
|
18
|
+
module GUI
|
|
19
|
+
|
|
20
|
+
module UniversalWidgets
|
|
21
|
+
|
|
22
|
+
class StatisticsWidget < ::PdfParadise::Base # === PdfParadise::GUI::UniversalWidgets::StatisticsWidget
|
|
23
|
+
|
|
24
|
+
require 'universal_widgets/base_module/base_module.rb'
|
|
25
|
+
include ::UniversalWidgets::BaseModule
|
|
26
|
+
|
|
27
|
+
require 'pdf_paradise/utility_scripts/pdf_file_n_total_pages.rb'
|
|
28
|
+
require 'pdf_paradise/toplevel_methods/automatic_pdf_title.rb'
|
|
29
|
+
require 'pdf_paradise/toplevel_methods/query_pdf_title.rb'
|
|
30
|
+
|
|
31
|
+
# ========================================================================= #
|
|
32
|
+
# === TITLE
|
|
33
|
+
# ========================================================================= #
|
|
34
|
+
TITLE = 'Show statistics about the .pdf file at hand'
|
|
35
|
+
|
|
36
|
+
# ========================================================================= #
|
|
37
|
+
# === FONT_SIZE
|
|
38
|
+
# ========================================================================= #
|
|
39
|
+
FONT_SIZE = 18
|
|
40
|
+
|
|
41
|
+
# ========================================================================= #
|
|
42
|
+
# === USE_THIS_FONT
|
|
43
|
+
# ========================================================================= #
|
|
44
|
+
USE_THIS_FONT = "Liberation serif #{FONT_SIZE}"
|
|
45
|
+
|
|
46
|
+
# ========================================================================= #
|
|
47
|
+
# === USE_THIS_FONT_FOR_THE_DISPLAY_AREA
|
|
48
|
+
# ========================================================================= #
|
|
49
|
+
USE_THIS_FONT_FOR_THE_DISPLAY_AREA = 'DejaVu Sans Mono 18' # :hack_18
|
|
50
|
+
|
|
51
|
+
# ========================================================================= #
|
|
52
|
+
# === WIDTH
|
|
53
|
+
# ========================================================================= #
|
|
54
|
+
WIDTH = '95% or minimum 1820px'
|
|
55
|
+
|
|
56
|
+
# ========================================================================= #
|
|
57
|
+
# === HEIGHT
|
|
58
|
+
# ========================================================================= #
|
|
59
|
+
HEIGHT = '35% or minimum 840px'
|
|
60
|
+
|
|
61
|
+
# ========================================================================= #
|
|
62
|
+
# === LARGER_FONT
|
|
63
|
+
# ========================================================================= #
|
|
64
|
+
LARGER_FONT = :hack_24
|
|
65
|
+
|
|
66
|
+
# ========================================================================= #
|
|
67
|
+
# === SMALLER_FONT
|
|
68
|
+
# ========================================================================= #
|
|
69
|
+
SMALLER_FONT = :hack_28
|
|
70
|
+
|
|
71
|
+
# ========================================================================= #
|
|
72
|
+
# === initialize
|
|
73
|
+
# ========================================================================= #
|
|
74
|
+
def initialize(
|
|
75
|
+
commandline_arguments = nil,
|
|
76
|
+
run_already = true
|
|
77
|
+
)
|
|
78
|
+
super(:vertical) if use_gtk3?
|
|
79
|
+
determine_the_GUI_to_be_used(commandline_arguments) # This must come first, even before reset().
|
|
80
|
+
reset
|
|
81
|
+
set_commandline_arguments(
|
|
82
|
+
commandline_arguments
|
|
83
|
+
)
|
|
84
|
+
run if run_already
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# ========================================================================= #
|
|
88
|
+
# === reset (reset tag)
|
|
89
|
+
# ========================================================================= #
|
|
90
|
+
def reset
|
|
91
|
+
super() if respond_to?(:super)
|
|
92
|
+
reset_the_base_module
|
|
93
|
+
reset_the_internal_variables
|
|
94
|
+
infer_the_namespace
|
|
95
|
+
# ======================================================================= #
|
|
96
|
+
# === @configuration
|
|
97
|
+
# ======================================================================= #
|
|
98
|
+
@configuration = [true, __dir__, namespace?]
|
|
99
|
+
# ======================================================================= #
|
|
100
|
+
# === Set the title, width, height and the font in use.
|
|
101
|
+
# ======================================================================= #
|
|
102
|
+
title_width_height_font(TITLE, WIDTH, HEIGHT, USE_THIS_FONT)
|
|
103
|
+
if use_gtk3?
|
|
104
|
+
append_project_css_file
|
|
105
|
+
use_gtk_paradise_project_css_file
|
|
106
|
+
end
|
|
107
|
+
infer_the_size_automatically
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# ========================================================================= #
|
|
111
|
+
# === do_create_a_new_file_chooser_dialog_and_then_set_the_main_entry_to
|
|
112
|
+
# ========================================================================= #
|
|
113
|
+
def do_create_a_new_file_chooser_dialog_and_then_set_the_main_entry_to(
|
|
114
|
+
i = main_file?.to_s
|
|
115
|
+
)
|
|
116
|
+
create_a_new_file_chooser_dialog(parent_widget?) {{
|
|
117
|
+
filter: '.pdf',
|
|
118
|
+
additional_folders: '/Depot/j/',
|
|
119
|
+
start_directory: '/Depot/'
|
|
120
|
+
}}
|
|
121
|
+
_ = assigned_main_file?.to_s
|
|
122
|
+
if _ and !_.empty?
|
|
123
|
+
main_entry?.set_text(_)
|
|
124
|
+
do_analyse_the_pdf_file
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# ========================================================================= #
|
|
129
|
+
# === create_skeleton (create tag, skeleton tag)
|
|
130
|
+
# ========================================================================= #
|
|
131
|
+
def create_the_skeleton
|
|
132
|
+
create_the_entries
|
|
133
|
+
create_the_buttons
|
|
134
|
+
# ======================================================================= #
|
|
135
|
+
# === @label
|
|
136
|
+
#
|
|
137
|
+
# This label-widget resides on the bottom of the application.
|
|
138
|
+
# ======================================================================= #
|
|
139
|
+
@label = left_aligned_label
|
|
140
|
+
@label.set_font(USE_THIS_FONT_FOR_THE_DISPLAY_AREA)
|
|
141
|
+
|
|
142
|
+
@label.make_selectable
|
|
143
|
+
@hbox_containing_the_entry = create_hbox
|
|
144
|
+
|
|
145
|
+
@arrow_right = emoji(:arrow_right)
|
|
146
|
+
@event_box_arrow_right = create_eventbox(@arrow_right)
|
|
147
|
+
@event_box_arrow_right.on_clicked {
|
|
148
|
+
do_create_a_new_file_chooser_dialog_and_then_set_the_main_entry_to(main_file?)
|
|
149
|
+
}
|
|
150
|
+
@hbox_containing_the_entry.minimal(
|
|
151
|
+
@event_box_arrow_right
|
|
152
|
+
)
|
|
153
|
+
@hbox_containing_the_entry.maximal(@gtk_entry)
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
# ========================================================================= #
|
|
157
|
+
# === parent_widget?
|
|
158
|
+
# ========================================================================= #
|
|
159
|
+
def parent_widget?
|
|
160
|
+
@commandline_arguments.first
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
# ========================================================================= #
|
|
164
|
+
# === create_the_buttons (buttons tag, button tag)
|
|
165
|
+
# ========================================================================= #
|
|
166
|
+
def create_the_buttons
|
|
167
|
+
# ======================================================================= #
|
|
168
|
+
# === @button_choose_file
|
|
169
|
+
# ======================================================================= #
|
|
170
|
+
@button_choose_file = file_chooser_button
|
|
171
|
+
@button_choose_file.hint = 'Click on this button to open a '\
|
|
172
|
+
'local <b>.pdf</b> file.'
|
|
173
|
+
@button_choose_file.on_hover(:lightgreen)
|
|
174
|
+
@button_choose_file.on_clicked {
|
|
175
|
+
do_create_a_new_file_chooser_dialog_and_then_set_the_main_entry_to(main_file?)
|
|
176
|
+
}
|
|
177
|
+
# ======================================================================= #
|
|
178
|
+
# === @button_analyse
|
|
179
|
+
# ======================================================================= #
|
|
180
|
+
@button_analyse = button('_Analyse the .pdf file')
|
|
181
|
+
@button_analyse.on_hover(:lightgreen)
|
|
182
|
+
@button_analyse.hint =
|
|
183
|
+
'Click this button to obtain some information about '\
|
|
184
|
+
'the .pdf file at hand.'
|
|
185
|
+
@button_analyse.on_clicked {
|
|
186
|
+
do_analyse_the_pdf_file
|
|
187
|
+
}
|
|
188
|
+
# ======================================================================= #
|
|
189
|
+
# === @button_auto_title
|
|
190
|
+
# ======================================================================= #
|
|
191
|
+
@button_auto_title = button('Automatic Title')
|
|
192
|
+
@button_auto_title.hint = 'Click on this button to automatically '\
|
|
193
|
+
'determine the title for this .pdf file, based on the filename.'
|
|
194
|
+
@button_auto_title.on_clicked {
|
|
195
|
+
do_automatically_determine_the_title_for_the_pdf_file_at_hand
|
|
196
|
+
}
|
|
197
|
+
# ======================================================================= #
|
|
198
|
+
# === @button_open_via_a_pdf_reader
|
|
199
|
+
# ======================================================================= #
|
|
200
|
+
@button_open_via_a_pdf_reader = button('_Open via a pdf-reader', self, :use_mnemonics) {
|
|
201
|
+
:do_open_the_local_pdf_file_in_the_pdf_reader
|
|
202
|
+
}
|
|
203
|
+
@button_open_via_a_pdf_reader.hint = 'This will open the '\
|
|
204
|
+
'.pdf file in a pdf-reader.'
|
|
205
|
+
return_all_buttons.each {|this_button|
|
|
206
|
+
this_button.bblack1
|
|
207
|
+
}
|
|
208
|
+
@button_auto_title.bblack3
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
# ========================================================================= #
|
|
212
|
+
# === main_entry?
|
|
213
|
+
# ========================================================================= #
|
|
214
|
+
def main_entry?
|
|
215
|
+
@gtk_entry
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
# ========================================================================= #
|
|
219
|
+
# === connect_the_skeleton (connect tag)
|
|
220
|
+
# ========================================================================= #
|
|
221
|
+
def connect_the_skeleton
|
|
222
|
+
abort_on_exception
|
|
223
|
+
|
|
224
|
+
outer_vbox = create_vbox
|
|
225
|
+
|
|
226
|
+
_ = top_bar
|
|
227
|
+
_.add(@button_auto_title)
|
|
228
|
+
_.add(@button_open_via_a_pdf_reader)
|
|
229
|
+
outer_vbox.minimal(_)
|
|
230
|
+
outer_vbox.minimal(
|
|
231
|
+
left_aligned_label(
|
|
232
|
+
'This small widget will show some information about '\
|
|
233
|
+
'the .pdf file at hand.'
|
|
234
|
+
), 8
|
|
235
|
+
)
|
|
236
|
+
outer_vbox.minimal(@hbox_containing_the_entry, 8)
|
|
237
|
+
button_box = button_box(
|
|
238
|
+
@button_choose_file,
|
|
239
|
+
@button_analyse
|
|
240
|
+
) {{ layout: :horizontal,
|
|
241
|
+
padding: 2 }}
|
|
242
|
+
button_box.spacing = 2
|
|
243
|
+
button_box.layout = :expand
|
|
244
|
+
outer_vbox.minimal(button_box, 4)
|
|
245
|
+
outer_vbox.minimal(@label, 4)
|
|
246
|
+
|
|
247
|
+
window = create_window_or_runner(
|
|
248
|
+
widget: outer_vbox,
|
|
249
|
+
width: width?,
|
|
250
|
+
height: height?,
|
|
251
|
+
title: title?,
|
|
252
|
+
font: font?
|
|
253
|
+
)
|
|
254
|
+
|
|
255
|
+
window.set_padding(padding?)
|
|
256
|
+
window.set_border_size(border_size?)
|
|
257
|
+
window.show_all
|
|
258
|
+
Thread.new {
|
|
259
|
+
sleep 0.001
|
|
260
|
+
main_entry?.do_focus
|
|
261
|
+
}
|
|
262
|
+
run_main
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
# ========================================================================= #
|
|
266
|
+
# === create_the_entries
|
|
267
|
+
# ========================================================================= #
|
|
268
|
+
def create_the_entries
|
|
269
|
+
# ======================================================================= #
|
|
270
|
+
# === @gtk_entry
|
|
271
|
+
# ======================================================================= #
|
|
272
|
+
@gtk_entry = create_entry
|
|
273
|
+
@gtk_entry.yellow_background
|
|
274
|
+
@gtk_entry.bblack1
|
|
275
|
+
@gtk_entry.css_class('pad4px')
|
|
276
|
+
@gtk_entry.enable_all_events
|
|
277
|
+
@gtk_entry.on_the_enter_key_was_pressed {
|
|
278
|
+
do_analyse_the_pdf_file
|
|
279
|
+
}
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
# ========================================================================= #
|
|
283
|
+
# === do_analyse_the_pdf_file
|
|
284
|
+
#
|
|
285
|
+
# This is the method that will analyse the .pdf file at hand.
|
|
286
|
+
# ========================================================================= #
|
|
287
|
+
def do_analyse_the_pdf_file
|
|
288
|
+
this_pdf_file = main_entry?.text.to_s
|
|
289
|
+
_ = ''.dup
|
|
290
|
+
_ << "This .pdf file has the following characteristics:\n\n"
|
|
291
|
+
_ << ' <b>n pages</b>: '+::PdfParadise.n_pages?(this_pdf_file).to_s
|
|
292
|
+
_ << "\n"
|
|
293
|
+
use_this_title = ::PdfParadise.title?(this_pdf_file).to_s
|
|
294
|
+
if use_this_title.empty?
|
|
295
|
+
use_this_title = '(This .pdf file has no title)'
|
|
296
|
+
end
|
|
297
|
+
_ << " <b>title</b>: #{use_this_title}"
|
|
298
|
+
_ << "\n"
|
|
299
|
+
@label.set_text(_)
|
|
300
|
+
@label.do_markify
|
|
301
|
+
end
|
|
302
|
+
|
|
303
|
+
# ========================================================================= #
|
|
304
|
+
# === do_automatically_determine_the_title_for_the_pdf_file_at_hand
|
|
305
|
+
# ========================================================================= #
|
|
306
|
+
def do_automatically_determine_the_title_for_the_pdf_file_at_hand
|
|
307
|
+
this_pdf_file = main_entry?.text.to_s
|
|
308
|
+
if this_pdf_file and !this_pdf_file.empty?
|
|
309
|
+
::PdfParadise.automatic_pdf_title(this_pdf_file)
|
|
310
|
+
do_analyse_the_pdf_file
|
|
311
|
+
else
|
|
312
|
+
popup_over_this_widget(
|
|
313
|
+
main_entry?,
|
|
314
|
+
'Please first assign a .pdf file, before '\
|
|
315
|
+
'this functionality can be used.'
|
|
316
|
+
)
|
|
317
|
+
end
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
# ========================================================================= #
|
|
321
|
+
# === do_open_the_local_pdf_file_in_the_pdf_reader
|
|
322
|
+
# ========================================================================= #
|
|
323
|
+
def do_open_the_local_pdf_file_in_the_pdf_reader
|
|
324
|
+
this_pdf_file = main_entry?.text.to_s
|
|
325
|
+
if this_pdf_file and !this_pdf_file.empty?
|
|
326
|
+
Thread.new {
|
|
327
|
+
esystem("evince #{this_pdf_file}")
|
|
328
|
+
}
|
|
329
|
+
else
|
|
330
|
+
popup_over_this_widget(
|
|
331
|
+
main_entry?,
|
|
332
|
+
'Please first assign a .pdf file, before '\
|
|
333
|
+
'this functionality can be used.'
|
|
334
|
+
)
|
|
335
|
+
end
|
|
336
|
+
end
|
|
337
|
+
|
|
338
|
+
# ========================================================================= #
|
|
339
|
+
# === padding?
|
|
340
|
+
# ========================================================================= #
|
|
341
|
+
def padding?
|
|
342
|
+
0
|
|
343
|
+
end
|
|
344
|
+
|
|
345
|
+
# ========================================================================= #
|
|
346
|
+
# === border_size?
|
|
347
|
+
# ========================================================================= #
|
|
348
|
+
def border_size?
|
|
349
|
+
2
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
# ========================================================================= #
|
|
353
|
+
# === run (run tag)
|
|
354
|
+
# ========================================================================= #
|
|
355
|
+
def run
|
|
356
|
+
run_super
|
|
357
|
+
end
|
|
358
|
+
|
|
359
|
+
# ========================================================================= #
|
|
360
|
+
# === PdfParadise::GUI::Gtk::StatisticsWidget.run
|
|
361
|
+
# ========================================================================= #
|
|
362
|
+
def self.run(
|
|
363
|
+
i = ARGV
|
|
364
|
+
)
|
|
365
|
+
require 'gtk_paradise/run'
|
|
366
|
+
_ = ::PdfParadise::GUI::Gtk::StatisticsWidget.new(i)
|
|
367
|
+
r = ::Gtk.run
|
|
368
|
+
r << _
|
|
369
|
+
r.automatic_size
|
|
370
|
+
r.automatic_title
|
|
371
|
+
r.top_left_then_run
|
|
372
|
+
end
|
|
373
|
+
|
|
374
|
+
# ========================================================================= #
|
|
375
|
+
# === PdfParadise::GUI::UniversalWidgets::StatisticsWidget[]
|
|
376
|
+
# ========================================================================= #
|
|
377
|
+
def self.[](i = ARGV)
|
|
378
|
+
new(i)
|
|
379
|
+
end
|
|
380
|
+
|
|
381
|
+
end; end; end
|
|
382
|
+
|
|
383
|
+
# =========================================================================== #
|
|
384
|
+
# === PdfParadise.start_gtk_gui_statistics_widget
|
|
385
|
+
# =========================================================================== #
|
|
386
|
+
def self.start_gtk_gui_statistics_widget
|
|
387
|
+
require 'gtk_paradise/run'
|
|
388
|
+
r = ::Gtk.run
|
|
389
|
+
_ = PdfParadise::GUI::Gtk::StatisticsWidget.new(r)
|
|
390
|
+
r << _
|
|
391
|
+
r.automatic_size
|
|
392
|
+
r.automatic_title
|
|
393
|
+
r.top_left_then_run
|
|
394
|
+
end
|
|
395
|
+
|
|
396
|
+
# =========================================================================== #
|
|
397
|
+
# === PdfParadise.return_widget_about_this_pdf_file
|
|
398
|
+
# =========================================================================== #
|
|
399
|
+
def self.return_widget_about_this_pdf_file
|
|
400
|
+
::PdfParadise::GUI::Gtk::StatisticsWidget.new
|
|
401
|
+
end
|
|
402
|
+
|
|
403
|
+
end
|
|
404
|
+
|
|
405
|
+
if __FILE__ == $PROGRAM_NAME
|
|
406
|
+
PdfParadise::GUI::UniversalWidgets::StatisticsWidget.new(ARGV)
|
|
407
|
+
end # gtk_todo_viewer
|