cryptopunks-gui 0.0.4 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +24 -0
- data/README.md +84 -8
- data/VERSION +1 -1
- data/app/cryptopunks_gui.rb +188 -30
- data/cryptopunks-gui.gemspec +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ee3d5ade75811ebc70295c6f76b54ba9303f54478f384cccad7893f677fc10e
|
4
|
+
data.tar.gz: eaa8d181497699192da8ed4a507f7482f305aac74920e8a4259c25dd49316a11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ff9986b156bc144985f4e2a74b288218e15048ff3cf0b06962a7d0220210d1c8cdeae9b44795deada9baa0bf5d822bb547a41c10b86a3047846da6fbc9c80e7
|
7
|
+
data.tar.gz: 8647990b82c10f17bac2894d0fa6e3a6e6e73fbb40fc55b47ffcc69e0a20de8cd2a974d129dcb051550a81fd3380a4fce9910bc7bd24af87c4fd39f8bbce344d
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,29 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.0.8
|
4
|
+
|
5
|
+
- Remove Boring Apes collections since they are 28x28 instead of 24x24, thus incomptible with the cryptopunks Ruby gem
|
6
|
+
- Fixed Boring Apes collection image dimensions (28x28 instead of default 24x24)
|
7
|
+
|
8
|
+
## 0.0.7
|
9
|
+
|
10
|
+
- Multiple Punk Collections (https://github.com/cryptopunksnotdead/awesome-24px)
|
11
|
+
|
12
|
+
## 0.0.6
|
13
|
+
|
14
|
+
- Provide option to change output location
|
15
|
+
- Update default output location not to be a hidden location, switching `~/.cryptopunks` to `~/cryptopunks`
|
16
|
+
- Remember last selected output location upon app start
|
17
|
+
- Avoid hardcoding punk count in code (change 9999 to size of `@punks` array)
|
18
|
+
|
19
|
+
## 0.0.5
|
20
|
+
|
21
|
+
- Led style spacing option
|
22
|
+
- Led style round corner option
|
23
|
+
- Sketch style line option
|
24
|
+
- Apply zoom to led and sketch styles correctly
|
25
|
+
- Fixed issue with typing punk index higher than 9999 (ignore)
|
26
|
+
|
3
27
|
## 0.0.4
|
4
28
|
|
5
29
|
- Changed flip and mirror to checkbuttons
|
data/README.md
CHANGED
@@ -1,12 +1,12 @@
|
|
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.8
|
2
2
|
## Simplified Minting
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/cryptopunks-gui.svg)](http://badge.fury.io/rb/cryptopunks-gui)
|
4
4
|
|
5
5
|
This is a Graphical User Interface for the famous [cryptopunks Ruby gem](https://github.com/cryptopunksnotdead/cryptopunks/tree/master/cryptopunks).
|
6
6
|
|
7
|
-
It automatically downloads `punks.png` from https://github.com/larvalabs/cryptopunks
|
7
|
+
It automatically downloads image collection sprites on first use (e.g. `punks.png` from https://github.com/larvalabs/cryptopunks).
|
8
8
|
|
9
|
-
Minted cryptopunks are stored at
|
9
|
+
Minted cryptopunks are stored at `~/cryptopunks/` by default ([output location can be changed](#output-location)).
|
10
10
|
|
11
11
|
![Screenshot](/screenshots/cryptopunks-gui-screenshot.png)
|
12
12
|
|
@@ -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.8
|
29
29
|
```
|
30
30
|
|
31
31
|
Afterwards, run app via:
|
@@ -69,9 +69,61 @@ ruby app/cryptopunks_gui.rb
|
|
69
69
|
|
70
70
|
## Instructions
|
71
71
|
|
72
|
-
###
|
73
|
-
|
74
|
-
Change
|
72
|
+
### Collection
|
73
|
+
|
74
|
+
Change collection to pick a different collection of images.
|
75
|
+
|
76
|
+
There are currently 34 available collections (from https://github.com/cryptopunksnotdead/awesome-24px):
|
77
|
+
- [Punks](https://raw.githubusercontent.com/larvalabs/cryptopunks/master/punks.png) ![image examples](https://github.com/cryptopunksnotdead/awesome-24px/raw/master/i/punks-strip.png)
|
78
|
+
- [Mohawks](https://raw.githubusercontent.com/cryptopunksnotdead/programming-cryptopunks/master/i/mohawks.png) ![image examples](https://github.com/cryptopunksnotdead/awesome-24px/raw/master/i/mohawks-strip.png)
|
79
|
+
- [Blondies](https://raw.githubusercontent.com/cryptopunksnotdead/programming-cryptopunks/master/i/blondies.png) ![image examples](https://github.com/cryptopunksnotdead/awesome-24px/raw/master/i/blondies-strip.png)
|
80
|
+
- [Zombies](https://raw.githubusercontent.com/cryptopunksnotdead/programming-cryptopunks/master/i/zombies.png) ![image examples](https://github.com/cryptopunksnotdead/awesome-24px/raw/master/i/zombies-strip.png)
|
81
|
+
- [Apes](https://raw.githubusercontent.com/cryptopunksnotdead/programming-cryptopunks/master/i/apes.png) ![image examples](https://github.com/cryptopunksnotdead/awesome-24px/raw/master/i/apes-strip.png)
|
82
|
+
- [Aliens](https://raw.githubusercontent.com/cryptopunksnotdead/programming-cryptopunks/master/i/aliens.png) ![image examples](https://github.com/cryptopunksnotdead/awesome-24px/raw/master/i/aliens-strip.png)
|
83
|
+
- [Golden Punks](https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/goldenpunks.png) ![image examples](https://github.com/cryptopunksnotdead/awesome-24px/raw/master/i/goldenpunks-strip.png)
|
84
|
+
- [Halloween Punks](https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/halloweenpunks.png) ![image examples](https://github.com/cryptopunksnotdead/awesome-24px/raw/master/i/halloweenpunks-strip.png)
|
85
|
+
- [Front Punks](https://raw.githubusercontent.com/cryptopunksnotdead/programming-cryptopunks/master/i/frontpunks.png) ![image examples](https://github.com/cryptopunksnotdead/awesome-24px/raw/master/i/frontpunks-strip.png)
|
86
|
+
- [More Punks](https://raw.githubusercontent.com/cryptopunksnotdead/programming-cryptopunks/master/i/morepunks.png') ![image examples](https://github.com/cryptopunksnotdead/awesome-24px/raw/master/i/morepunks-strip.png)
|
87
|
+
- [Expansion Punks](https://expansionpunks.com/provenance/expansionpunks.png) ![image examples](https://github.com/cryptopunksnotdead/awesome-24px/raw/master/i/expansionpunks-strip.png)
|
88
|
+
- [Avalanche Punks](https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/avalanchepunks.png) ![image examples](https://github.com/cryptopunksnotdead/awesome-24px/raw/master/i/avalanchepunks-strip.png)
|
89
|
+
- [International Punks](https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/intlpunks.png) ![image examples](https://github.com/cryptopunksnotdead/awesome-24px/raw/master/i/intlpunks-strip.png)
|
90
|
+
- [Ape Punks](https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/apepunks.png) ![image examples](https://github.com/cryptopunksnotdead/awesome-24px/raw/master/i/apepunks-strip.png)
|
91
|
+
- [Alien Clan](https://raw.githubusercontent.com/cryptopunksnotdead/programming-cryptopunks/master/i/alienclan.png) ![image examples](https://github.com/cryptopunksnotdead/awesome-24px/raw/master/i/alienclan-strip.png)
|
92
|
+
- [Bored Apes](https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/boredapes.png) ![image examples](https://github.com/cryptopunksnotdead/awesome-24px/raw/master/i/boredapes-strip.png)
|
93
|
+
- [Bored Apes Blue](https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/boredapes_blue.png) ![image examples](https://github.com/cryptopunksnotdead/awesome-24px/raw/master/i/boredapes_blue-strip.png)
|
94
|
+
- [Bored Apes Red](https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/boredapes_red.png) ![image examples](https://github.com/cryptopunksnotdead/awesome-24px/raw/master/i/boredapes_red-strip.png)
|
95
|
+
- [Bored Apes Neon Glow](https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/boredapes_neon_glow.png) ![image examples](https://github.com/cryptopunksnotdead/awesome-24px/raw/master/i/boredapes_neon_glow-strip.png)
|
96
|
+
- [Bored Apes Stars and Stripes](https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/boredapes_stars_and_stripes.png) ![image examples](https://github.com/cryptopunksnotdead/awesome-24px/raw/master/i/boredapes_stars_and_stripes-strip.png)
|
97
|
+
- [Bored Apes Acid](https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/boredapes_acid.png) ![image examples](https://github.com/cryptopunksnotdead/awesome-24px/raw/master/i/boredapes_acid-strip.png)
|
98
|
+
- [Cool Cats](https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/coolcats.png) ![image examples](https://github.com/cryptopunksnotdead/awesome-24px/raw/master/i/coolcats-strip.png)
|
99
|
+
- [Cool Cats Mohawks](https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/coolcats_mohawks.png) ![image examples](https://github.com/cryptopunksnotdead/awesome-24px/raw/master/i/coolcats_mohawks-strip.png)
|
100
|
+
- [Cool Cats Ninjas](https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/coolcats_ninjas.png) ![image examples](https://github.com/cryptopunksnotdead/awesome-24px/raw/master/i/coolcats_ninjas-strip.png)
|
101
|
+
- [Cool Cats TV Heads](https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/coolcats_tvheads.png) ![image examples](https://github.com/cryptopunksnotdead/awesome-24px/raw/master/i/coolcats_tvheads-strip.png)
|
102
|
+
- [Cool Cats Pirates](https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/coolcats_pirates.png) ![image examples](https://github.com/cryptopunksnotdead/awesome-24px/raw/master/i/coolcats_pirates-strip.png)
|
103
|
+
- [Cool Cats Unicorns](https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/coolcats_unicorns.png) ![image examples](https://github.com/cryptopunksnotdead/awesome-24px/raw/master/i/coolcats_unicorns-strip.png)
|
104
|
+
- [Cool Cats Dragons](https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/coolcats_dragons.png) ![image examples](https://github.com/cryptopunksnotdead/awesome-24px/raw/master/i/coolcats_dragons-strip.png)
|
105
|
+
- [Cool Cats Frogs](https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/coolcats_frogs.png) ![image examples](https://github.com/cryptopunksnotdead/awesome-24px/blob/master/i/coolcats_frogs-strip.png)
|
106
|
+
- [Pudgy Penguins](https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/pudgypenguins.png) ![image examples](https://github.com/cryptopunksnotdead/awesome-24px/raw/master/i/pudgypenguins-strip.png)
|
107
|
+
- [Dodge](https://raw.githubusercontent.com/cryptopunksnotdead/programming-cryptopunks/master/i/dodge.png) ![image examples](https://github.com/cryptopunksnotdead/awesome-24px/raw/master/i/dodge-strip.png)
|
108
|
+
- [Rocks](https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/rocks.png) ![image examples](https://github.com/cryptopunksnotdead/awesome-24px/raw/master/i/rocks-strip.png)
|
109
|
+
- [Punk Rocks](https://raw.githubusercontent.com/cryptopunksnotdead/programming-cryptopunks/master/i/punkrocks.png) ![image examples](https://github.com/cryptopunksnotdead/awesome-24px/raw/master/i/punkrocks-strip.png)
|
110
|
+
- [Tulips](https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/tulips.png) ![image examples](https://github.com/cryptopunksnotdead/awesome-24px/raw/master/i/tulips-strip.png)
|
111
|
+
|
112
|
+
![Screenshot](/screenshots/cryptopunks-gui-screenshot-collection-zombies.png)
|
113
|
+
|
114
|
+
![Screenshot](/screenshots/cryptopunks-gui-screenshot-collection-apes.png)
|
115
|
+
|
116
|
+
![Screenshot](/screenshots/cryptopunks-gui-screenshot-collection-alien-clan.png)
|
117
|
+
|
118
|
+
![Screenshot](/screenshots/cryptopunks-gui-screenshot-collection-bored-apes-stars-and-stripes.png)
|
119
|
+
|
120
|
+
![Screenshot](/screenshots/cryptopunks-gui-screenshot-collection-cool-cats-ninjas.png)
|
121
|
+
|
122
|
+
![Screenshot](/screenshots/cryptopunks-gui-screenshot-collection-dodge.png)
|
123
|
+
|
124
|
+
### Image Index
|
125
|
+
|
126
|
+
Change image index to pick a different image.
|
75
127
|
|
76
128
|
![Screenshot](/screenshots/cryptopunks-gui-screenshot-different-punk-index.png)
|
77
129
|
|
@@ -99,15 +151,33 @@ Change palette to get different punk colors.
|
|
99
151
|
|
100
152
|
Change style to get different punk looks.
|
101
153
|
|
154
|
+
#### Normal Style
|
155
|
+
|
102
156
|
![Screenshot](/screenshots/cryptopunks-gui-screenshot-style-normal.png)
|
103
157
|
|
158
|
+
#### Led Style
|
159
|
+
|
104
160
|
![Screenshot](/screenshots/cryptopunks-gui-screenshot-style-led.png)
|
105
161
|
|
162
|
+
##### Led Spacing
|
163
|
+
|
164
|
+
![Screenshot](/screenshots/cryptopunks-gui-screenshot-style-led-spacing.png)
|
165
|
+
|
166
|
+
##### Led Round Corner
|
167
|
+
|
168
|
+
![Screenshot](/screenshots/cryptopunks-gui-screenshot-style-led-round-corner.png)
|
169
|
+
|
170
|
+
#### Sketch Style
|
171
|
+
|
106
172
|
![Screenshot](/screenshots/cryptopunks-gui-screenshot-style-sketch.png)
|
107
173
|
|
174
|
+
##### Sketch Line
|
175
|
+
|
176
|
+
![Screenshot](/screenshots/cryptopunks-gui-screenshot-style-sketch-line.png)
|
177
|
+
|
108
178
|
### Mirror/Flip
|
109
179
|
|
110
|
-
Check mirror and/or flip to apply punk
|
180
|
+
Check mirror and/or flip to apply punk transformations. Can be combined with different palettes and styles.
|
111
181
|
|
112
182
|
![Screenshot](/screenshots/cryptopunks-gui-screenshot-no-mirror-no-flip.png)
|
113
183
|
|
@@ -119,6 +189,12 @@ Check mirror and/or flip to apply punk transformation. Can combine with differen
|
|
119
189
|
|
120
190
|
![Screenshot](/screenshots/cryptopunks-gui-screenshot-palette-false-style-led-mirror-flip.png)
|
121
191
|
|
192
|
+
### Output Location
|
193
|
+
|
194
|
+
You may select a new output location by clicking on the `...` button.
|
195
|
+
|
196
|
+
![Screenshot](/screenshots/cryptopunks-gui-screenshot-output-location.png)
|
197
|
+
|
122
198
|
## TODO
|
123
199
|
|
124
200
|
[TODO.md](TODO.md)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.8
|
data/app/cryptopunks_gui.rb
CHANGED
@@ -5,6 +5,7 @@ require 'fileutils'
|
|
5
5
|
require 'net/http'
|
6
6
|
require 'uri'
|
7
7
|
require 'glimmer/data_binding/observer'
|
8
|
+
require 'yaml'
|
8
9
|
require 'puts_debuggerer'
|
9
10
|
|
10
11
|
class CryptopunksGui
|
@@ -12,18 +13,60 @@ class CryptopunksGui
|
|
12
13
|
|
13
14
|
PALETTES = ['Standard'] + (Palette8bit.constants).map(&:name).map {|palette| palette.split('_').map(&:capitalize).join(' ')}.reject { |palette| palette.include?(' ') }.sort
|
14
15
|
STYLES = ['Normal', 'Led', 'Sketch']
|
16
|
+
COLLECTION_URL_MAP = {
|
17
|
+
'Punks' => 'https://raw.githubusercontent.com/larvalabs/cryptopunks/master/punks.png',
|
18
|
+
'Mohawks' => 'https://raw.githubusercontent.com/cryptopunksnotdead/programming-cryptopunks/master/i/mohawks.png',
|
19
|
+
'Blondies' => 'https://raw.githubusercontent.com/cryptopunksnotdead/programming-cryptopunks/master/i/blondies.png',
|
20
|
+
'Zombies' => 'https://raw.githubusercontent.com/cryptopunksnotdead/programming-cryptopunks/master/i/zombies.png',
|
21
|
+
'Apes' => 'https://raw.githubusercontent.com/cryptopunksnotdead/programming-cryptopunks/master/i/apes.png',
|
22
|
+
'Aliens' => 'https://raw.githubusercontent.com/cryptopunksnotdead/programming-cryptopunks/master/i/aliens.png',
|
23
|
+
'Golden Punks' => 'https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/goldenpunks.png',
|
24
|
+
'Halloween Punks' => 'https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/halloweenpunks.png',
|
25
|
+
'Front Punks' => 'https://raw.githubusercontent.com/cryptopunksnotdead/programming-cryptopunks/master/i/frontpunks.png',
|
26
|
+
'More Punks' => 'https://raw.githubusercontent.com/cryptopunksnotdead/programming-cryptopunks/master/i/morepunks.png',
|
27
|
+
'Expansion Punks' => 'https://expansionpunks.com/provenance/expansionpunks.png',
|
28
|
+
'Avalanche Punks' => 'https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/avalanchepunks.png',
|
29
|
+
'International Punks' => 'https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/intlpunks.png',
|
30
|
+
'Ape Punks' => 'https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/apepunks.png',
|
31
|
+
'Alien Clan' => 'https://raw.githubusercontent.com/cryptopunksnotdead/programming-cryptopunks/master/i/alienclan.png',
|
32
|
+
'Bored Apes' => 'https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/boredapes.png',
|
33
|
+
'Bored Apes Blue' => 'https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/boredapes_blue.png',
|
34
|
+
'Bored Apes Red' => 'https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/boredapes_red.png',
|
35
|
+
'Bored Apes Neon Glow' => 'https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/boredapes_neon_glow.png',
|
36
|
+
'Bored Apes Stars and Stripes' => 'https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/boredapes_stars_and_stripes.png',
|
37
|
+
'Bored Apes Acid' => 'https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/boredapes_acid.png',
|
38
|
+
'Cool Cats' => 'https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/coolcats.png',
|
39
|
+
'Cool Cats Mohawks' => 'https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/coolcats_mohawks.png',
|
40
|
+
'Cool Cats Ninjas' => 'https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/coolcats_ninjas.png',
|
41
|
+
'Cool Cats TV Heads' => 'https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/coolcats_tvheads.png',
|
42
|
+
'Cool Cats Pirates' => 'https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/coolcats_pirates.png',
|
43
|
+
'Cool Cats Unicorns' => 'https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/coolcats_unicorns.png',
|
44
|
+
'Cool Cats Dragons' => 'https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/coolcats_dragons.png',
|
45
|
+
'Cool Cats Frogs' => 'https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/coolcats_frogs.png',
|
46
|
+
'Pudgy Penguins' => 'https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/pudgypenguins.png',
|
47
|
+
'Dodge' => 'https://raw.githubusercontent.com/cryptopunksnotdead/programming-cryptopunks/master/i/dodge.png',
|
48
|
+
'Rocks' => 'https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/rocks.png',
|
49
|
+
'Punk Rocks' => 'https://raw.githubusercontent.com/cryptopunksnotdead/programming-cryptopunks/master/i/punkrocks.png',
|
50
|
+
'Tulips' => 'https://raw.githubusercontent.com/cryptopunksnotdead/awesome-24px/master/collection/tulips.png',
|
51
|
+
}
|
15
52
|
|
16
|
-
attr_accessor :
|
53
|
+
attr_accessor :collection, :image_index, :zoom, :palette, :style, :led_spacing, :led_round_corner, :sketch_line, :flip, :mirror
|
17
54
|
|
18
55
|
def initialize
|
19
|
-
|
56
|
+
initialize_punk_directory
|
57
|
+
initialize_collection
|
58
|
+
load_config
|
20
59
|
initialize_defaults
|
21
60
|
observe_image_attribute_changes
|
22
61
|
create_gui
|
23
|
-
self.
|
62
|
+
self.image_index = 0
|
24
63
|
@root.open
|
25
64
|
end
|
26
65
|
|
66
|
+
def collection_options
|
67
|
+
COLLECTION_URL_MAP.keys
|
68
|
+
end
|
69
|
+
|
27
70
|
def palette_options
|
28
71
|
PALETTES
|
29
72
|
end
|
@@ -32,53 +75,87 @@ class CryptopunksGui
|
|
32
75
|
STYLES
|
33
76
|
end
|
34
77
|
|
35
|
-
def
|
36
|
-
@punk_directory = File.join(Dir.home, '
|
78
|
+
def initialize_punk_directory
|
79
|
+
@punk_directory = @punk_config_directory = File.join(Dir.home, 'cryptopunks')
|
37
80
|
FileUtils.mkdir_p(@punk_directory)
|
38
|
-
|
39
|
-
|
40
|
-
|
81
|
+
end
|
82
|
+
|
83
|
+
def initialize_collection
|
84
|
+
return if @collection && @collection == @last_collection
|
85
|
+
@collection ||= COLLECTION_URL_MAP.keys.first
|
86
|
+
url = COLLECTION_URL_MAP[@collection]
|
87
|
+
@punk_file = File.join(@punk_config_directory, File.basename(url, '.png'))
|
88
|
+
File.write(@punk_file, Net::HTTP.get(URI(url))) unless File.exist?(@punk_file)
|
89
|
+
@images ||= {}
|
90
|
+
dimension = @collection.start_with?('Bored Apes') ? 28 : 24
|
91
|
+
@images[@collection] ||= Punks::Image::Composite.read(@punk_file, width: dimension, height: dimension)
|
92
|
+
@last_collection = @collection
|
93
|
+
self.image_index = 0
|
94
|
+
@image_index_spinbox.to = @images[@collection].size - 1 if @image_index_spinbox
|
95
|
+
end
|
96
|
+
|
97
|
+
def load_config
|
98
|
+
@punk_config_file = File.join(@punk_config_directory, 'cryptopunks.yml')
|
99
|
+
FileUtils.touch(@punk_config_file)
|
100
|
+
@punk_config = YAML.load(File.read(@punk_config_file)) || {punk_directory: @punk_directory}
|
101
|
+
@punk_directory = @punk_config[:punk_directory]
|
102
|
+
end
|
103
|
+
|
104
|
+
def save_config
|
105
|
+
File.write(@punk_config_file, YAML.dump(@punk_config))
|
41
106
|
end
|
42
107
|
|
43
108
|
def initialize_defaults
|
109
|
+
@collection = COLLECTION_URL_MAP.keys.first
|
44
110
|
@zoom = 12
|
45
111
|
@palette = PALETTES.first
|
46
112
|
@style = STYLES.first
|
113
|
+
@led_spacing = 2
|
114
|
+
@led_round_corner = false
|
115
|
+
@sketch_line = 1
|
47
116
|
@mirror = false
|
48
117
|
@flip = false
|
49
118
|
end
|
50
119
|
|
51
120
|
def observe_image_attribute_changes
|
52
121
|
observer = Glimmer::DataBinding::Observer.proc { generate_image }
|
53
|
-
observer.observe(self, :
|
122
|
+
observer.observe(self, :collection)
|
123
|
+
observer.observe(self, :image_index)
|
54
124
|
observer.observe(self, :zoom)
|
55
125
|
observer.observe(self, :palette)
|
56
126
|
observer.observe(self, :style)
|
127
|
+
observer.observe(self, :led_spacing)
|
128
|
+
observer.observe(self, :led_round_corner)
|
129
|
+
observer.observe(self, :sketch_line)
|
57
130
|
observer.observe(self, :mirror)
|
58
131
|
observer.observe(self, :flip)
|
59
132
|
end
|
60
133
|
|
61
134
|
def generate_image
|
62
|
-
|
135
|
+
initialize_collection
|
136
|
+
return if @image_index.to_i > @images[@collection].size
|
137
|
+
image_location = File.join(@punk_directory, "#{@collection.gsub(' ', '').downcase}-#{@image_index}#{"x#{@zoom}" if @zoom.to_i > 1}#{"-#{@palette.underscore}" if @palette != PALETTES.first}#{"-#{@style.underscore}" if @style != STYLES.first}.png")
|
63
138
|
puts "Writing punk image to #{image_location}"
|
64
|
-
selected_punk = @
|
139
|
+
selected_punk = @images[@collection][@image_index.to_i]
|
65
140
|
selected_punk = selected_punk.change_palette8bit(Palette8bit.const_get(@palette.gsub(' ', '_').upcase.to_sym)) if @palette != PALETTES.first
|
66
141
|
@original_zoom = @zoom
|
67
142
|
if @style != STYLES.first
|
68
|
-
|
69
|
-
if @style
|
70
|
-
|
71
|
-
|
143
|
+
style_options = {}
|
144
|
+
if @style == 'Led'
|
145
|
+
style_options[:spacing] = @led_spacing.to_i
|
146
|
+
style_options[:round_corner] = @led_round_corner
|
72
147
|
end
|
73
|
-
|
74
|
-
|
148
|
+
if @style == 'Sketch'
|
149
|
+
style_options[:line] = @sketch_line.to_i
|
150
|
+
end
|
151
|
+
selected_punk = selected_punk.send(@style.underscore, @zoom.to_i, **style_options)
|
75
152
|
end
|
76
153
|
selected_punk = selected_punk.mirror if @mirror
|
77
154
|
selected_punk = selected_punk.flip if @flip
|
78
|
-
selected_punk = selected_punk.zoom(@zoom.to_i)
|
155
|
+
selected_punk = selected_punk.zoom(@zoom.to_i) if @style == STYLES.first
|
79
156
|
selected_punk.save(image_location)
|
80
157
|
@image_label.image = image_location
|
81
|
-
@
|
158
|
+
@output_location_entry.text = image_location
|
82
159
|
@previous_style = @style
|
83
160
|
notify_observers(:zoom) if @zoom != @original_zoom
|
84
161
|
end
|
@@ -90,17 +167,20 @@ class CryptopunksGui
|
|
90
167
|
|
91
168
|
frame {
|
92
169
|
label {
|
93
|
-
text '
|
94
|
-
|
170
|
+
text 'Collection:'
|
171
|
+
}
|
172
|
+
combobox {
|
173
|
+
readonly true
|
174
|
+
text <=> [self, :collection]
|
95
175
|
}
|
96
176
|
|
97
177
|
label {
|
98
|
-
text '
|
178
|
+
text 'Image Index:'
|
99
179
|
}
|
100
|
-
spinbox {
|
180
|
+
@image_index_spinbox = spinbox {
|
101
181
|
from 0
|
102
|
-
to @
|
103
|
-
text <=> [self, :
|
182
|
+
to @images[@collection].size - 1
|
183
|
+
text <=> [self, :image_index]
|
104
184
|
}
|
105
185
|
|
106
186
|
label {
|
@@ -125,13 +205,17 @@ class CryptopunksGui
|
|
125
205
|
}
|
126
206
|
combobox {
|
127
207
|
readonly true
|
128
|
-
text <=> [self, :style]
|
208
|
+
text <=> [self, :style, after_write: ->(val) {add_style_options}]
|
209
|
+
}
|
210
|
+
|
211
|
+
@style_options_frame = frame {
|
212
|
+
padding 0
|
129
213
|
}
|
130
214
|
|
131
215
|
frame {
|
132
216
|
padding 0
|
133
217
|
|
134
|
-
|
218
|
+
checkbutton {
|
135
219
|
grid row: 0, column: 0, column_weight: 0
|
136
220
|
variable <=> [self, :mirror]
|
137
221
|
}
|
@@ -144,7 +228,7 @@ class CryptopunksGui
|
|
144
228
|
end
|
145
229
|
}
|
146
230
|
|
147
|
-
|
231
|
+
checkbutton {
|
148
232
|
grid row: 0, column: 2
|
149
233
|
variable <=> [self, :flip]
|
150
234
|
}
|
@@ -161,8 +245,26 @@ class CryptopunksGui
|
|
161
245
|
label {
|
162
246
|
text 'Output Location:'
|
163
247
|
}
|
164
|
-
|
165
|
-
|
248
|
+
frame {
|
249
|
+
padding 0
|
250
|
+
|
251
|
+
@output_location_entry = entry {
|
252
|
+
grid row: 0, column: 0
|
253
|
+
readonly true
|
254
|
+
width 47
|
255
|
+
}
|
256
|
+
button {
|
257
|
+
grid row: 0, column: 1
|
258
|
+
text '...'
|
259
|
+
width 1.1
|
260
|
+
|
261
|
+
on('command') do
|
262
|
+
@punk_directory = choose_directory(parent: @root)
|
263
|
+
@punk_config[:punk_directory] = @punk_directory
|
264
|
+
save_config
|
265
|
+
generate_image
|
266
|
+
end
|
267
|
+
}
|
166
268
|
}
|
167
269
|
|
168
270
|
@image_label = label {
|
@@ -171,6 +273,62 @@ class CryptopunksGui
|
|
171
273
|
}
|
172
274
|
}
|
173
275
|
end
|
276
|
+
|
277
|
+
def add_style_options
|
278
|
+
@style_options_frame.content {
|
279
|
+
@style_options_frame.children.each(&:destroy)
|
280
|
+
if @style == 'Led'
|
281
|
+
frame {
|
282
|
+
padding 0
|
283
|
+
|
284
|
+
label {
|
285
|
+
grid row: 0, column: 0, column_weight: 0
|
286
|
+
text 'Spacing:'
|
287
|
+
}
|
288
|
+
spinbox {
|
289
|
+
grid row: 0, column: 1
|
290
|
+
from 1
|
291
|
+
to 72
|
292
|
+
text <=> [self, :led_spacing]
|
293
|
+
}
|
294
|
+
|
295
|
+
checkbutton {
|
296
|
+
grid row: 0, column: 2
|
297
|
+
variable <=> [self, :led_round_corner]
|
298
|
+
}
|
299
|
+
label {
|
300
|
+
grid row: 0, column: 3
|
301
|
+
text 'Round Corner'
|
302
|
+
|
303
|
+
on('Button-1') do
|
304
|
+
self.led_round_corner = !led_round_corner
|
305
|
+
end
|
306
|
+
}
|
307
|
+
}
|
308
|
+
elsif @style == 'Sketch'
|
309
|
+
frame {
|
310
|
+
padding 0
|
311
|
+
|
312
|
+
label {
|
313
|
+
grid row: 0, column: 0, column_weight: 0
|
314
|
+
text 'Line:'
|
315
|
+
}
|
316
|
+
spinbox {
|
317
|
+
grid row: 0, column: 1
|
318
|
+
from 1
|
319
|
+
to 72
|
320
|
+
text <=> [self, :sketch_line]
|
321
|
+
}
|
322
|
+
}
|
323
|
+
else
|
324
|
+
frame { # filler
|
325
|
+
padding 0
|
326
|
+
height 0
|
327
|
+
width 0
|
328
|
+
}
|
329
|
+
end
|
330
|
+
}
|
331
|
+
end
|
174
332
|
end
|
175
333
|
|
176
334
|
CryptopunksGui.new.launch
|
data/cryptopunks-gui.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
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.8 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.8"
|
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-
|
14
|
+
s.date = "2021-10-28"
|
15
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]
|
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.8
|
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
|