cryptopunks-gui 0.0.1 → 0.0.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 638f51a380dd6b45383886ed659fc66f4c1c1146cc077f6ac0730df1091a0f76
4
- data.tar.gz: faebbbfbe3b248634efb2778c7d489263eea2eebc199537cd1fc6d952fac8a04
3
+ metadata.gz: d349e8c9967a50ce0c6af942f6cc3c3673f65a3daffcad18f9bd237ec70958d2
4
+ data.tar.gz: 25ed4d8548aad51cc5dba533ed70edc42032e4850bddbbed3e659e2b1ebe9ca1
5
5
  SHA512:
6
- metadata.gz: 41603636b0e506f8c2d2fc72a94503238c2175b83ef09646bfbcfd1fb3b30af281cbe868521e0c76282758b9b0f2c5fd9592305d334411cbb626f42aa48d925a
7
- data.tar.gz: 34b378495780b241c5a123da56e249c775286e6f5aed81a300b7f07b860fa2beb1dccb3964efad2b1e91294af28b671d45bbd24841fadd95df95d05dbbae1b87
6
+ metadata.gz: 4d06d0a8c6c1c4a8f65290e85f7d645a0b19206d58c53b7ed365827a4ba46a99d14db0a41d8bf774abb07e8bc7e43ec008233e3f8b241ccf305ecb341f5bacb0
7
+ data.tar.gz: 4ba66061f49bb601ccf0bebb5e8712526ec081831dc3a792af57b967d769d4c75212184636114999396ae43d48632b2f2ed34d1566c43eb4a5fa8fb63fb236f5
data/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.0.5
4
+
5
+ - Led style spacing option
6
+ - Led style round corner option
7
+ - Sketch style line option
8
+ - Apply zoom to led and sketch styles correctly
9
+ - Fixed issue with typing punk index higher than 9999 (ignore)
10
+
11
+ ## 0.0.4
12
+
13
+ - Changed flip and mirror to checkbuttons
14
+ - Fixed zooming for led and sketch styles
15
+
16
+ ## 0.0.3
17
+
18
+ - Style support (e.g. mirror, flip, sketch, led)
19
+
20
+ ## 0.0.2
21
+
22
+ - Palette support (e.g. grayscale or sepia)
23
+
3
24
  ## 0.0.1
4
25
 
5
26
  - Initial CryptoPunks GUI with support for punk index and zoom
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
1
+ # <img src="https://raw.githubusercontent.com/AndyObtiva/cryptopunks-gui/master/icons/cryptopunks-gui.png" height=85 /> CryptoPunks GUI 0.0.5
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
 
@@ -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.1
28
+ gem install cryptopunks-gui -v0.0.5
29
29
  ```
30
30
 
31
31
  Afterwards, run app via:
@@ -67,6 +67,76 @@ Alternatively, run app manually via:
67
67
  ruby app/cryptopunks_gui.rb
68
68
  ```
69
69
 
70
+ ## Instructions
71
+
72
+ ### Punk Index
73
+
74
+ Change punk index to pick a different punk.
75
+
76
+ ![Screenshot](/screenshots/cryptopunks-gui-screenshot-different-punk-index.png)
77
+
78
+ ### Zoom
79
+
80
+ Change zoom to enlarge punk to your liking.
81
+
82
+ ![Screenshot](/screenshots/cryptopunks-gui-screenshot-different-zoom.png)
83
+
84
+ ### Palette
85
+
86
+ Change palette to get different punk colors.
87
+
88
+ ![Screenshot](/screenshots/cryptopunks-gui-screenshot-palette-standard.png)
89
+
90
+ ![Screenshot](/screenshots/cryptopunks-gui-screenshot-palette-sepia.png)
91
+
92
+ ![Screenshot](/screenshots/cryptopunks-gui-screenshot-palette-blue.png)
93
+
94
+ ![Screenshot](/screenshots/cryptopunks-gui-screenshot-palette-false.png)
95
+
96
+ ![Screenshot](/screenshots/cryptopunks-gui-screenshot-palette-grayscale.png)
97
+
98
+ ### Style
99
+
100
+ Change style to get different punk looks.
101
+
102
+ #### Normal Style
103
+
104
+ ![Screenshot](/screenshots/cryptopunks-gui-screenshot-style-normal.png)
105
+
106
+ #### Led Style
107
+
108
+ ![Screenshot](/screenshots/cryptopunks-gui-screenshot-style-led.png)
109
+
110
+ ##### Led Spacing
111
+
112
+ ![Screenshot](/screenshots/cryptopunks-gui-screenshot-style-led-spacing.png)
113
+
114
+ ##### Led Round Corner
115
+
116
+ ![Screenshot](/screenshots/cryptopunks-gui-screenshot-style-led-round-corner.png)
117
+
118
+ #### Sketch Style
119
+
120
+ ![Screenshot](/screenshots/cryptopunks-gui-screenshot-style-sketch.png)
121
+
122
+ ##### Sketch Line
123
+
124
+ ![Screenshot](/screenshots/cryptopunks-gui-screenshot-style-sketch-line.png)
125
+
126
+ ### Mirror/Flip
127
+
128
+ Check mirror and/or flip to apply punk transformation. Can combine with different palettes and styles.
129
+
130
+ ![Screenshot](/screenshots/cryptopunks-gui-screenshot-no-mirror-no-flip.png)
131
+
132
+ ![Screenshot](/screenshots/cryptopunks-gui-screenshot-mirror.png)
133
+
134
+ ![Screenshot](/screenshots/cryptopunks-gui-screenshot-flip.png)
135
+
136
+ ![Screenshot](/screenshots/cryptopunks-gui-screenshot-mirror-flip.png)
137
+
138
+ ![Screenshot](/screenshots/cryptopunks-gui-screenshot-palette-false-style-led-mirror-flip.png)
139
+
70
140
  ## TODO
71
141
 
72
142
  [TODO.md](TODO.md)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.5
@@ -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'
@@ -9,35 +10,86 @@ require 'puts_debuggerer'
9
10
  class CryptopunksGui
10
11
  include Glimmer
11
12
 
12
- attr_accessor :punk_index, :zoom
13
+ PALETTES = ['Standard'] + (Palette8bit.constants).map(&:name).map {|palette| palette.split('_').map(&:capitalize).join(' ')}.reject { |palette| palette.include?(' ') }.sort
14
+ STYLES = ['Normal', 'Led', 'Sketch']
15
+
16
+ attr_accessor :punk_index, :zoom, :palette, :style, :led_spacing, :led_round_corner, :sketch_line, :flip, :mirror
13
17
 
14
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
15
36
  @punk_directory = File.join(Dir.home, '.cryptopunks')
16
37
  FileUtils.mkdir_p(@punk_directory)
17
38
  @punk_file = File.join(@punk_directory, 'punks.png')
18
39
  File.write(@punk_file, Net::HTTP.get(URI('https://raw.githubusercontent.com/larvalabs/cryptopunks/master/punks.png'))) unless File.exist?(@punk_file)
19
40
  @punks = Punks::Image::Composite.read(@punk_file)
41
+ end
42
+
43
+ def initialize_defaults
20
44
  @zoom = 12
21
-
22
- observer = Glimmer::DataBinding::Observer.proc do
23
- generate_image
24
- end
45
+ @palette = PALETTES.first
46
+ @style = STYLES.first
47
+ @led_spacing = 2
48
+ @led_round_corner = false
49
+ @sketch_line = 1
50
+ @mirror = false
51
+ @flip = false
52
+ end
53
+
54
+ def observe_image_attribute_changes
55
+ observer = Glimmer::DataBinding::Observer.proc { generate_image }
25
56
  observer.observe(self, :punk_index)
26
57
  observer.observe(self, :zoom)
27
-
28
- create_gui
29
- self.punk_index = 0
30
- @root.open
58
+ observer.observe(self, :palette)
59
+ observer.observe(self, :style)
60
+ observer.observe(self, :led_spacing)
61
+ observer.observe(self, :led_round_corner)
62
+ observer.observe(self, :sketch_line)
63
+ observer.observe(self, :mirror)
64
+ observer.observe(self, :flip)
31
65
  end
32
66
 
33
67
  def generate_image
34
- image_location = File.join(@punk_directory, "punk-#{@punk_index}#{"x#{@zoom}" if @zoom.to_i > 1}.png")
68
+ return if @punk_index.to_i > 9999
69
+ 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")
35
70
  puts "Writing punk image to #{image_location}"
36
71
  selected_punk = @punks[@punk_index.to_i]
37
- selected_punk = selected_punk.zoom(@zoom.to_i)
72
+ selected_punk = selected_punk.change_palette8bit(Palette8bit.const_get(@palette.gsub(' ', '_').upcase.to_sym)) if @palette != PALETTES.first
73
+ @original_zoom = @zoom
74
+ if @style != STYLES.first
75
+ style_options = {}
76
+ if @style == 'Led'
77
+ style_options[:spacing] = @led_spacing.to_i
78
+ style_options[:round_corner] = @led_round_corner
79
+ end
80
+ if @style == 'Sketch'
81
+ style_options[:line] = @sketch_line.to_i
82
+ end
83
+ selected_punk = selected_punk.send(@style.underscore, @zoom.to_i, **style_options)
84
+ end
85
+ selected_punk = selected_punk.mirror if @mirror
86
+ selected_punk = selected_punk.flip if @flip
87
+ selected_punk = selected_punk.zoom(@zoom.to_i) if @style == STYLES.first
38
88
  selected_punk.save(image_location)
39
89
  @image_label.image = image_location
40
90
  @message_entry.text = image_location
91
+ @previous_style = @style
92
+ notify_observers(:zoom) if @zoom != @original_zoom
41
93
  end
42
94
 
43
95
  def create_gui
@@ -69,6 +121,56 @@ class CryptopunksGui
69
121
  text <=> [self, :zoom]
70
122
  }
