conquest-gtk 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (C) 2012 Vinny Diehl
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7
+ of the Software, and to permit persons to whom the Software is furnished to do
8
+ so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,22 @@
1
+ # Conquest for GTK
2
+
3
+ This is a GUI wrapper for the Conquest tool. It displays the data in a window
4
+ rather than outputting to files, and has some buttons for copying that data
5
+ to the clipboard.
6
+
7
+ ## Installation
8
+
9
+ Install with:
10
+
11
+ gem install conquest-gtk
12
+
13
+ For proper clipboard functionality on Linux, make sure that you have
14
+ ```xclip``` or ```xsel``` available.
15
+
16
+ ## Usage
17
+
18
+ To run:
19
+
20
+ conquest -g
21
+
22
+ It will download the data that it requires, then fire up the GUI ready to go.
data/Rakefile ADDED
@@ -0,0 +1,5 @@
1
+ require "bundler"
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ task dist: :build
5
+ task default: :build
@@ -0,0 +1,24 @@
1
+ require File.expand_path("../lib/conquest/gtk/version", __FILE__)
2
+
3
+ Gem::Specification.new do |gem|
4
+ gem.name = "conquest-gtk"
5
+ gem.version = Conquest::GUI_VERSION
6
+
7
+ gem.author = "Vinny Diehl"
8
+ gem.email = "gbchaosmaster926@gmail.com"
9
+ gem.homepage = "https://github.com/gbchaosmaster/conquest"
10
+
11
+ gem.license = "MIT"
12
+
13
+ gem.summary = "GUI for the Conquest tool."
14
+ gem.description = "A graphical front-end to the conquest gem."
15
+
16
+ gem.require_paths = %w[lib]
17
+ gem.files = Dir["lib/**/*"] + %w[
18
+ LICENSE Rakefile README.md conquest-gtk.gemspec
19
+ ]
20
+
21
+ gem.add_dependency "conquest", "~> 0.0"
22
+ gem.add_dependency "clipboard", "~> 1.0"
23
+ gem.add_dependency "gtk2", "~> 1.1"
24
+ end
@@ -0,0 +1,78 @@
1
+ require "conquest/gtk/version"
2
+
3
+ require "gtk2"
4
+ require "clipboard"
5
+
6
+ module Conquest
7
+ class GUI < Gtk::Window
8
+ def initialize
9
+ super
10
+
11
+ init_ui
12
+ init_signals
13
+
14
+ set_title "Conquest GTK #{Conquest::GUI_VERSION}"
15
+ set_default_size 500, 350
16
+ set_window_position Gtk::Window::POS_CENTER
17
+ set_border_width 5
18
+ end
19
+
20
+ def init_ui
21
+ vbox_main = Gtk::VBox.new false, 5
22
+
23
+ # Both text views are directly in vbox_main.
24
+
25
+ scr_txt_hex_list = Gtk::ScrolledWindow.new
26
+ @txt_hex_list = Gtk::TextView.new
27
+ scr_txt_hex_list.add_with_viewport @txt_hex_list
28
+
29
+ scr_txt_ards_code = Gtk::ScrolledWindow.new
30
+ @txt_ards_code = Gtk::TextView.new
31
+ scr_txt_ards_code.add_with_viewport @txt_ards_code
32
+
33
+ # Automatic scrollbars on both text views.
34
+ [scr_txt_hex_list, scr_txt_ards_code].map! do |scr|
35
+ scr.set_policy *[Gtk::POLICY_AUTOMATIC] * 2
36
+ end
37
+
38
+ ################################################################################
39
+
40
+ # hbox_controls contains the two buttons along the bottom.
41
+
42
+ hbox_controls = Gtk::HBox.new false, 5
43
+
44
+ @btn_copy_hex_list = Gtk::Button.new "Copy Hex List"
45
+ @btn_copy_ards_code = Gtk::Button.new "Copy ARDS Code"
46
+
47
+ hbox_controls.add @btn_copy_hex_list
48
+ hbox_controls.add @btn_copy_ards_code
49
+
50
+ ################################################################################
51
+
52
+ vbox_main.pack_start scr_txt_hex_list
53
+ vbox_main.pack_start scr_txt_ards_code
54
+ vbox_main.pack_start hbox_controls, false
55
+
56
+ add vbox_main
57
+ end
58
+
59
+ def init_signals
60
+ signal_connect "destroy" do
61
+ Gtk.main_quit
62
+ end
63
+
64
+ @btn_copy_hex_list.signal_connect "clicked" do
65
+ Clipboard.copy @txt_hex_list.buffer.text
66
+ end
67
+
68
+ @btn_copy_ards_code.signal_connect "clicked" do
69
+ Clipboard.copy @txt_ards_code.buffer.text
70
+ end
71
+ end
72
+
73
+ def set_outputs(hex_list, ards_code)
74
+ @txt_hex_list.buffer.text = hex_list
75
+ @txt_ards_code.buffer.text = ards_code
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,3 @@
1
+ module Conquest
2
+ GUI_VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,20 @@
1
+ require "conquest/gtk/gui"
2
+ require "conquest/data"
3
+ require "conquest/parser"
4
+
5
+ module Conquest
6
+ def self.run_gui
7
+ puts "Running Conquest for GTK, version #{Conquest::GUI_VERSION}."
8
+ print "\nDownloading data... Your GUI will be ready in just a moment."
9
+ parser = Parser.new DATA_URL
10
+ puts "\nFinished, here you go!"
11
+
12
+ Gtk.init
13
+
14
+ main = GUI.new
15
+ main.set_outputs parser.hex_list, parser.ards_code
16
+ main.show_all
17
+
18
+ Gtk.main
19
+ end
20
+ end
metadata ADDED
@@ -0,0 +1,101 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: conquest-gtk
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Vinny Diehl
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-10-02 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: conquest
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '0.0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '0.0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: clipboard
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '1.0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '1.0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: gtk2
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '1.1'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '1.1'
62
+ description: A graphical front-end to the conquest gem.
63
+ email: gbchaosmaster926@gmail.com
64
+ executables: []
65
+ extensions: []
66
+ extra_rdoc_files: []
67
+ files:
68
+ - lib/conquest/gtk.rb
69
+ - lib/conquest/gtk/version.rb
70
+ - lib/conquest/gtk/gui.rb
71
+ - LICENSE
72
+ - Rakefile
73
+ - README.md
74
+ - conquest-gtk.gemspec
75
+ homepage: https://github.com/gbchaosmaster/conquest
76
+ licenses:
77
+ - MIT
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ requirements: []
95
+ rubyforge_project:
96
+ rubygems_version: 1.8.24
97
+ signing_key:
98
+ specification_version: 3
99
+ summary: GUI for the Conquest tool.
100
+ test_files: []
101
+ has_rdoc: