From 46e99f766d99ee64d1093af4af8a014a9626c93f Mon Sep 17 00:00:00 2001 From: Andrew Kesterson Date: Mon, 5 May 2014 22:03:24 -0700 Subject: [PATCH] Basic skeleton app & lib, throws a window up --- .gitignore | 52 +++++++++++++++++-------------------------- Gemfile | 4 ++++ LICENSE.txt | 22 ++++++++++++++++++ Rakefile | 2 ++ bin/tailor | 3 +++ lib/tailor.rb | 6 +++++ lib/tailor/GUI.rb | 29 ++++++++++++++++++++++++ lib/tailor/version.rb | 3 +++ tailor.gemspec | 24 ++++++++++++++++++++ 9 files changed, 113 insertions(+), 32 deletions(-) create mode 100644 Gemfile create mode 100644 LICENSE.txt create mode 100644 Rakefile create mode 100644 bin/tailor create mode 100644 lib/tailor.rb create mode 100644 lib/tailor/GUI.rb create mode 100644 lib/tailor/version.rb create mode 100644 tailor.gemspec diff --git a/.gitignore b/.gitignore index f2c1360..31cafb5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,34 +1,22 @@ *.gem *.rbc -/.config -/coverage/ -/InstalledFiles -/pkg/ -/spec/reports/ -/test/tmp/ -/test/version_tmp/ -/tmp/ - -## Specific to RubyMotion: -.dat* -.repl_history -build/ - -## Documentation cache and generated files: -/.yardoc/ -/_yardoc/ -/doc/ -/rdoc/ - -## Environment normalisation: -/.bundle/ -/lib/bundler/man/ - -# for a library or gem, you might want to ignore these files since the code is -# intended to run in multiple environments; otherwise, check them in: -# Gemfile.lock -# .ruby-version -# .ruby-gemset - -# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: -.rvmrc +.bundle +.config +.yardoc +Gemfile.lock +InstalledFiles +_yardoc +coverage +doc/ +lib/bundler/man +pkg +rdoc +spec/reports +test/tmp +test/version_tmp +tmp +*.bundle +*.so +*.o +*.a +mkmf.log diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..3d8750f --- /dev/null +++ b/Gemfile @@ -0,0 +1,4 @@ +source 'https://rubygems.org' + +# Specify your gem's dependencies in tailor.gemspec +gemspec diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..35283ed --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,22 @@ +Copyright (c) 2014 Andrew Kesterson + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..809eb56 --- /dev/null +++ b/Rakefile @@ -0,0 +1,2 @@ +require "bundler/gem_tasks" + diff --git a/bin/tailor b/bin/tailor new file mode 100644 index 0000000..cb7d1e4 --- /dev/null +++ b/bin/tailor @@ -0,0 +1,3 @@ +require 'tailor' + +Tailor::GUI::Application.new.main_loop() \ No newline at end of file diff --git a/lib/tailor.rb b/lib/tailor.rb new file mode 100644 index 0000000..f22d547 --- /dev/null +++ b/lib/tailor.rb @@ -0,0 +1,6 @@ +require "tailor/version" +require "tailor/GUI" + +module Tailor + # Your code goes here... +end diff --git a/lib/tailor/GUI.rb b/lib/tailor/GUI.rb new file mode 100644 index 0000000..ae6030b --- /dev/null +++ b/lib/tailor/GUI.rb @@ -0,0 +1,29 @@ +require 'wx' + +module Tailor + module GUI + class Application < Wx::App + def on_init + MainWindow.new + end + end + + class MainWindow < Wx::Frame + def initialize() + super(nil, -1, 'Tailor') + @mainpanel = Wx::Panel.new(self) + @close_button = Wx::Button.new(@mainpanel, -1, 'Quit') + evt_button(@close_button.get_id()) { |event| close_button_clicked(event) } + @mainpanel_sizer = Wx::BoxSizer.new(Wx::VERTICAL) + @mainpanel.set_sizer(@mainpanel_sizer) + @mainpanel_sizer.add(@close_button, 0, Wx::GROW|Wx::ALL, 2) + show() + end + + def close_button_clicked(event) + puts "I don't do anything, but good on you for using a mouse" + end + + end + end +end diff --git a/lib/tailor/version.rb b/lib/tailor/version.rb new file mode 100644 index 0000000..c39d005 --- /dev/null +++ b/lib/tailor/version.rb @@ -0,0 +1,3 @@ +module Tailor + VERSION = "0.0.1" +end diff --git a/tailor.gemspec b/tailor.gemspec new file mode 100644 index 0000000..c8f0ea5 --- /dev/null +++ b/tailor.gemspec @@ -0,0 +1,24 @@ +# coding: utf-8 +lib = File.expand_path('../lib', __FILE__) +$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) +require 'tailor/version' + +Gem::Specification.new do |spec| + spec.name = "tailor" + spec.version = Tailor::VERSION + spec.authors = ["Andrew Kesterson"] + spec.email = ["andrew@aklabs.net"] + spec.summary = "A GUI toolkit and library for working with image tilesets" + spec.description = "" + spec.homepage = "https://github.com/akesterson/tailor/" + spec.license = "MIT" + + spec.files = `git ls-files -z`.split("\x0") + spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } + spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) + spec.require_paths = ["lib"] + + spec.add_development_dependency "bundler", "~> 1.6" + spec.add_development_dependency "rake" + spec.add_dependency "wxruby-ruby19" +end