cryptopunks-gui 0.0.2 → 0.0.3
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +23 -3
- data/VERSION +1 -1
- data/app/cryptopunks_gui.rb +52 -18
- data/cryptopunks-gui.gemspec +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1f6eb5c90f0fa4a2d0c5abd70d67da17071a8f72cdbcbb9c43eaa3c80962e4d
|
4
|
+
data.tar.gz: 1713179be7b0fee8032b3a7b6b8a71482189919464b4d010b23b01e6efcf7efc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1b8fab3f02ae9547c4ce7c5dcae6107c690af5db3d7a9c1f18e837293b086a2e3ee43e8dcd978a1a97b679f14af08f057435e1b4cd5830539877671d2e7317f
|
7
|
+
data.tar.gz: 3976e2ef62acb15532a352c9b7a5de4baad23f293b5c0647b0a90d450690ad1f2a04019ef8e73bdecf3dfde89373baa8a642195b2fc4f7df5caedac3c7a090b5
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# <img src="https://raw.githubusercontent.com/AndyObtiva/cryptopunks-gui/master/icons/cryptopunks-gui.png" height=85 /> CryptoPunks GUI 0.0.
|
1
|
+
# <img src="https://raw.githubusercontent.com/AndyObtiva/cryptopunks-gui/master/icons/cryptopunks-gui.png" height=85 /> CryptoPunks GUI 0.0.3
|
2
2
|
## Simplified Minting
|
3
3
|
[](http://badge.fury.io/rb/cryptopunks-gui)
|
4
4
|
|
@@ -25,7 +25,7 @@ You can use CryptoPunks GUI via gem or via cloning repository.
|
|
25
25
|
Run:
|
26
26
|
|
27
27
|
```
|
28
|
-
gem install cryptopunks-gui -v0.0.
|
28
|
+
gem install cryptopunks-gui -v0.0.3
|
29
29
|
```
|
30
30
|
|
31
31
|
Afterwards, run app via:
|
@@ -85,7 +85,27 @@ Change zoom to enlarge punk to your liking.
|
|
85
85
|
|
86
86
|
Change palette to get different punk colors.
|
87
87
|
|
88
|
-

|
89
|
+
|
90
|
+

|
91
|
+
|
92
|
+

|
93
|
+
|
94
|
+

|
95
|
+
|
96
|
+

|
97
|
+
|
98
|
+
### Style
|
99
|
+
|
100
|
+
Change style to get different punk looks.
|
101
|
+
|
102
|
+

|
103
|
+
|
104
|
+

|
105
|
+
|
106
|
+

|
107
|
+
|
108
|
+

|
89
109
|
|
90
110
|
## TODO
|
91
111
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/app/cryptopunks_gui.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'glimmer-dsl-tk'
|
2
2
|
require 'cryptopunks'
|
3
|
+
require 'facets'
|
3
4
|
require 'fileutils'
|
4
5
|
require 'net/http'
|
5
6
|
require 'uri'
|
@@ -10,43 +11,69 @@ class CryptopunksGui
|
|
10
11
|
include Glimmer
|
11
12
|
|
12
13
|
PALETTES = ['Standard'] + (Palette8bit.constants).map(&:name).map {|palette| palette.split('_').map(&:capitalize).join(' ')}.reject { |palette| palette.include?(' ') }
|
14
|
+
STYLES = ['Normal', 'Flip', 'Mirror', 'Led', 'Sketch']
|
13
15
|
|
14
|
-
attr_accessor :punk_index, :zoom, :palette
|
16
|
+
attr_accessor :punk_index, :zoom, :palette, :style
|
15
17
|
|
16
18
|
def initialize
|
19
|
+
initialize_punks
|
20
|
+
initialize_defaults
|
21
|
+
observe_image_attribute_changes
|
22
|
+
create_gui
|
23
|
+
self.punk_index = 0
|
24
|
+
@root.open
|
25
|
+
end
|
26
|
+
|
27
|
+
def palette_options
|
28
|
+
PALETTES
|
29
|
+
end
|
30
|
+
|
31
|
+
def style_options
|
32
|
+
STYLES
|
33
|
+
end
|
34
|
+
|
35
|
+
def initialize_punks
|
17
36
|
@punk_directory = File.join(Dir.home, '.cryptopunks')
|
18
37
|
FileUtils.mkdir_p(@punk_directory)
|
19
38
|
@punk_file = File.join(@punk_directory, 'punks.png')
|
20
39
|
File.write(@punk_file, Net::HTTP.get(URI('https://raw.githubusercontent.com/larvalabs/cryptopunks/master/punks.png'))) unless File.exist?(@punk_file)
|
21
40
|
@punks = Punks::Image::Composite.read(@punk_file)
|
41
|
+
end
|
42
|
+
|
43
|
+
def initialize_defaults
|
22
44
|
@zoom = 12
|
23
|
-
@palette =
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
45
|
+
@palette = PALETTES.first
|
46
|
+
@style = STYLES.first
|
47
|
+
end
|
48
|
+
|
49
|
+
def observe_image_attribute_changes
|
50
|
+
observer = Glimmer::DataBinding::Observer.proc { generate_image }
|
28
51
|
observer.observe(self, :punk_index)
|
29
52
|
observer.observe(self, :zoom)
|
30
53
|
observer.observe(self, :palette)
|
31
|
-
|
32
|
-
create_gui
|
33
|
-
self.punk_index = 0
|
34
|
-
@root.open
|
35
|
-
end
|
36
|
-
|
37
|
-
def palette_options
|
38
|
-
PALETTES
|
54
|
+
observer.observe(self, :style)
|
39
55
|
end
|
40
56
|
|
41
57
|
def generate_image
|
42
|
-
image_location = File.join(@punk_directory, "punk-#{@punk_index}#{"x#{@zoom}" if @zoom.to_i > 1}#{"-#{@palette.
|
58
|
+
image_location = File.join(@punk_directory, "punk-#{@punk_index}#{"x#{@zoom}" if @zoom.to_i > 1}#{"-#{@palette.underscore}" if @palette != PALETTES.first}#{"-#{@style.underscore}" if @style != STYLES.first}.png")
|
43
59
|
puts "Writing punk image to #{image_location}"
|
44
60
|
selected_punk = @punks[@punk_index.to_i]
|
45
|
-
selected_punk = selected_punk.change_palette8bit(Palette8bit.const_get(@palette.gsub(' ', '_').upcase.to_sym)) if @palette !=
|
61
|
+
selected_punk = selected_punk.change_palette8bit(Palette8bit.const_get(@palette.gsub(' ', '_').upcase.to_sym)) if @palette != PALETTES.first
|
62
|
+
@original_zoom = @zoom
|
63
|
+
if @style != STYLES.first
|
64
|
+
selected_punk = selected_punk.send(@style.underscore)
|
65
|
+
if @style != @previous_style
|
66
|
+
@zoom = 12 if @style == 'Flip' && !['Normal', 'Mirror'].include?(@previous_style)
|
67
|
+
@zoom = 12 if @style == 'Mirror' && !['Normal', 'Flip'].include?(@previous_style)
|
68
|
+
@zoom = 2 if @style == 'Sketch'
|
69
|
+
@zoom = 1 if @style == 'Led'
|
70
|
+
end
|
71
|
+
end
|
46
72
|
selected_punk = selected_punk.zoom(@zoom.to_i)
|
47
73
|
selected_punk.save(image_location)
|
48
74
|
@image_label.image = image_location
|
49
75
|
@message_entry.text = image_location
|
76
|
+
notify_observers(:zoom) if @zoom != @original_zoom
|
50
77
|
end
|
51
78
|
|
52
79
|
def create_gui
|
@@ -82,11 +109,18 @@ class CryptopunksGui
|
|
82
109
|
text 'Palette:'
|
83
110
|
}
|
84
111
|
combobox {
|
85
|
-
|
86
|
-
readonly true # this applies to text editing only (item selection still triggers a write to model)
|
112
|
+
readonly true
|
87
113
|
text <=> [self, :palette]
|
88
114
|
}
|
89
115
|
|
116
|
+
label {
|
117
|
+
text 'Style:'
|
118
|
+
}
|
119
|
+
combobox {
|
120
|
+
readonly true
|
121
|
+
text <=> [self, :style, before_write: ->(v) {@previous_style = @style}]
|
122
|
+
}
|
123
|
+
|
90
124
|
label {
|
91
125
|
text 'Output Location:'
|
92
126
|
}
|
data/cryptopunks-gui.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: cryptopunks-gui 0.0.
|
5
|
+
# stub: cryptopunks-gui 0.0.3 ruby app
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "cryptopunks-gui".freeze
|
9
|
-
s.version = "0.0.
|
9
|
+
s.version = "0.0.3"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["app".freeze]
|