telescope-term 0.5.5 → 0.6.0

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 +41 -23
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b4b0126ce3cf3b86c84f8f52e82e76c7e9c8e6d00c91d10d0814f817a6e38e4e
4
- data.tar.gz: ae64b594368f3934623f6805baf839d9c24649a6335167013fec173cb41aa781
3
+ metadata.gz: a1f96d4afdd39035d8aff14031e43034607bd6772e71b57b46a6aca7280e372d
4
+ data.tar.gz: 99560838dfcc2488495387672c46976a2a9131d9196aceaea2a4307b219dd01a
5
5
  SHA512:
6
- metadata.gz: 1d6ae5826300b3bd8489bbb339a4af342ee3c48815d491fe1134d334548a49bb8c23e377dd5b89dc25c376b448ad5d05e3da93021da63f69ccb5cf032bb043d1
7
- data.tar.gz: 11fb99f9393c15ffd4a1872a0b0a6454e0ea22120e353bd9bf4eed901699ef788d8939509a32cdd69962b5083cedd38cf015f4f78ea7371603f88a598625faff
6
+ metadata.gz: ab7ea6182535bdfd32f7ef8394630e1c3f17e73716d7ad175c19a7b05a75ea54f9cee7a45a9c69786d1f60d6a2acb55a16b18d97f660601bc2208762b0517286
7
+ data.tar.gz: 83587a7ec14ecf772f49542f2fb491ca3f86e87d1c86c1e5065ef4ed502816f0e09a0ac517778048ecff9e76d37a6ddc748c70fbbc215593445171c7521add29
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
metadata CHANGED
@@ -1,7 +1,7 @@
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.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene
@@ -32,8 +32,8 @@ 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'').'
37
37
  email: g@isene.com
38
38
  executables:
39
39
  - telescope