71
123
 
124
+ label {
125
+ text 'Palette:'
126
+ }
127
+ combobox {
128
+ readonly true
129
+ text <=> [self, :palette]
130
+ }
131
+
132
+ label {
133
+ text 'Style:'
134
+ }
135
+ combobox {
136
+ readonly true
137
+ text <=> [self, :style, after_write: ->(val) {add_style_options}]
138
+ }
139
+
140
+ @style_options_frame = frame {
141
+ padding 0
142
+ }
143
+
144
+ frame {
145
+ padding 0
146
+
147
+ checkbutton {
148
+ grid row: 0, column: 0, column_weight: 0
149
+ variable <=> [self, :mirror]
150
+ }
151
+ label {
152
+ grid row: 0, column: 1
153
+ text 'Mirror'
154
+
155
+ on('Button-1') do
156
+ self.mirror = !mirror
157
+ end
158
+ }
159
+
160
+ checkbutton {
161
+ grid row: 0, column: 2
162
+ variable <=> [self, :flip]
163
+ }
164
+ label {
165
+ grid row: 0, column: 3
166
+ text 'Flip'
167
+
168
+ on('Button-1') do
169
+ self.flip = !flip
170
+ end
171
+ }
172
+ }
173
+
72
174
  label {
73
175
  text 'Output Location:'
74
176
  }
@@ -82,6 +184,62 @@ class CryptopunksGui
82
184
  }
83
185
  }
84
186
  end
187
+
188
+ def add_style_options
189
+ @style_options_frame.content {
190
+ @style_options_frame.children.each(&:destroy)
191
+ if @style == 'Led'
192
+ frame {
193
+ padding 0
194
+
195
+ label {
196
+ grid row: 0, column: 0, column_weight: 0
197
+ text 'Spacing:'
198
+ }
199
+ spinbox {
200
+ grid row: 0, column: 1
201
+ from 1
202
+ to 72
203
+ text <=> [self, :led_spacing]
204
+ }
205
+
206
+ checkbutton {
207
+ grid row: 0, column: 2
208
+ variable <=> [self, :led_round_corner]
209
+ }
210
+ label {
211
+ grid row: 0, column: 3
212
+ text 'Round Corner'
213
+
214
+ on('Button-1') do
215
+ self.led_round_corner = !led_round_corner
216
+ end
217
+ }
218
+ }
219
+ elsif @style == 'Sketch'
220
+ frame {
221
+ padding 0
222
+
223
+ label {
224
+ grid row: 0, column: 0, column_weight: 0
225
+ text 'Line:'
226
+ }
227
+ spinbox {
228
+ grid row: 0, column: 1
229
+ from 1
230
+ to 72
231
+ text <=> [self, :sketch_line]
232
+ }
233
+ }
234
+ else
235
+ frame { # filler
236
+ padding 0
237
+ height 0
238
+ width 0
239
+ }
240
+ end
241
+ }
242
+ end
85
243
  end
86
244
 
87
245
  CryptopunksGui.new.launch
@@ -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.1 ruby app
5
+ # stub: cryptopunks-gui 0.0.5 ruby app
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "cryptopunks-gui".freeze
9
- s.version = "0.0.1"
9
+ s.version = "0.0.5"
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
14
  s.date = "2021-10-25"
15
- s.description = "Cryptopunks GUI for simplified minting built with Glimmer DSL for Tk (requires ActiveTcl to run cryptopunks-gui command)".freeze
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 = "Cryptopunks GUI for Simplified Minting".freeze
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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cryptopunks-gui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
@@ -108,7 +108,7 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
- description: Cryptopunks GUI for simplified minting built with Glimmer DSL for Tk
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: Cryptopunks GUI for Simplified Minting
152
+ summary: CryptoPunks GUI for Simplified Minting
153
153
  test_files: []