Abfragedialog J/N eingebaut. Für Rennabbruch Tracker.
This commit is contained in:
@@ -84,6 +84,7 @@ class Page():
|
||||
self.sym_lock = cairo.ImageSurface.create_from_png(os.path.join(cfg['imgpath'], "lock.png"))
|
||||
self.sym_swipe = cairo.ImageSurface.create_from_png(os.path.join(cfg['imgpath'], "swipe3.png"))
|
||||
self.sym_exclamation = cairo.ImageSurface.create_from_png(os.path.join(cfg['imgpath'], "exclamation.png"))
|
||||
self.sym_question = cairo.ImageSurface.create_from_png(os.path.join(cfg['imgpath'], "question.png"))
|
||||
self.buttonlabel = {
|
||||
1: '',
|
||||
2: '',
|
||||
@@ -229,6 +230,46 @@ class Page():
|
||||
ctx.show_text(text)
|
||||
ctx.stroke()
|
||||
|
||||
def draw_query(self, ctx, title, message):
|
||||
x, y, w, h = (50, 80, 300, 150)
|
||||
ctx.save()
|
||||
ctx.select_font_face("AtariST8x16SystemFont")
|
||||
ctx.set_font_size(16)
|
||||
# Dialogbox mit Rahmen
|
||||
ctx.set_line_width(1)
|
||||
ctx.set_source_rgb(*self.fgcolor)
|
||||
ctx.rectangle(x + 0.5, y + 0.5, w, h)
|
||||
ctx.stroke()
|
||||
ctx.set_source_rgb(*self.bgcolor)
|
||||
ctx.rectangle(x + 1, y + 1, w - 1, h - 1)
|
||||
ctx.fill()
|
||||
ctx.set_source_rgb(*self.fgcolor)
|
||||
ctx.set_line_width(2)
|
||||
ctx.rectangle(x + 3, y + 3, w - 5, h - 5)
|
||||
ctx.clip_preserve()
|
||||
ctx.stroke()
|
||||
# Symbol
|
||||
ctx.save()
|
||||
ctx.set_source_surface(self.sym_question, x + 16, y + 16)
|
||||
ctx.paint()
|
||||
ctx.restore()
|
||||
# Titel
|
||||
ctx.move_to(x + 64, y + 30)
|
||||
ctx.show_text(title)
|
||||
ctx.move_to(x + 64, y + 48)
|
||||
# Meldung, umgebrochen
|
||||
n = 0
|
||||
for l in wordwrap(message, (w - 16 - 8) / 8):
|
||||
ctx.move_to(x + 16, y + 70 + n)
|
||||
ctx.show_text(l)
|
||||
n += 16
|
||||
if n > 64:
|
||||
break
|
||||
# Auswahlmöglichkeiten
|
||||
self.draw_button(ctx, x + 16, y + h - 32, "YES")
|
||||
self.draw_button(ctx, x + w - 96, y + h - 32, "NO")
|
||||
ctx.restore()
|
||||
|
||||
def draw_alarm(self, ctx, source, alarmid, message):
|
||||
x, y, w, h = (50, 100, 300, 150)
|
||||
ctx.select_font_face("AtariST8x16SystemFont")
|
||||
@@ -360,6 +401,21 @@ class Page():
|
||||
ctx.stroke()
|
||||
ctx.restore()
|
||||
|
||||
def draw_button(self, ctx, x, y, label):
|
||||
ctx.save()
|
||||
ctx.select_font_face("AtariST8x16SystemFont")
|
||||
ctx.set_font_size(16)
|
||||
ctx.set_line_width(3)
|
||||
ctx.set_source_rgb(*self.fgcolor)
|
||||
ext = ctx.text_extents(label)
|
||||
w = max(ext.width, 80)
|
||||
h = 24
|
||||
ctx.rectangle(x + 0.5, y + 0.5, w, h)
|
||||
ctx.stroke()
|
||||
ctx.move_to(x + (w - ext.width) / 2.0, y + h - 5)
|
||||
ctx.show_text(label)
|
||||
ctx.restore()
|
||||
|
||||
def wordwrap(text, wrap):
|
||||
# Wrap long line to multiple lines, monospaced character set
|
||||
# e.g. used for alarm dialog boxes
|
||||
|
||||
Reference in New Issue
Block a user