astropanel 4.0.0 → 4.1.0
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/README.md +6 -0
- data/bin/astropanel +35 -49
- metadata +22 -8
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 6a158fe0fa70e2dfac28d4a6a2173f7004e5a380838110eacd0c6788070470ed
         | 
| 4 | 
            +
              data.tar.gz: e151830dfe26f406a7248597ebddccafb632ba6f8395f8157384a17545b32e13
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: d29cb83902e206efc8debf85825b7d9b44abcf9a757f792d0ea4ab49a5e37e4bf26162e510ad0aae26ac8188a35e4a4e85ec9355b66e7476c1925b6927229641
         | 
| 7 | 
            +
              data.tar.gz: 524612c6ca90cded7b63dacce28e0fbb8351cf511ce902b86b5ed2e914002ab849488bf93ed44a0bd59cb7fc4e281a8de4042d7be245c722aa877317c024e993
         | 
    
        data/README.md
    CHANGED
    
    | @@ -1,5 +1,11 @@ | |
| 1 1 | 
             
            # Astropanel
         | 
| 2 2 |  | 
| 3 | 
            +
            [](https://badge.fury.io/rb/astropanel)
         | 
| 4 | 
            +
            [](https://www.ruby-lang.org/)
         | 
| 5 | 
            +
            [](https://unlicense.org/)
         | 
| 6 | 
            +
            [](https://github.com/isene/astropanel/stargazers)
         | 
| 7 | 
            +
            [](https://isene.org)
         | 
| 8 | 
            +
             | 
| 3 9 | 
             
            <img src="logo.jpg" align="left" width="150" height="150">Terminal program for
         | 
| 4 10 | 
             
            amateur astronomers with weather forecast, ephemeris, astronomical events and
         | 
| 5 11 | 
             
            more. It's what you need to decide wether to take your telescope out for a
         | 
    
        data/bin/astropanel
    CHANGED
    
    | @@ -14,7 +14,7 @@ | |
| 14 14 | 
             
            #             for any damages resulting from its use. Further, I am under no
         | 
| 15 15 | 
             
            #             obligation to maintain or extend this software. It is provided 
         | 
| 16 16 | 
             
            #             on an 'as is' basis without any expressed or implied warranty.
         | 
| 17 | 
            -
            # Version:    4. | 
| 17 | 
            +
            # Version:    4.1.0: Modern image display using termpix gem
         | 
| 18 18 | 
             
            #             for Ruby 3.4+ compatibility
         | 
| 19 19 |  | 
| 20 20 | 
             
            # LOAD MODULES {{{1
         | 
| @@ -27,6 +27,7 @@ require 'json' | |
| 27 27 | 
             
            require 'date'
         | 
| 28 28 | 
             
            require 'time'
         | 
| 29 29 | 
             
            require 'rcurses'
         | 
| 30 | 
            +
            require 'termpix'
         | 
| 30 31 | 
             
            include Rcurses
         | 
| 31 32 | 
             
            include Rcurses::Input
         | 
| 32 33 | 
             
            include Rcurses::Cursor
         | 
| @@ -613,34 +614,34 @@ class AstroPanelApp | |
| 613 614 | 
             
              end
         | 
| 614 615 |  | 
| 615 616 | 
             
              def setup_image_display # {{{2
         | 
| 616 | 
            -
                 | 
| 617 | 
            -
                @ | 
| 618 | 
            -
                @showimage     = File.executable?(@w3mimgdisplay)
         | 
| 617 | 
            +
                @termpix = Termpix::Display.new
         | 
| 618 | 
            +
                @showimage = @termpix.supported?
         | 
| 619 619 | 
             
                @current_image = nil
         | 
| 620 620 | 
             
              end
         | 
| 621 621 |  | 
| 622 622 | 
             
              def check_image_redraw # {{{2
         | 
| 623 623 | 
             
                # Only check if image display is enabled
         | 
| 624 624 | 
             
                return unless @showimage
         | 
| 625 | 
            -
             | 
| 625 | 
            +
             | 
| 626 626 | 
             
                # Only check if we have an image currently displayed
         | 
| 627 627 | 
             
                return unless @current_image && File.exist?(@current_image)
         | 
| 628 | 
            -
             | 
| 628 | 
            +
             | 
| 629 629 | 
             
                begin
         | 
| 630 | 
            -
                  #  | 
| 631 | 
            -
                   | 
| 632 | 
            -
             | 
| 633 | 
            -
             | 
| 634 | 
            -
             | 
| 635 | 
            -
             | 
| 636 | 
            -
             | 
| 637 | 
            -
             | 
| 638 | 
            -
             | 
| 639 | 
            -
             | 
| 640 | 
            -
                     | 
| 630 | 
            +
                  # For w3m protocol, check if image overlay was cleared
         | 
| 631 | 
            +
                  if @termpix.protocol == :w3m
         | 
| 632 | 
            +
                    active_window = `xdotool getactivewindow 2>/dev/null`.chomp
         | 
| 633 | 
            +
                    return if active_window.empty?
         | 
| 634 | 
            +
             | 
| 635 | 
            +
                    current_window = `xdotool getwindowfocus 2>/dev/null`.chomp
         | 
| 636 | 
            +
             | 
| 637 | 
            +
                    # Only redraw if we detect a focus change
         | 
| 638 | 
            +
                    if @last_active_window && @last_active_window != active_window && current_window == active_window
         | 
| 639 | 
            +
                      show_image(@current_image)
         | 
| 640 | 
            +
                    end
         | 
| 641 | 
            +
             | 
| 642 | 
            +
                    @last_active_window = active_window
         | 
| 641 643 | 
             
                  end
         | 
| 642 | 
            -
                  
         | 
| 643 | 
            -
                  @last_active_window = active_window
         | 
| 644 | 
            +
                  # Sixel images persist, no redraw needed
         | 
| 644 645 | 
             
                rescue
         | 
| 645 646 | 
             
                  # Silently fail - we don't want focus checking to break anything
         | 
| 646 647 | 
             
                end
         | 
| @@ -650,47 +651,32 @@ class AstroPanelApp | |
| 650 651 | 
             
                return unless @showimage
         | 
| 651 652 |  | 
| 652 653 | 
             
                begin
         | 
| 653 | 
            -
                  # if anything in here takes longer than 2s, we skip it
         | 
| 654 654 | 
             
                  Timeout.timeout(2) do
         | 
| 655 | 
            -
                    # grab window pixel dimensions
         | 
| 656 | 
            -
                    info = `xwininfo -id $(xdotool getactivewindow) 2>/dev/null`
         | 
| 657 | 
            -
                    return unless info =~ /Width:\s*(\d+).*Height:\s*(\d+)/m
         | 
| 658 | 
            -
                    term_w, term_h = $1.to_i, $2.to_i
         | 
| 659 | 
            -
             | 
| 660 | 
            -
                    # compute character‐cell size
         | 
| 661 655 | 
             
                    rows, cols = IO.console.winsize
         | 
| 662 | 
            -
                    cw = term_w.to_f / cols
         | 
| 663 | 
            -
                    ch = term_h.to_f / rows
         | 
| 664 656 |  | 
| 665 | 
            -
                    #  | 
| 666 | 
            -
                     | 
| 667 | 
            -
             | 
| 657 | 
            +
                    # Always clear previous image first to prevent overlapping
         | 
| 658 | 
            +
                    @termpix.clear(
         | 
| 659 | 
            +
                      x: @main.x - 1,
         | 
| 660 | 
            +
                      y: 24,
         | 
| 661 | 
            +
                      width: @main.w,
         | 
| 662 | 
            +
                      height: rows - 26,
         | 
| 663 | 
            +
                      term_width: cols,
         | 
| 664 | 
            +
                      term_height: rows)
         | 
| 668 665 |  | 
| 669 666 | 
             
                    if file && File.exist?(file) && File.size(file) > 0
         | 
| 670 | 
            -
                      #  | 
| 671 | 
            -
                       | 
| 672 | 
            -
             | 
| 673 | 
            -
             | 
| 674 | 
            -
             | 
| 675 | 
            -
                         | 
| 676 | 
            -
                      end
         | 
| 677 | 
            -
                      if ih > max_h
         | 
| 678 | 
            -
                        iw = iw * max_h / ih; ih = max_h
         | 
| 679 | 
            -
                      end
         | 
| 680 | 
            -
             | 
| 681 | 
            -
                      # Clear image area
         | 
| 682 | 
            -
                      `echo "6;#{px};#{py};#{max_w};#{max_h};\n4;\n3;" | #{@w3mimgdisplay} 2>/dev/null`
         | 
| 683 | 
            -
                      `echo "0;1;#{px};#{py};#{iw};#{ih};;;;;\"#{file}\"\n4;\n3;" | #{@w3mimgdisplay} 2>/dev/null`
         | 
| 684 | 
            -
                      
         | 
| 685 | 
            -
                      # Track the current image
         | 
| 667 | 
            +
                      # Display new image using termpix (same positioning as original)
         | 
| 668 | 
            +
                      @termpix.show(file,
         | 
| 669 | 
            +
                        x: @main.x - 1,
         | 
| 670 | 
            +
                        y: 24,
         | 
| 671 | 
            +
                        max_width: @main.w - 3,
         | 
| 672 | 
            +
                        max_height: rows - 26)
         | 
| 686 673 | 
             
                      @current_image = file
         | 
| 687 674 | 
             
                    else
         | 
| 688 | 
            -
                      # Clear image if no file or file doesn't exist
         | 
| 689 675 | 
             
                      @current_image = nil
         | 
| 690 676 | 
             
                    end
         | 
| 691 677 | 
             
                  end
         | 
| 692 678 | 
             
                rescue Timeout::Error
         | 
| 693 | 
            -
                  # silently skip if  | 
| 679 | 
            +
                  # silently skip if image display hangs
         | 
| 694 680 | 
             
                end
         | 
| 695 681 | 
             
              end
         | 
| 696 682 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: astropanel
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 4. | 
| 4 | 
            +
              version: 4.1.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Geir Isene
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2025- | 
| 11 | 
            +
            date: 2025-10-27 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rcurses
         | 
| @@ -24,12 +24,26 @@ dependencies: | |
| 24 24 | 
             
                - - "~>"
         | 
| 25 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 26 | 
             
                    version: '6.0'
         | 
| 27 | 
            -
             | 
| 28 | 
            -
               | 
| 29 | 
            -
               | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 27 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 28 | 
            +
              name: termpix
         | 
| 29 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 | 
            +
                requirements:
         | 
| 31 | 
            +
                - - "~>"
         | 
| 32 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            +
                    version: '0.1'
         | 
| 34 | 
            +
              type: :runtime
         | 
| 35 | 
            +
              prerelease: false
         | 
| 36 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 | 
            +
                requirements:
         | 
| 38 | 
            +
                - - "~>"
         | 
| 39 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            +
                    version: '0.1'
         | 
| 41 | 
            +
            description: 'AstroPanel v4.1.0: Modern image display using termpix gem with Sixel
         | 
| 42 | 
            +
              and w3m protocol support. This program shows essential data in order to plan your
         | 
| 43 | 
            +
              observations: 9 days weather forecast, full ephemeris for the Sun, the Moon and
         | 
| 44 | 
            +
              all major planets, complete with graphic representation of rise/set times, detailed
         | 
| 45 | 
            +
              info for each day with important astronomical events, star chart displayed in the
         | 
| 46 | 
            +
              terminal and more.'
         | 
| 33 47 | 
             
            email: g@isene.com
         | 
| 34 48 | 
             
            executables:
         | 
| 35 49 | 
             
            - astropanel
         |