Dialogs updates (#252)
* Fix cursor on dialogs and make them fullscreen * Fix date alignment varying with text length
This commit is contained in:
parent
bf0f2d4342
commit
517a6afab8
@ -5,7 +5,7 @@ import os
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, Gdk, GdkPixbuf, Gio, GLib, Pango
|
||||
import os
|
||||
|
||||
klipperscreendir = os.getcwd()
|
||||
|
||||
class KlippyGtk:
|
||||
@ -15,9 +15,8 @@ class KlippyGtk:
|
||||
width_ratio = 16
|
||||
height_ratio = 9.375
|
||||
|
||||
def __init__(self, screen, width, height, theme):
|
||||
def __init__(self, screen, width, height, theme, cursor):
|
||||
self.screen = screen
|
||||
|
||||
self.width = width
|
||||
self.height = height
|
||||
self.theme = theme
|
||||
@ -31,6 +30,7 @@ class KlippyGtk:
|
||||
self.action_bar_width = int(self.width * .1)
|
||||
self.header_image_scale_width = 1.2
|
||||
self.header_image_scale_height = 1.4
|
||||
self.cursor = cursor
|
||||
|
||||
logging.debug("img width: %s height: %s" % (self.img_width, self.img_height))
|
||||
|
||||
@ -178,7 +178,7 @@ class KlippyGtk:
|
||||
|
||||
def Dialog(self, screen, buttons, content, callback=None, *args):
|
||||
dialog = Gtk.Dialog()
|
||||
dialog.set_default_size(screen.width - 15, screen.height - 15)
|
||||
dialog.set_default_size(screen.width, screen.height)
|
||||
dialog.set_resizable(False)
|
||||
dialog.set_transient_for(screen)
|
||||
dialog.set_modal(True)
|
||||
@ -201,6 +201,11 @@ class KlippyGtk:
|
||||
content_area.add(content)
|
||||
|
||||
dialog.show_all()
|
||||
# Change cursor to blank
|
||||
if self.cursor:
|
||||
dialog.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.ARROW))
|
||||
else:
|
||||
dialog.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.BLANK_CURSOR))
|
||||
|
||||
return dialog
|
||||
|
||||
|
@ -178,6 +178,7 @@ class SystemPanel(ScreenPanel):
|
||||
date = ndate
|
||||
label = Gtk.Label("")
|
||||
label.set_markup("<b>%s</b>\n" % date)
|
||||
label.set_halign(Gtk.Align.START)
|
||||
grid.attach(label, 0, i, 1, 1)
|
||||
i = i + 1
|
||||
|
||||
|
@ -119,7 +119,7 @@ class KlipperScreen(Gtk.Window):
|
||||
logging.info("Screen resolution: %sx%s" % (self.width, self.height))
|
||||
|
||||
self.theme = self._config.get_main_config_option('theme')
|
||||
self.gtk = KlippyGtk(self, self.width, self.height, self.theme)
|
||||
self.gtk = KlippyGtk(self, self.width, self.height, self.theme, self._config.get_main_config().getboolean("show_cursor", fallback=False))
|
||||
self.keyboard_height = self.gtk.get_keyboard_height()
|
||||
self.init_style()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user