cryptopunks-gui 0.0.2 → 0.0.6
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 +24 -0
- data/README.md +59 -3
- data/VERSION +1 -1
- data/app/cryptopunks_gui.rb +195 -29
- data/cryptopunks-gui.gemspec +5 -5
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41332d4eb8f4427149280fd075b456ace5f882ec6acd9d794a052d66747b5ab4
|
4
|
+
data.tar.gz: b52e82c7789dd198ee4925db7b1f59cfc99fae0e11b7d1d577ffa1e7190ddd6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50ead25c82393bfb068c411b17edd7a64bf5eb943fae3f74094ae25766e5600d07949f85f283c4869777645a2b05bc85efce4a3d3e0eb241c218e5d063cc0341
|
7
|
+
data.tar.gz: 4f18e99c50b31cb823ea68e8239c78a30d0ed6428b9199aa8300eaf747a503499a2c321dd552ff3d0f039c525babb6d9b832066da5ff200774160b65f8f742ef
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,29 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.0.6
|
4
|
+
|
5
|
+
- Provide option to change output location
|
6
|
+
- Update default output location not to be a hidden location, switching `~/.cryptopunks` to `~/cryptopunks`
|
7
|
+
- Remember last selected output location upon app start
|
8
|
+
- Avoid hardcoding punk count in code (change 9999 to size of `@punks` array)
|
9
|
+
|
10
|
+
## 0.0.5
|
11
|
+
|
12
|
+
- Led style spacing option
|
13
|
+
- Led style round corner option
|
14
|
+
- Sketch style line option
|
15
|
+
- Apply zoom to led and sketch styles correctly
|
16
|
+
- Fixed issue with typing punk index higher than 9999 (ignore)
|
17
|
+
|
18
|
+
## 0.0.4
|
19
|
+
|
20
|
+
- Changed flip and mirror to checkbuttons
|
21
|
+
- Fixed zooming for led and sketch styles
|
22
|
+
|
23
|
+
## 0.0.3
|
24
|
+
|
25
|
+
- Style support (e.g. mirror, flip, sketch, led)
|
26
|
+
|
3
27
|
## 0.0.2
|
4
28
|
|
5
29
|
- Palette support (e.g. grayscale or sepia)
|
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.6
|
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.6
|
29
29
|
```
|
30
30
|
|
31
31
|
Afterwards, run app via:
|
@@ -85,7 +85,63 @@ 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
|
+
#### Normal Style
|
103
|
+
|
104
|
+

|
105
|
+
|
106
|
+
#### Led Style
|
107
|
+
|
108
|
+

|
109
|
+
|
110
|
+
##### Led Spacing
|
111
|
+
|
112
|
+

|
113
|
+
|
114
|
+
##### Led Round Corner
|
115
|
+
|
116
|
+

|
117
|
+
|
118
|
+
#### Sketch Style
|
119
|
+
|
120
|
+

|
121
|
+
|
122
|
+
##### Sketch Line
|
123
|
+
|
124
|
+

|
125
|
+
|
126
|
+
### Mirror/Flip
|
127
|
+
|
128
|
+
Check mirror and/or flip to apply punk transformations. Can be combined with different palettes and styles.
|
129
|
+
|
130
|
+

|
131
|
+
|
132
|
+

|
133
|
+
|
134
|
+

|
135
|
+
|
136
|
+

|
137
|
+
|
138
|
+

|
139
|
+
|
140
|
+
### Output Location
|
141
|
+
|
142
|
+
You may select a new output location by clicking on the `...` button.
|
143
|
+
|
144
|
+

|
89
145
|
|
90
146
|
## TODO
|
91
147
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.6
|
data/app/cryptopunks_gui.rb
CHANGED
@@ -1,52 +1,108 @@
|
|
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'
|
6
7
|
require 'glimmer/data_binding/observer'
|
8
|
+
require 'yaml'
|
7
9
|
require 'puts_debuggerer'
|
8
10
|
|
9
11
|
class CryptopunksGui
|
10
12
|
include Glimmer
|
11
13
|
|
12
|
-
PALETTES = ['Standard'] + (Palette8bit.constants).map(&:name).map {|palette| palette.split('_').map(&:capitalize).join(' ')}.reject { |palette| palette.include?(' ') }
|
14
|
+
PALETTES = ['Standard'] + (Palette8bit.constants).map(&:name).map {|palette| palette.split('_').map(&:capitalize).join(' ')}.reject { |palette| palette.include?(' ') }.sort
|
15
|
+
STYLES = ['Normal', 'Led', 'Sketch']
|
13
16
|
|
14
|
-
attr_accessor :punk_index, :zoom, :palette
|
17
|
+
attr_accessor :punk_index, :zoom, :palette, :style, :led_spacing, :led_round_corner, :sketch_line, :flip, :mirror
|
15
18
|
|
16
19
|
def initialize
|
17
|
-
|
20
|
+
initialize_punks
|
21
|
+
load_config
|
22
|
+
initialize_defaults
|
23
|
+
observe_image_attribute_changes
|
24
|
+
create_gui
|
25
|
+
self.punk_index = 0
|
26
|
+
@root.open
|
27
|
+
end
|
28
|
+
|
29
|
+
def palette_options
|
30
|
+
PALETTES
|
31
|
+
end
|
32
|
+
|
33
|
+
def style_options
|
34
|
+
STYLES
|
35
|
+
end
|
36
|
+
|
37
|
+
def initialize_punks
|
38
|
+
@punk_directory = File.join(Dir.home, 'cryptopunks')
|
18
39
|
FileUtils.mkdir_p(@punk_directory)
|
19
40
|
@punk_file = File.join(@punk_directory, 'punks.png')
|
20
41
|
File.write(@punk_file, Net::HTTP.get(URI('https://raw.githubusercontent.com/larvalabs/cryptopunks/master/punks.png'))) unless File.exist?(@punk_file)
|
21
42
|
@punks = Punks::Image::Composite.read(@punk_file)
|
43
|
+
end
|
44
|
+
|
45
|
+
def load_config
|
46
|
+
@punk_config_file = File.join(@punk_directory, 'cryptopunks.yml')
|
47
|
+
FileUtils.touch(@punk_config_file)
|
48
|
+
@punk_config = YAML.load(File.read(@punk_config_file)) || {punk_directory: @punk_directory}
|
49
|
+
@punk_directory = @punk_config[:punk_directory]
|
50
|
+
end
|
51
|
+
|
52
|
+
def save_config
|
53
|
+
File.write(@punk_config_file, YAML.dump(@punk_config))
|
54
|
+
end
|
55
|
+
|
56
|
+
def initialize_defaults
|
22
57
|
@zoom = 12
|
23
|
-
@palette =
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
58
|
+
@palette = PALETTES.first
|
59
|
+
@style = STYLES.first
|
60
|
+
@led_spacing = 2
|
61
|
+
@led_round_corner = false
|
62
|
+
@sketch_line = 1
|
63
|
+
@mirror = false
|
64
|
+
@flip = false
|
65
|
+
end
|
66
|
+
|
67
|
+
def observe_image_attribute_changes
|
68
|
+
observer = Glimmer::DataBinding::Observer.proc { generate_image }
|
28
69
|
observer.observe(self, :punk_index)
|
29
70
|
observer.observe(self, :zoom)
|
30
71
|
observer.observe(self, :palette)
|
31
|
-
|
32
|
-
|
33
|
-
self
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
def palette_options
|
38
|
-
PALETTES
|
72
|
+
observer.observe(self, :style)
|
73
|
+
observer.observe(self, :led_spacing)
|
74
|
+
observer.observe(self, :led_round_corner)
|
75
|
+
observer.observe(self, :sketch_line)
|
76
|
+
observer.observe(self, :mirror)
|
77
|
+
observer.observe(self, :flip)
|
39
78
|
end
|
40
79
|
|
41
80
|
def generate_image
|
42
|
-
|
81
|
+
return if @punk_index.to_i > @punks.size
|
82
|
+
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
83
|
puts "Writing punk image to #{image_location}"
|
44
84
|
selected_punk = @punks[@punk_index.to_i]
|
45
|
-
selected_punk = selected_punk.change_palette8bit(Palette8bit.const_get(@palette.gsub(' ', '_').upcase.to_sym)) if @palette !=
|
46
|
-
|
85
|
+
selected_punk = selected_punk.change_palette8bit(Palette8bit.const_get(@palette.gsub(' ', '_').upcase.to_sym)) if @palette != PALETTES.first
|
86
|
+
@original_zoom = @zoom
|
87
|
+
if @style != STYLES.first
|
88
|
+
style_options = {}
|
89
|
+
if @style == 'Led'
|
90
|
+
style_options[:spacing] = @led_spacing.to_i
|
91
|
+
style_options[:round_corner] = @led_round_corner
|
92
|
+
end
|
93
|
+
if @style == 'Sketch'
|
94
|
+
style_options[:line] = @sketch_line.to_i
|
95
|
+
end
|
96
|
+
selected_punk = selected_punk.send(@style.underscore, @zoom.to_i, **style_options)
|
97
|
+
end
|
98
|
+
selected_punk = selected_punk.mirror if @mirror
|
99
|
+
selected_punk = selected_punk.flip if @flip
|
100
|
+
selected_punk = selected_punk.zoom(@zoom.to_i) if @style == STYLES.first
|
47
101
|
selected_punk.save(image_location)
|
48
102
|
@image_label.image = image_location
|
49
|
-
@
|
103
|
+
@output_location_entry.text = image_location
|
104
|
+
@previous_style = @style
|
105
|
+
notify_observers(:zoom) if @zoom != @original_zoom
|
50
106
|
end
|
51
107
|
|
52
108
|
def create_gui
|
@@ -55,11 +111,6 @@ class CryptopunksGui
|
|
55
111
|
iconphoto File.expand_path('../icons/cryptopunks-gui.png', __dir__)
|
56
112
|
|
57
113
|
frame {
|
58
|
-
label {
|
59
|
-
text 'Select Punk Index and Zoom To Mint Cryptopunk'
|
60
|
-
font weight: 'bold'
|
61
|
-
}
|
62
|
-
|
63
114
|
label {
|
64
115
|
text 'Punk Index:'
|
65
116
|
}
|
@@ -82,16 +133,75 @@ class CryptopunksGui
|
|
82
133
|
text 'Palette:'
|
83
134
|
}
|
84
135
|
combobox {
|
85
|
-
|
86
|
-
readonly true # this applies to text editing only (item selection still triggers a write to model)
|
136
|
+
readonly true
|
87
137
|
text <=> [self, :palette]
|
88
138
|
}
|
89
139
|
|
90
140
|
label {
|
91
|
-
text '
|
141
|
+
text 'Style:'
|
92
142
|
}
|
93
|
-
|
143
|
+
combobox {
|
94
144
|
readonly true
|
145
|
+
text <=> [self, :style, after_write: ->(val) {add_style_options}]
|
146
|
+
}
|
147
|
+
|
148
|
+
@style_options_frame = frame {
|
149
|
+
padding 0
|
150
|
+
}
|
151
|
+
|
152
|
+
frame {
|
153
|
+
padding 0
|
154
|
+
|
155
|
+
checkbutton {
|
156
|
+
grid row: 0, column: 0, column_weight: 0
|
157
|
+
variable <=> [self, :mirror]
|
158
|
+
}
|
159
|
+
label {
|
160
|
+
grid row: 0, column: 1
|
161
|
+
text 'Mirror'
|
162
|
+
|
163
|
+
on('Button-1') do
|
164
|
+
self.mirror = !mirror
|
165
|
+
end
|
166
|
+
}
|
167
|
+
|
168
|
+
checkbutton {
|
169
|
+
grid row: 0, column: 2
|
170
|
+
variable <=> [self, :flip]
|
171
|
+
}
|
172
|
+
label {
|
173
|
+
grid row: 0, column: 3
|
174
|
+
text 'Flip'
|
175
|
+
|
176
|
+
on('Button-1') do
|
177
|
+
self.flip = !flip
|
178
|
+
end
|
179
|
+
}
|
180
|
+
}
|
181
|
+
|
182
|
+
label {
|
183
|
+
text 'Output Location:'
|
184
|
+
}
|
185
|
+
frame {
|
186
|
+
padding 0
|
187
|
+
|
188
|
+
@output_location_entry = entry {
|
189
|
+
grid row: 0, column: 0
|
190
|
+
readonly true
|
191
|
+
width 35
|
192
|
+
}
|
193
|
+
button {
|
194
|
+
grid row: 0, column: 1
|
195
|
+
text '...'
|
196
|
+
width 1.1
|
197
|
+
|
198
|
+
on('command') do
|
199
|
+
@punk_directory = choose_directory(parent: @root)
|
200
|
+
@punk_config[:punk_directory] = @punk_directory
|
201
|
+
save_config
|
202
|
+
generate_image
|
203
|
+
end
|
204
|
+
}
|
95
205
|
}
|
96
206
|
|
97
207
|
@image_label = label {
|
@@ -100,6 +210,62 @@ class CryptopunksGui
|
|
100
210
|
}
|
101
211
|
}
|
102
212
|
end
|
213
|
+
|
214
|
+
def add_style_options
|
215
|
+
@style_options_frame.content {
|
216
|
+
@style_options_frame.children.each(&:destroy)
|
217
|
+
if @style == 'Led'
|
218
|
+
frame {
|
219
|
+
padding 0
|
220
|
+
|
221
|
+
label {
|
222
|
+
grid row: 0, column: 0, column_weight: 0
|
223
|
+
text 'Spacing:'
|
224
|
+
}
|
225
|
+
spinbox {
|
226
|
+
grid row: 0, column: 1
|
227
|
+
from 1
|
228
|
+
to 72
|
229
|
+
text <=> [self, :led_spacing]
|
230
|
+
}
|
231
|
+
|
232
|
+
checkbutton {
|
233
|
+
grid row: 0, column: 2
|
234
|
+
variable <=> [self, :led_round_corner]
|
235
|
+
}
|
236
|
+
label {
|
237
|
+
grid row: 0, column: 3
|
238
|
+
text 'Round Corner'
|
239
|
+
|
240
|
+
on('Button-1') do
|
241
|
+
self.led_round_corner = !led_round_corner
|
242
|
+
end
|
243
|
+
}
|
244
|
+
}
|
245
|
+
elsif @style == 'Sketch'
|
246
|
+
frame {
|
247
|
+
padding 0
|
248
|
+
|
249
|
+
label {
|
250
|
+
grid row: 0, column: 0, column_weight: 0
|
251
|
+
text 'Line:'
|
252
|
+
}
|
253
|
+
spinbox {
|
254
|
+
grid row: 0, column: 1
|
255
|
+
from 1
|
256
|
+
to 72
|
257
|
+
text <=> [self, :sketch_line]
|
258
|
+
}
|
259
|
+
}
|
260
|
+
else
|
261
|
+
frame { # filler
|
262
|
+
padding 0
|
263
|
+
height 0
|
264
|
+
width 0
|
265
|
+
}
|
266
|
+
end
|
267
|
+
}
|
268
|
+
end
|
103
269
|
end
|
104
270
|
|
105
271
|
CryptopunksGui.new.launch
|
data/cryptopunks-gui.gemspec
CHANGED
@@ -2,17 +2,17 @@
|
|
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.6 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.6"
|
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]
|
13
13
|
s.authors = ["Andy Maleh".freeze]
|
14
|
-
s.date = "2021-10-
|
15
|
-
s.description = "
|
14
|
+
s.date = "2021-10-28"
|
15
|
+
s.description = "CryptoPunks GUI for Simplified Minting - Built with Glimmer DSL for Tk (requires ActiveTcl to run cryptopunks-gui command)".freeze
|
16
16
|
s.email = "andy.am@gmail.com".freeze
|
17
17
|
s.executables = ["cryptopunks-gui".freeze]
|
18
18
|
s.extra_rdoc_files = [
|
@@ -34,7 +34,7 @@ Gem::Specification.new do |s|
|
|
34
34
|
s.licenses = ["MIT".freeze]
|
35
35
|
s.post_install_message = "To launch CryptoPunks GUI, run command: cryptopunks-gui".freeze
|
36
36
|
s.rubygems_version = "3.2.22".freeze
|
37
|
-
s.summary = "
|
37
|
+
s.summary = "CryptoPunks GUI for Simplified Minting".freeze
|
38
38
|
|
39
39
|
if s.respond_to? :specification_version then
|
40
40
|
s.specification_version = 4
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cryptopunks-gui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Maleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-10-
|
11
|
+
date: 2021-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: glimmer-dsl-tk
|
@@ -108,7 +108,7 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
-
description:
|
111
|
+
description: CryptoPunks GUI for Simplified Minting - Built with Glimmer DSL for Tk
|
112
112
|
(requires ActiveTcl to run cryptopunks-gui command)
|
113
113
|
email: andy.am@gmail.com
|
114
114
|
executables:
|
@@ -149,5 +149,5 @@ requirements: []
|
|
149
149
|
rubygems_version: 3.2.22
|
150
150
|
signing_key:
|
151
151
|
specification_version: 4
|
152
|
-
summary:
|
152
|
+
summary: CryptoPunks GUI for Simplified Minting
|
153
153
|
test_files: []
|