Better styling for terminal
This commit is contained in:
		
							parent
							
								
									f03c01b6a6
								
							
						
					
					
						commit
						66a9627b29
					
				@ -6,7 +6,7 @@ Handles the terminal widget
 | 
				
			|||||||
import gi
 | 
					import gi
 | 
				
			||||||
gi.require_version('Gtk', '4.0')
 | 
					gi.require_version('Gtk', '4.0')
 | 
				
			||||||
gi.require_version('Vte', '3.91')
 | 
					gi.require_version('Vte', '3.91')
 | 
				
			||||||
from gi.repository import Gtk, Vte, GLib, Pango
 | 
					from gi.repository import Gtk, Vte, GLib, Pango, GLib
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class terminal(Vte.Terminal):
 | 
					class terminal(Vte.Terminal):
 | 
				
			||||||
    __gtype_name__ = 'AlpacaTerminal'
 | 
					    __gtype_name__ = 'AlpacaTerminal'
 | 
				
			||||||
@ -14,7 +14,7 @@ class terminal(Vte.Terminal):
 | 
				
			|||||||
    def __init__(self, script:list):
 | 
					    def __init__(self, script:list):
 | 
				
			||||||
        super().__init__(css_classes=["terminal"])
 | 
					        super().__init__(css_classes=["terminal"])
 | 
				
			||||||
        self.set_font(Pango.FontDescription.from_string("Monospace 12"))
 | 
					        self.set_font(Pango.FontDescription.from_string("Monospace 12"))
 | 
				
			||||||
 | 
					        self.set_clear_background(False)
 | 
				
			||||||
        pty = Vte.Pty.new_sync(Vte.PtyFlags.DEFAULT, None)
 | 
					        pty = Vte.Pty.new_sync(Vte.PtyFlags.DEFAULT, None)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.set_pty(pty)
 | 
					        self.set_pty(pty)
 | 
				
			||||||
 | 
				
			|||||||
@ -428,9 +428,9 @@ def run_script_response(self, dialog, task, script, language_name):
 | 
				
			|||||||
            with open(os.path.join(cache_dir, 'temp_python_script.py'), 'w') as f:
 | 
					            with open(os.path.join(cache_dir, 'temp_python_script.py'), 'w') as f:
 | 
				
			||||||
                f.write(script)
 | 
					                f.write(script)
 | 
				
			||||||
            script = 'python3 {}'.format(os.path.join(cache_dir, 'temp_python_script.py'))
 | 
					            script = 'python3 {}'.format(os.path.join(cache_dir, 'temp_python_script.py'))
 | 
				
			||||||
        script += '; echo "\n(Alpaca) {}"'.format(_('Script exited'))
 | 
					        script += '; echo "\n🦙 {}"'.format(_('Script exited'))
 | 
				
			||||||
        if shutil.which('flatpak-spawn'):
 | 
					        if shutil.which('flatpak-spawn'):
 | 
				
			||||||
            script = 'echo "{}\n";'.format(_('The script is contained inside Flatpak')) + script
 | 
					            script = 'echo "🦙 {}\n";'.format(_('The script is contained inside Flatpak')) + script
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.run_terminal(['bash', '-c', script])
 | 
					        self.run_terminal(['bash', '-c', script])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -486,15 +486,14 @@
 | 
				
			|||||||
      <property name="height-request">600</property>
 | 
					      <property name="height-request">600</property>
 | 
				
			||||||
      <child>
 | 
					      <child>
 | 
				
			||||||
        <object class="AdwToolbarView">
 | 
					        <object class="AdwToolbarView">
 | 
				
			||||||
 | 
					          <style>
 | 
				
			||||||
 | 
					            <class name="osd"/>
 | 
				
			||||||
 | 
					          </style>
 | 
				
			||||||
          <child type="top">
 | 
					          <child type="top">
 | 
				
			||||||
            <object class="AdwHeaderBar">
 | 
					            <object class="AdwHeaderBar"/>
 | 
				
			||||||
              <style>
 | 
					 | 
				
			||||||
                <class name="osd"/>
 | 
					 | 
				
			||||||
              </style>
 | 
					 | 
				
			||||||
            </object>
 | 
					 | 
				
			||||||
          </child>
 | 
					          </child>
 | 
				
			||||||
          <property name="content">
 | 
					          <property name="content">
 | 
				
			||||||
            <object class="GtkScrolledWindow" id="terminal_scroller"></object>
 | 
					            <object class="GtkScrolledWindow" id="terminal_scroller"/>
 | 
				
			||||||
          </property>
 | 
					          </property>
 | 
				
			||||||
        </object>
 | 
					        </object>
 | 
				
			||||||
      </child>
 | 
					      </child>
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user