Class: PdfParadise::GUI::Gtk::Controller

Inherits:
Gtk::Box
  • Object
show all
Includes:
Gtk::BaseModule
Defined in:
lib/pdf_paradise/gui/gtk3/controller/controller.rb

Overview

PdfParadise::GUI::Gtk::Controller

Constant Summary collapse

NAMESPACE =
#

NAMESPACE

#
inspect
TITLE =
#

TITLE

#
'.pdf-related actions'
WIDTH =
#

WIDTH

#
1400
HEIGHT =
#

HEIGHT

#
1000
USE_THIS_FONT =
#

USE_THIS_FONT

#
:dejavu_condensed_22

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(commandline_arguments = ARGV, run_already = true) ⇒ Controller

#

initialize

#


56
57
58
59
60
61
62
63
64
65
66
# File 'lib/pdf_paradise/gui/gtk3/controller/controller.rb', line 56

def initialize(
    commandline_arguments = ARGV,
    run_already           = true
  )
  super(:horizontal)
  reset
  set_commandline_arguments(
    commandline_arguments
  )
  run if run_already
end

Class Method Details

.run(i = ARGV) ⇒ Object

#

PdfParadise::GUI::Gtk::Controller.run

#


199
200
201
202
203
204
205
206
207
208
# File 'lib/pdf_paradise/gui/gtk3/controller/controller.rb', line 199

def self.run(
    i = ARGV
  )
  require 'gtk_paradise/run'
  _ = ::PdfParadise::GUI::Gtk::Controller.new(i)
  r = ::Gtk.run
  r << _
  r.automatic_size_then_automatic_title
  r.top_left_then_run
end

Instance Method Details

#border_size?Boolean

#

border_size?

#

Returns:

  • (Boolean)


117
118
119
# File 'lib/pdf_paradise/gui/gtk3/controller/controller.rb', line 117

def border_size?
  0
end

#connect_skeletonObject

#

connect_skeleton (connect tag)

#


182
183
184
185
186
187
# File 'lib/pdf_paradise/gui/gtk3/controller/controller.rb', line 182

def connect_skeleton
  abort_on_exception
  minimal(
    @notebook
  )
end

#create_skeletonObject

#

create_skeleton (create tag)

#


130
131
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
# File 'lib/pdf_paradise/gui/gtk3/controller/controller.rb', line 130

def create_skeleton
  @notebook = gtk_notebook
  # ======================================================================= #
  # === 01
  #
  # Add the first tab.
  # ======================================================================= #
  tab_title = 'Statistics Widget'
  @notebook.add_tab(
    PdfParadise::GUI::Gtk::StatisticsWidget.new, title: tab_title
  )
  # ======================================================================= #
  # === 02
  #
  # Add the second tab.
  # ======================================================================= #
  tab_title = 'Remove the first page of a .pdf file'
  @notebook.add_tab(
    ::PdfParadise.return_widget_remove_first_page_of_pdf_file,
    title: tab_title
  )
  # ======================================================================= #
  # === 03
  #
  # This is the "convert to .pdf" functionality.
  # ======================================================================= #
  tab_title = 'convert to .pdf'
  @notebook.add_tab(
    ::PdfParadise::GUI::Gtk::ToPdf.new,
    title: tab_title
  )
  # ======================================================================= #
  # === 04
  #
  # Add the fourth tab, for the split-pdf functionality.
  # ======================================================================= #
  tab_title = 'Split .pdf files'
  @notebook.add_tab(
    PdfParadise::GUI::Gtk::SplitPdfFile.new, title: tab_title
  )
  # ======================================================================= #
  # === 05
  # ======================================================================= #
  tab_title = 'pdf-viewer'
  @notebook.add_tab(
    PdfParadise::GUI::Gtk::PdfViewer.new, title: tab_title
  )
end

#handle_CSSObject

#

handle_CSS

#


97
98
99
100
101
102
103
104
105
# File 'lib/pdf_paradise/gui/gtk3/controller/controller.rb', line 97

def handle_CSS
  use_gtk_paradise_project_css_file
  apply_these_CSS_rules 'tooltip {
    font-size: 24px;
    padding: 12px;
    margin:  12px;
    border:   3px dotted steelblue;
  }'
end

#padding?Boolean

#

padding?

#

Returns:

  • (Boolean)


110
111
112
# File 'lib/pdf_paradise/gui/gtk3/controller/controller.rb', line 110

def padding?
  0
end

#resetObject

#

reset (reset tag)

#


71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/pdf_paradise/gui/gtk3/controller/controller.rb', line 71

def reset
  reset_the_internal_variables
  # ======================================================================= #
  # === @configuration
  # ======================================================================= #
  @configuration = [true, __dir__, NAMESPACE]
  # ======================================================================= #
  # === @title
  # ======================================================================= #
  @title  = TITLE
  # ======================================================================= #
  # === @width
  # ======================================================================= #
  set_width(WIDTH)
  # ======================================================================= #
  # === @height
  # ======================================================================= #
  set_height(HEIGHT)
  set_use_this_font(USE_THIS_FONT)
  handle_CSS 
  infer_the_size_automatically
end

#runObject

#

run (run tag)

#


192
193
194
# File 'lib/pdf_paradise/gui/gtk3/controller/controller.rb', line 192

def run
  create_skeleton_then_connect_skeleton
end