telescope-term 0.5.3 → 0.6.1

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 +55 -37
  3. metadata +5 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6bccc053edff15e7f32e22c80a0cff25b3ffbc88155743eae29b4cfc1b0a6591
4
- data.tar.gz: 6b94e933c3bf9b2f263940b5bded516e155972fea4b7cfe492dc9d59ca5b8899
3
+ metadata.gz: fb2d1c8b0a4a543b49ea37f556097e9e18b83c8f50137c7c598ab777e9abfd2f
4
+ data.tar.gz: dc4c5ae482437a8f593295e330b4c7197ee9b5a73f9152a8d8e4368371cbdbcc
5
5
  SHA512:
6
- metadata.gz: bad1524541bd4b94f2c8ea827860239ba74c3bb76fc0b0405828dde8c5c833f612b3cf403f86f8123eb2c4228e34922f00e057b58f9da7a73ef0ce57d542a934
7
- data.tar.gz: 9c58155c752fc6b0bd24b6791be425d0b5c53b08ca7d0c5e01d9f94392ea3dfe751d48a015ab45740df4179468b0f6623f2ad3fcccd7af575bed79c779b1e0d8
6
+ metadata.gz: 8844bc5db1e9d98c6430911d5b7cff28dddb07db479f0ed70e4303ae69c325af558f30e2f3953bcd1b3f68261a52d71c5b0d0d75a683402463277048eca9cafe
7
+ data.tar.gz: 438909bf6b2ec61a250092cf3baaccc816382c687ee6e10b793b8aa04ea67e17463eb46984813179cc0cf66f831fe6436aa9e591768855870c2a8714120d4150
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')
@@ -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
@@ -402,16 +420,16 @@ end
402
420
  # TELESCOPE FUNCTIONS (top window, w_ts)
403
421
  def w_ts_show
404
422
  @w_ts.setpos(0,0)
405
- heading = " TELESCOPES APP(mm) FL(mm) F/? <MAG xEYE MINx MAXx *FIELD GX/NEB PL/GCL PLd/2* TGHT2* DL-SEP RC-SEP MOON SUN"
423
+ heading = " TELESCOPES APP(mm) FL(mm) F/? <MAG xEYE MINx MAXx *FIELD GX/NEB PL/GCL PLd/2* TGHT2* DL-SEP RC-SEP MOON SUN"
406
424
  heading += " " * (@w_ts.maxx - heading.length).abs
407
425
  @w_ts.pa(255, 94, Curses::A_BOLD, heading)
408
426
  @w_ts.fg = 15
409
427
  @w_ts.bg = 0
410
428
  @ts.each_with_index do |scope, i|
411
- name = scope[0][0...15]
429
+ name = scope[0][0...18]
412
430
  d = scope[1]
413
431
  f = scope[2]
414
- out = " " + name.ljust(15)
432
+ out = " " + name.ljust(18)
415
433
  out += d.to_s.rjust(8)
416
434
  out += f.to_s.rjust(8)
417
435
  attr = Curses::A_BOLD
@@ -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)
@@ -461,7 +479,7 @@ end
461
479
  def w_ep_show
462
480
  @w_ep.setpos(0,0)
463
481
  scopes = 5
464
- heading = " ".rjust(32)
482
+ heading = " ".rjust(35)
465
483
  @w_ep.pa(231, 240, 0, heading)
466
484
  @ts.each do |scope|
467
485
  @w_ep.pa(231, 240, Curses::A_BOLD, "│ ")
@@ -470,17 +488,17 @@ def w_ep_show
470
488
  end
471
489
  heading = " " * (@w_ep.maxx - @w_ep.curx)
472
490
  @w_ep.p(heading)
473
- heading = " EYEPIECES FL(mm) AFOV "
491
+ heading = " EYEPIECES FL(mm) AFOV "
474
492
  heading += "│ xMAGN FOV(dms) XPUP " * @ts.length
475
493
  heading += " " * (@w_ep.maxx - heading.length).abs
476
494
  @w_ep.pa(231, 240, Curses::A_BOLD, heading)
477
495
  @w_ep.fg = 15
478
496
  @w_ep.bg = 0
479
497
  @ep.each_with_index do |ep, i|
480
- name = ep[0][0...15]
498
+ name = ep[0][0...18]
481
499
  m = ep[1].truncate(1)
482
500
  a = ep[2]
483
- out = " " + name.ljust(15)
501
+ out = " " + name.ljust(18)
484
502
  out += m.to_s.rjust(8)
485
503
  out += a.to_s.rjust(6) + "°"
486
504
  attr = Curses::A_BOLD
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.3
4
+ version: 0.6.1
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-11 00:00:00.000000000 Z
11
+ date: 2021-11-17 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.3:
36
- Improved navigation.'
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.1: Color
37
+ tweaks.'
37
38
  email: g@isene.com
38
39
  executables:
39
40
  - telescope