telescope-term 0.5.4 → 0.6.2
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 +4 -4
- data/bin/telescope +55 -33
- metadata +6 -4
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 93f099da6e249cc7c3825842b465fe84053055db14341add65b1bcb4e216a215
         | 
| 4 | 
            +
              data.tar.gz: 275b32f847c3b89330501325d5da0bf91fb4d2c6568c64828001fed894f34a9e
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: d36c2596ec5ac74360a7a73338c022e7c6cc5f2a90a57dc8e688ef6533b94da1c30cfbb5eaaab58b2ce6f279941e314d9ae1a83c73604b227ae5407c62dcfdf9
         | 
| 7 | 
            +
              data.tar.gz: 4cecdf3bce9399c0831ea94b16da404ba6eff4125675d1cfc5084cc81e55042aca2d594251828e8251e5b9acf562c0254c260b70d928a4c43a0554551c61d45f
         | 
    
        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: 0.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  | 
| 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 ' | 
| 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( | 
| 446 | 
            +
                @w_ts.pa(157, 0, 0, out)    # MINx
         | 
| 429 447 | 
             
                out  = magx(d, f, 2)
         | 
| 430 | 
            -
                @w_ts.pa( | 
| 448 | 
            +
                @w_ts.pa(157, 0, 0, out)    # MAXx
         | 
| 431 449 | 
             
                out  = magx(d, f, 1/6.4)
         | 
| 432 | 
            -
                @w_ts.pa( | 
| 450 | 
            +
                @w_ts.pa(195, 0, 0, out)    # *FIELD
         | 
| 433 451 | 
             
                out  = magx(d, f, 1/3.6)
         | 
| 434 | 
            -
                @w_ts.pa( | 
| 452 | 
            +
                @w_ts.pa(195, 0, 0, out)    # GX/NEB
         | 
| 435 453 | 
             
                out  = magx(d, f, 1/2.1)
         | 
| 436 | 
            -
                @w_ts.pa( | 
| 454 | 
            +
                @w_ts.pa(195, 0, 0, out)    # PL/GCL
         | 
| 437 455 | 
             
                out  = magx(d, f, 1/1.3)
         | 
| 438 | 
            -
                @w_ts.pa( | 
| 456 | 
            +
                @w_ts.pa(195, 0, 0, out)    # PLd/2*
         | 
| 439 457 | 
             
                out  = magx(d, f, 1/0.7)
         | 
| 440 | 
            -
                @w_ts.pa( | 
| 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( | 
| 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, "│ ")
         | 
| @@ -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 | 
            -
                   | 
| 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. | 
| 4 | 
            +
              version: 0.6.2
         | 
| 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 | 
            +
            date: 2021-11-18 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: curses
         | 
| @@ -32,8 +32,10 @@ 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. | 
| 36 | 
            -
               | 
| 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.2: Made
         | 
| 37 | 
            +
              Telescope more responsive to terminal size changes and to die w/message of minimum
         | 
| 38 | 
            +
              140 char width.'
         | 
| 37 39 | 
             
            email: g@isene.com
         | 
| 38 40 | 
             
            executables:
         | 
| 39 41 | 
             
            - telescope
         |