telescope-term 0.5.5 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/telescope +54 -32
  3. metadata +5 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b4b0126ce3cf3b86c84f8f52e82e76c7e9c8e6d00c91d10d0814f817a6e38e4e
4
- data.tar.gz: ae64b594368f3934623f6805baf839d9c24649a6335167013fec173cb41aa781
3
+ metadata.gz: '08f50f6b936107d17a1c1181fb29d4aab316d02a3fbb490cdef209c0ec600a3f'
4
+ data.tar.gz: ede84387b11c5686d133358555ae9619db1f4ae631266026cdf69673d3d76840
5
5
  SHA512:
6
- metadata.gz: 1d6ae5826300b3bd8489bbb339a4af342ee3c48815d491fe1134d334548a49bb8c23e377dd5b89dc25c376b448ad5d05e3da93021da63f69ccb5cf032bb043d1
7
- data.tar.gz: 11fb99f9393c15ffd4a1872a0b0a6454e0ea22120e353bd9bf4eed901699ef788d8939509a32cdd69962b5083cedd38cf015f4f78ea7371603f88a598625faff
6
+ metadata.gz: 25cf97357a8747e8b3aeb503bfc47f3d0c55486ae3047e60b6358d42aad3c1f6228ffeecbec88fba0453ef933230cc09d6c3996f15d544fba424ea0bdd5a6cfb
7
+ data.tar.gz: 9bd51eba4c76fa984958cf4d146123fd217193c173d29ab703894ef54123dc40fd832d7a09652f991a164e02b7fce7c9cd2ff1f3f3d8e2eea3b54f0dfe3ddb4e
data/bin/telescope CHANGED
@@ -6,6 +6,7 @@
6
6
  apperature (APP) and the focal length (FL) in the "command line" at the bottom and press ENTER. Add an eyepiece with 'e' and enter
7
7
  a name, the focal length (FL) and apparent field of view (AFOV) and press ENTER. Select items by using the TAB/UP/DOWN cursor keys.
8
8
  Press ENTER on a selected item to change the values in the command line. Delete an item by pressing 'D'. Move an with PgUP/PgDown keys.
9
+ Sort telescopes with 'T' (toggles sorting by the first thre columns; Name, APP, FL). Sort eyepieces in the same way with the 'E' key.
9
10
  Tag items with the SPACE key (untag all with 'u'), then press 'o' to create an observation log file (content shown in the lower panel).
