2021-05-01 16:48:32 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
import gi
|
|
|
|
gi.require_version('Gtk', '3.0')
|
|
|
|
from gi.repository import Gtk, GLib
|
|
|
|
|
|
|
|
class PromptWindow(Gtk.Window):
|
|
|
|
|
|
|
|
def __init__(self, task=None):
|
|
|
|
|
|
|
|
if task is None:
|
|
|
|
task = ""
|
|
|
|
|
|
|
|
Gtk.Window.__init__(self, title="Pomodoro Prompt")
|
2021-05-01 17:13:12 +00:00
|
|
|
self.set_size_request(500, 100)
|
|
|
|
self.set_border_width(10)
|
2021-05-01 16:48:32 +00:00
|
|
|
|
|
|
|
self.entry = Gtk.Entry()
|
|
|
|
self.entry.set_text(task)
|
|
|
|
|
2021-05-01 17:13:12 +00:00
|
|
|
self.entry.connect("activate", self.save)
|
2021-05-01 16:48:32 +00:00
|
|
|
|
2021-05-01 17:13:12 +00:00
|
|
|
self.add(self.entry)
|
2021-05-01 16:48:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
# self.set_title("Entry")
|
|
|
|
self.connect("destroy", Gtk.main_quit)
|
|
|
|
|
2021-05-01 17:13:12 +00:00
|
|
|
def save(self, entry):
|
|
|
|
task = entry.get_text()
|
|
|
|
print(task)
|
|
|
|
# A little concerned this might be sort of the nuclear option here.
|
|
|
|
Gtk.main_quit()
|
2021-05-01 16:48:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
win = PromptWindow(task="Making money")
|
|
|
|
win.show_all()
|
|
|
|
Gtk.main()
|