Merge pull request #2 from Pixelated-Studios/vetheon-patch-2
Enhancing User Experience by Streamlining Database Connection Setup
This commit is contained in:
commit
982c404472
133
Glade/NETRAVE.glade
Normal file
133
Glade/NETRAVE.glade
Normal file
|
@ -0,0 +1,133 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.40.0 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.20"/>
|
||||
<object class="GtkPopover" id="popover1">
|
||||
<property name="can-focus">False</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="settings_menu_entry">
|
||||
<property name="label" translatable="yes">Settings</property>
|
||||
<property name="name">settings_menu_entry</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkWindow" id="main_window">
|
||||
<property name="name">main_window</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="title" translatable="yes">NETRAVE</property>
|
||||
<property name="window-position">center-always</property>
|
||||
<property name="default-width">1080</property>
|
||||
<property name="default-height">720</property>
|
||||
<property name="gravity">center</property>
|
||||
<child>
|
||||
<object class="GtkLayout" id="layout_grid">
|
||||
<property name="name">layout_grid</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="double-buffered">False</property>
|
||||
<property name="hscroll-policy">natural</property>
|
||||
<property name="vscroll-policy">natural</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="title_label">
|
||||
<property name="name">title_label</property>
|
||||
<property name="width-request">100</property>
|
||||
<property name="height-request">80</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label" translatable="yes">NETRAVE: A Network Monitor for the Future</property>
|
||||
<property name="justify">center</property>
|
||||
<attributes>
|
||||
<attribute name="scale" value="1.5"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="x">300</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator" id="label_separator">
|
||||
<property name="name">label_separator</property>
|
||||
<property name="width-request">1085</property>
|
||||
<property name="height-request">5</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="double-buffered">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="y">91</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="monitor_button">
|
||||
<property name="label" translatable="yes">Open the Monitor</property>
|
||||
<property name="name">monitor_button</property>
|
||||
<property name="width-request">154</property>
|
||||
<property name="height-request">80</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">False</property>
|
||||
<property name="double-buffered">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="x">150</property>
|
||||
<property name="y">115</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="logger_button">
|
||||
<property name="label" translatable="yes">Open the Logger</property>
|
||||
<property name="name">logger_button</property>
|
||||
<property name="width-request">146</property>
|
||||
<property name="height-request">80</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="x">415</property>
|
||||
<property name="y">115</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="exterminator_button">
|
||||
<property name="label" translatable="yes">Open the Exterminator</property>
|
||||
<property name="name">exterminator_button</property>
|
||||
<property name="width-request">274</property>
|
||||
<property name="height-request">80</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="x">670</property>
|
||||
<property name="y">115</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuButton" id="menu_button">
|
||||
<property name="related-action"/>
|
||||
<property name="name">menu_button</property>
|
||||
<property name="width-request">100</property>
|
||||
<property name="height-request">80</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="popover">popover1</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="x">6</property>
|
||||
<property name="y">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
134
Glade/NETRAVE.glade~
Normal file
134
Glade/NETRAVE.glade~
Normal file
|
@ -0,0 +1,134 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.40.0 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.20"/>
|
||||
<object class="GtkPopover" id="popover1">
|
||||
<property name="can-focus">False</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="settings_menu_entry">
|
||||
<property name="label" translatable="yes">Settings</property>
|
||||
<property name="name">settings_menu_entry</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkWindow" id="main_window">
|
||||
<property name="name">main_window</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="title" translatable="yes">NETRAVE</property>
|
||||
<property name="window-position">center-always</property>
|
||||
<property name="default-width">1080</property>
|
||||
<property name="default-height">720</property>
|
||||
<property name="gravity">center</property>
|
||||
<child>
|
||||
<object class="GtkLayout" id="layout_grid">
|
||||
<property name="name">layout_grid</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="double-buffered">False</property>
|
||||
<property name="hscroll-policy">natural</property>
|
||||
<property name="vscroll-policy">natural</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="title_label">
|
||||
<property name="name">title_label</property>
|
||||
<property name="width-request">100</property>
|
||||
<property name="height-request">80</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label" translatable="yes">NETRAVE: A Network Monitor for the Future</property>
|
||||
<property name="justify">center</property>
|
||||
<attributes>
|
||||
<attribute name="scale" value="1.5"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="x">300</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator" id="label_separator">
|
||||
<property name="name">label_separator</property>
|
||||
<property name="width-request">1085</property>
|
||||
<property name="height-request">5</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="double-buffered">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="y">91</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="monitor_button">
|
||||
<property name="label" translatable="yes">Open the Monitor</property>
|
||||
<property name="name">monitor_button</property>
|
||||
<property name="width-request">154</property>
|
||||
<property name="height-request">80</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">False</property>
|
||||
<property name="double-buffered">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="x">150</property>
|
||||
<property name="y">115</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="logger_button">
|
||||
<property name="label" translatable="yes">Open the Logger</property>
|
||||
<property name="name">logger_button</property>
|
||||
<property name="width-request">146</property>
|
||||
<property name="height-request">80</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="x">415</property>
|
||||
<property name="y">115</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="exterminator_button">
|
||||
<property name="label" translatable="yes">Open the Exterminator</property>
|
||||
<property name="name">exterminator_button</property>
|
||||
<property name="width-request">274</property>
|
||||
<property name="height-request">80</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="x">670</property>
|
||||
<property name="y">115</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuButton" id="menu_button">
|
||||
<property name="related-action"/>
|
||||
<property name="name">menu_button</property>
|
||||
<property name="width-request">100</property>
|
||||
<property name="height-request">80</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="direction">right</property>
|
||||
<property name="popover">popover1</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="x">6</property>
|
||||
<property name="y">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
1
lib/.rubocop.yml
Normal file
1
lib/.rubocop.yml
Normal file
|
@ -0,0 +1 @@
|
|||
inherit_from: .rubocop_todo.yml
|
192
lib/.rubocop_todo.yml
Normal file
192
lib/.rubocop_todo.yml
Normal file
|
@ -0,0 +1,192 @@
|
|||
# This configuration was generated by
|
||||
# `rubocop --auto-gen-config`
|
||||
# on 2023-06-07 18:22:21 UTC using RuboCop version 1.52.0.
|
||||
# The point is for the user to remove these configuration records
|
||||
# one by one as the offenses are removed from the code base.
|
||||
# Note that changes in the inspected code, or installation of new
|
||||
# versions of RuboCop, may require this file to be generated again.
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
|
||||
# Include: **/*.gemfile, **/Gemfile, **/gems.rb
|
||||
Bundler/OrderedGems:
|
||||
Exclude:
|
||||
- 'Gemfile'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: EnforcedStyleAlignWith, Severity.
|
||||
# SupportedStylesAlignWith: keyword, variable, start_of_line
|
||||
Layout/EndAlignment:
|
||||
Exclude:
|
||||
- 'utils/utilities.rb'
|
||||
|
||||
# Offense count: 3
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: Width, AllowedPatterns.
|
||||
Layout/IndentationWidth:
|
||||
Exclude:
|
||||
- 'utils/utilities.rb'
|
||||
|
||||
# Offense count: 3
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: final_newline, final_blank_line
|
||||
Layout/TrailingEmptyLines:
|
||||
Exclude:
|
||||
- 'utils/database_manager.rb'
|
||||
- 'utils/system_information_gather.rb'
|
||||
- 'utils/utilities.rb'
|
||||
|
||||
# Offense count: 9
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: AllowInHeredoc.
|
||||
Layout/TrailingWhitespace:
|
||||
Exclude:
|
||||
- 'utils/database_manager.rb'
|
||||
- 'utils/first_run_init.rb'
|
||||
- 'utils/system_information_gather.rb'
|
||||
- 'utils/utilities.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods.
|
||||
Lint/UnusedMethodArgument:
|
||||
Exclude:
|
||||
- 'utils/system_information_gather.rb'
|
||||
|
||||
# Offense count: 5
|
||||
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
|
||||
Metrics/AbcSize:
|
||||
Max: 20
|
||||
|
||||
# Offense count: 8
|
||||
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
||||
Metrics/MethodLength:
|
||||
Max: 19
|
||||
|
||||
# Offense count: 1
|
||||
# Configuration parameters: AllowedNames.
|
||||
# AllowedNames: module_parent
|
||||
Naming/ClassAndModuleCamelCase:
|
||||
Exclude:
|
||||
- 'utils/GUI_launcher.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
|
||||
# CheckDefinitionPathHierarchyRoots: lib, spec, test, src
|
||||
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
|
||||
Naming/FileName:
|
||||
Exclude:
|
||||
- 'utils/GUI_launcher.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: always, conditionals
|
||||
Style/AndOr:
|
||||
Exclude:
|
||||
- 'utils/GUI_launcher.rb'
|
||||
|
||||
# Offense count: 5
|
||||
# Configuration parameters: AllowedConstants.
|
||||
Style/Documentation:
|
||||
Exclude:
|
||||
- 'spec/**/*'
|
||||
- 'test/**/*'
|
||||
- 'utils/GUI_launcher.rb'
|
||||
- 'utils/database_manager.rb'
|
||||
- 'utils/first_run_init.rb'
|
||||
- 'utils/system_information_gather.rb'
|
||||
- 'utils/utilities.rb'
|
||||
|
||||
# Offense count: 5
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: always, always_true, never
|
||||
Style/FrozenStringLiteralComment:
|
||||
Exclude:
|
||||
- 'utils/GUI_launcher.rb'
|
||||
- 'utils/database_manager.rb'
|
||||
- 'utils/first_run_init.rb'
|
||||
- 'utils/system_information_gather.rb'
|
||||
- 'utils/utilities.rb'
|
||||
|
||||
# Offense count: 4
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: MinBodyLength, AllowConsecutiveConditionals.
|
||||
Style/GuardClause:
|
||||
Exclude:
|
||||
- 'utils/first_run_init.rb'
|
||||
- 'utils/system_information_gather.rb'
|
||||
|
||||
# Offense count: 4
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Style/InfiniteLoop:
|
||||
Exclude:
|
||||
- 'utils/first_run_init.rb'
|
||||
- 'utils/system_information_gather.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
Style/NegatedWhile:
|
||||
Exclude:
|
||||
- 'utils/first_run_init.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns.
|
||||
# SupportedStyles: predicate, comparison
|
||||
Style/NumericPredicate:
|
||||
Exclude:
|
||||
- 'spec/**/*'
|
||||
- 'utils/system_information_gather.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
Style/RedundantBegin:
|
||||
Exclude:
|
||||
- 'utils/database_manager.rb'
|
||||
|
||||
# Offense count: 6
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
Style/RedundantFileExtensionInRequire:
|
||||
Exclude:
|
||||
- 'utils/database_manager.rb'
|
||||
- 'utils/first_run_init.rb'
|
||||
- 'utils/system_information_gather.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
|
||||
# AllowedMethods: present?, blank?, presence, try, try!
|
||||
Style/SafeNavigation:
|
||||
Exclude:
|
||||
- 'utils/database_manager.rb'
|
||||
|
||||
# Offense count: 36
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
|
||||
# SupportedStyles: single_quotes, double_quotes
|
||||
Style/StringLiterals:
|
||||
Exclude:
|
||||
- 'Gemfile'
|
||||
- 'utils/GUI_launcher.rb'
|
||||
- 'utils/database_manager.rb'
|
||||
- 'utils/first_run_init.rb'
|
||||
- 'utils/system_information_gather.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: MinSize, WordRegex.
|
||||
# SupportedStyles: percent, brackets
|
||||
Style/WordArray:
|
||||
EnforcedStyle: brackets
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
|
||||
# URISchemes: http, https
|
||||
Layout/LineLength:
|
||||
Max: 121
|
|
@ -16,3 +16,7 @@ gem "sequel", "~> 5.69"
|
|||
gem "mysql2", "~> 0.5.5"
|
||||
|
||||
gem "yaml", "~> 0.2.1"
|
||||
|
||||
gem "gtk3", "~> 4.1"
|
||||
|
||||
gem "reek", "~> 6.1"
|
||||
|
|
|
@ -2,29 +2,69 @@ GEM
|
|||
remote: https://rubygems.org/
|
||||
specs:
|
||||
ast (2.4.2)
|
||||
atk (4.1.7)
|
||||
glib2 (= 4.1.7)
|
||||
backport (1.2.0)
|
||||
benchmark (0.2.1)
|
||||
cairo (1.17.8)
|
||||
native-package-installer (>= 1.0.3)
|
||||
pkg-config (>= 1.2.2)
|
||||
red-colors
|
||||
cairo-gobject (4.1.7)
|
||||
cairo (>= 1.16.2)
|
||||
glib2 (= 4.1.7)
|
||||
console (1.16.2)
|
||||
fiber-local
|
||||
curses (1.4.4)
|
||||
diff-lcs (1.5.0)
|
||||
e2mmap (0.1.0)
|
||||
fiber-local (1.0.0)
|
||||
fiddle (1.1.1)
|
||||
gdk3 (4.1.7)
|
||||
cairo-gobject (= 4.1.7)
|
||||
gdk_pixbuf2 (= 4.1.7)
|
||||
pango (= 4.1.7)
|
||||
gdk_pixbuf2 (4.1.7)
|
||||
gio2 (= 4.1.7)
|
||||
gio2 (4.1.7)
|
||||
fiddle
|
||||
gobject-introspection (= 4.1.7)
|
||||
glib2 (4.1.7)
|
||||
native-package-installer (>= 1.0.3)
|
||||
pkg-config (>= 1.3.5)
|
||||
gobject-introspection (4.1.7)
|
||||
glib2 (= 4.1.7)
|
||||
gtk3 (4.1.7)
|
||||
atk (= 4.1.7)
|
||||
gdk3 (= 4.1.7)
|
||||
jaro_winkler (1.5.6)
|
||||
json (2.6.3)
|
||||
kramdown (2.4.0)
|
||||
rexml
|
||||
kramdown-parser-gfm (1.1.0)
|
||||
kramdown (~> 2.0)
|
||||
kwalify (0.7.2)
|
||||
matrix (0.4.2)
|
||||
mysql2 (0.5.5)
|
||||
native-package-installer (1.1.5)
|
||||
nokogiri (1.15.2-x86_64-linux)
|
||||
racc (~> 1.4)
|
||||
pango (4.1.7)
|
||||
cairo-gobject (= 4.1.7)
|
||||
gobject-introspection (= 4.1.7)
|
||||
parallel (1.23.0)
|
||||
parser (3.2.2.1)
|
||||
ast (~> 2.4.1)
|
||||
pkg-config (1.5.1)
|
||||
racc (1.6.2)
|
||||
rainbow (3.1.1)
|
||||
rbs (2.8.4)
|
||||
red-colors (0.3.0)
|
||||
matrix
|
||||
reek (6.1.4)
|
||||
kwalify (~> 0.7.0)
|
||||
parser (~> 3.2.0)
|
||||
rainbow (>= 2.0, < 4.0)
|
||||
regexp_parser (2.8.0)
|
||||
reverse_markdown (2.1.1)
|
||||
nokogiri
|
||||
|
@ -71,7 +111,9 @@ PLATFORMS
|
|||
DEPENDENCIES
|
||||
console
|
||||
curses (~> 1.4)
|
||||
gtk3 (~> 4.1)
|
||||
mysql2 (~> 0.5.5)
|
||||
reek (~> 6.1)
|
||||
rubocop (~> 1.52)
|
||||
sequel (~> 5.69)
|
||||
solargraph (~> 0.49.0)
|
||||
|
|
37
lib/utils/GUI_launcher.rb
Normal file
37
lib/utils/GUI_launcher.rb
Normal file
|
@ -0,0 +1,37 @@
|
|||
require 'gtk3'
|
||||
|
||||
class GUI_Launcher
|
||||
def initialize
|
||||
@app = Gtk::Application.new("com.netrave.gui", :flags_none)
|
||||
|
||||
@app.signal_connect "activate" do |application|
|
||||
builder = Gtk::Builder.new
|
||||
builder.add_from_file("./Glade/NETRAVE.glade")
|
||||
|
||||
window = builder.get_object("main_window")
|
||||
window.application = application
|
||||
|
||||
screen = Gdk::Screen.default
|
||||
width = screen.width
|
||||
height = screen.height
|
||||
|
||||
if width >= 3840 and height >= 2160
|
||||
# 4K resolution
|
||||
window.set_default_size(1200, 1000)
|
||||
elsif width >= 1920 and height >= 1080
|
||||
# 1080p resolution
|
||||
window.set_default_size(1080, 800)
|
||||
else
|
||||
# 720p or lower resolution
|
||||
window.set_default_size(800, 600)
|
||||
end
|
||||
|
||||
window.show_all
|
||||
end
|
||||
end
|
||||
|
||||
def run
|
||||
puts "Launching GUI..."
|
||||
@app.run
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user