10
11
  Refresh all panels with the 'r' key. Escape the selected panels or the command line by pressing 'Ctrl-G'. Quit via 'q' (or 'Q' if you
11
12
  don't want to save your edits since last session). Save a backup session with 'b' and load a saved backup session with the 'B' key.
@@ -45,8 +46,11 @@ begin # BASIC SETUP
45
46
  @tsmark = false
46
47
  @epmark = false
47
48
 
48
- @tstag = []
49
- @eptag = []
49
+ @tstag = []
50
+ @eptag = []
51
+
52
+ @t_sort = false
53
+ @e_sort = false
50
54
  end
51
55
  if File.exist?(Dir.home+'/.telescope')
52
56
  load(Dir.home+'/.telescope')
@@ -154,7 +158,7 @@ class Curses::Window # CLASS EXTENSION
154
158
  end
155
159
  end
156
160
  def getchr # PROCESS KEY PRESSES
157
- c = STDIN.getch
161
+ c = STDIN.getch(min: 0, time: 1)
158
162
  case c
159
163
  when "\e" # ANSI escape sequences
160
164
  case $stdin.getc
@@ -187,12 +191,12 @@ end
187
191
  def main_getkey # GET KEY FROM USER
188
192
  chr = getchr
189
193
  case chr
190
- when '?' # Show helptext in right window
194
+ when '?' # Show helptext in lower panel
191
195
  @w_ep.clr
192
196
  @w_ep.pa(249, 0, 0, @help)
193
197
  @w_ep.p("\n ...Press any key to continue")
194
198
  getch
195
- when 'TAB'
199
+ when 'TAB' # Move between the panels
196
200
  if @tsmark
197
201
  @tsmark = false
198
202
  @epmark = 0
@@ -203,10 +207,10 @@ def main_getkey # GET KEY FROM USER
203
207
  @tsmark = 0
204
208
  @epmark = false
205
209
  end
206
- when 'C-G'
210
+ when 'C-G' # Escape from panel selections or command line
207
211
  @epmark = false
208
212
  @tsmark = false
209
- when 'ENTER'
213
+ when 'ENTER' # Edit selected item in the command line (or refresh panels)
210
214
  if @tsmark
211
215
  out = "#{@ts[@tsmark][0]}, #{@ts[@tsmark][1]}, #{@ts[@tsmark][2]}"
212
216
  ret = w_cm_getstr("", out).split(",")
@@ -222,7 +226,7 @@ def main_getkey # GET KEY FROM USER
222
226
  ret[2] = ret[2].to_i
223
227
  @ep[@epmark] = ret
224
228
  end
225
- when 't'
229
+ when 't' # Add a telescope
226
230
  return if @ts.length == 5
227
231
  ret = w_cm_getstr("", "Telescope, App, FL").split(",")
228
232
  return if ret.length != 3
@@ -231,7 +235,7 @@ def main_getkey # GET KEY FROM USER
231
235
  ret[1] = 1 if ret[1] == 0
232
236
  ret[2] = 1 if ret[2] == 0
233
237
  @ts[@ts.length] = ret
234
- when 'e'
238
+ when 'e' # Add an eyepiece
235
239
  ret = w_cm_getstr("", "Eyepiece, FL, AFOV").split(",")
236
240
  return if ret.length != 3
237
241
  ret[1] = ret[1].to_f
@@ -239,7 +243,7 @@ def main_getkey # GET KEY FROM USER
239
243
  ret[1] = 1 if ret[1] == 0
240
244
  ret[2] = 1 if ret[2] == 0
241
245
  @ep[@ep.length] = ret
242
- when 'D'
246
+ when 'D' # Delete selected item (telescope or eyepiece)
243
247
  if @tsmark
244
248
  @ts.delete_at(@tsmark)
245
249
  @tsmark -= 1
@@ -247,7 +251,21 @@ def main_getkey # GET KEY FROM USER
247
251
  @ep.delete_at(@epmark)
248
252
  @epmark -= 1
249
253
  end
250
- when 'UP' # Examples of moving up and down in a window
254
+ when 'T' # Sort telescopes by next column (Name, APP, FL)
255
+ if @t_sort == false or @t_sort == 2
256
+ @t_sort = 0
257
+ else
258
+ @t_sort += 1
259
+ end
260
+ @ts = @ts.sort {|a,b| b[@t_sort] <=> a[@t_sort]}
261
+ when 'E' # Sort eyepiece by next column (Name, FL, AFOV)
262
+ if @e_sort == false or @e_sort == 2
263
+ @e_sort = 0
264
+ else
265
+ @e_sort += 1
266
+ end
267
+ @ep = @ep.sort {|a,b| b[@e_sort] <=> a[@e_sort]}
268
+ when 'UP' # Move to one item up
251
269
  if @tsmark
252
270
  if @tsmark == 0
253
271
  @tsmark = false
@@ -264,7 +282,7 @@ def main_getkey # GET KEY FROM USER
264
282
  else
265
283
  @epmark = @ep.length - 1
266
284
  end
267
- when 'DOWN'
285
+ when 'DOWN' # Move to one item down
268
286
  if @tsmark
269
287
  if @tsmark == @ts.length - 1
270
288
  @tsmark = false
@@ -281,7 +299,7 @@ def main_getkey # GET KEY FROM USER
281
299
  else
282
300
  @tsmark = 0
283
301
  end
284
- when 'PgUP'
302
+ when 'PgUP' # Move selected item up by one
285
303
  if @tsmark
286
304
  t = @ts.delete_at(@tsmark)
287
305
  @tsmark -= 1 unless @tsmark == 0
@@ -291,7 +309,7 @@ def main_getkey # GET KEY FROM USER
291
309
  @epmark -= 1 unless @epmark == 0
292
310
  @ep.insert(@epmark, e)
293
311
  end
294
- when 'PgDOWN'
312
+ when 'PgDOWN' # Move selected item by one down
295
313
  if @tsmark
296
314
  t = @ts.delete_at(@tsmark)
297
315
  @tsmark += 1 unless @tsmark == @ts.length
@@ -301,19 +319,19 @@ def main_getkey # GET KEY FROM USER
301
319
  @epmark += 1 unless @epmark == @ep.length
302
320
  @ep.insert(@epmark, e)
303
321
  end
304
- when 'HOME'
322
+ when 'HOME' # Jump to first item in the panel
305
323
  if @tsmark
306
324
  @tsmark = 0
307
325
  elsif @epmark
308
326
  @epmark = 0
309
327
  end
310
- when 'END'
328
+ when 'END' # Move to last item in the panel
311
329
  if @tsmark
312
330
  @tsmark = @ts.length - 1
313
331
  elsif @epmark
314
332
  @epmark = @ep.length - 1
315
333
  end
316
- when ' '
334
+ when ' ' # Tag selected item to be used in observation file/log
317
335
  if @tsmark
318
336
  @tstag.include?(@tsmark) ? @tstag.delete(@tsmark) : @tstag.push(@tsmark)
319
337
  @tsmark += 1 unless @tsmark == @ts.length - 1
@@ -321,23 +339,23 @@ def main_getkey # GET KEY FROM USER
321
339
  @eptag.include?(@epmark) ? @eptag.delete(@epmark) : @eptag.push(@epmark)
322
340
  @epmark += 1 unless @epmark == @ep.length - 1
323
341
  end
324
- when 'u'
342
+ when 'u' # Untag all tagget items
325
343
  @tstag.clear
326
344
  @eptag.clear
327
- when 'o'
345
+ when 'o' # Create observation file/log and show content in lower panel
328
346
  observe
329
- when 'b'
347
+ when 'b' # Create backup file (~/.telescope.bu) with current items
330
348
  File.write(Dir.home+'/.telescope.bu',"@ts = #{@ts}\n@ep = #{@ep}")
331
- when 'B'
349
+ when 'B' # Read items from backup file
332
350
  if File.exist?(Dir.home+'/.telescope.bu')
333
351
  load(Dir.home+'/.telescope.bu')
334
352
  end
335
- when 'r'
353
+ when 'r' # Hard refres panels
336
354
  @break = true
337
- when 'q' # Exit
355
+ when 'q' # Exit after saving items to ~/.telescope
338
356
  File.write(Dir.home+'/.telescope',"@ts = #{@ts}\n@ep = #{@ep}")
339
357
  exit 0
340
- when 'Q' # Exit
358
+ when 'Q' # Exit without saving items
341
359
  exit 0
342
360
  else
343
361
  end
@@ -425,19 +443,19 @@ def w_ts_show
425
443
  out = (d**2/49).to_i.to_s.rjust(6)
426
444
  @w_ts.pa(229, 0, 0, out) # xEYE
427
445
  out = magx(d, f, 1/7.to_f)
428
- @w_ts.pa(194, 0, 0, out) # MINx
446
+ @w_ts.pa(157, 0, 0, out) # MINx
429
447
  out = magx(d, f, 2)
430
- @w_ts.pa(194, 0, 0, out) # MAXx
448
+ @w_ts.pa(157, 0, 0, out) # MAXx
431
449
  out = magx(d, f, 1/6.4)
432
- @w_ts.pa(189, 0, 0, out) # *FIELD
450
+ @w_ts.pa(195, 0, 0, out) # *FIELD
433
451
  out = magx(d, f, 1/3.6)
434
- @w_ts.pa(189, 0, 0, out) # GX/NEB
452
+ @w_ts.pa(195, 0, 0, out) # GX/NEB
435
453
  out = magx(d, f, 1/2.1)
436
- @w_ts.pa(189, 0, 0, out) # PL/GCL
454
+ @w_ts.pa(195, 0, 0, out) # PL/GCL
437
455
  out = magx(d, f, 1/1.3)
438
- @w_ts.pa(189, 0, 0, out) # PLd/2*
456
+ @w_ts.pa(195, 0, 0, out) # PLd/2*
439
457
  out = magx(d, f, 1/0.7)
440
- @w_ts.pa(189, 0, 0, out) # TGHT2*
458
+ @w_ts.pa(195, 0, 0, out) # TGHT2*
441
459
  out = (115.824/d).truncate(2).dec2.to_s.rjust(7)
442
460
  @w_ts.pa(219, 0, 0, out) # DL-SEP
443
461
  out = (3600*Math::asin(671E-6/d).rad).truncate(2).dec2.to_s.rjust(8)
@@ -605,7 +623,11 @@ loop do # OUTER LOOP - (catching refreshes via 'r')
605
623
  w_cm_show
606
624
  main_getkey # Get key from user
607
625
  break if @break # Break to outer loop, redrawing windows, if user hit 'r'
608
- break if Curses.cols != maxx or Curses.lines != maxy # break on terminal resize
626
+ if Curses.cols != maxx or Curses.lines != maxy # break on terminal resize
627
+ close_screen
628
+ puts " You must run Telescope with a minimum tarminal width of 140 chracters."
629
+ break
630
+ end
609
631
  end
610
632
  ensure # On exit: close curses, clear terminal
611
633
  close_screen
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: telescope-term
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-12 00:00:00.000000000 Z
11
+ date: 2021-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curses
@@ -32,8 +32,9 @@ dependencies:
32
32
  version: 1.3.2
33
33
  description: 'With this program you can list your telescopes and eyepieces and get
34
34
  a set of calculations done for each scope and for the combination of scope and eyepiece.
35
- Easy interface. Run the program, then hit ''?'' to show the help file. New in v0.5.4:
36
- Fixed minor glitch.'
35
+ Easy interface. Run the program, then hit ''?'' to show the help file. New in v0.6.0:
36
+ Added sorting of telescopes (via ''T'') and eyepieces (''E''). New in 1.6.3: Less
37
+ resources needed.'
37
38
  email: g@isene.com
38
39
  executables:
39
40
  - telescope