Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
If you have cyberware installed in your finger, I guess you could try plugging that in...
Or just keep hitting the enter button. Have fun with that.'''
loading_screen_effects = [
Materialize(screen, StaticRenderer([node]), 0, 0),
Materialize(screen, StaticRenderer([sync]), 0, 1, start_frame=10),
Materialize(screen, FigletText('Shadowlands', 'slant'), 0, 3, signal_acceleration_factor=1.1, start_frame=15),
Materialize(screen, StaticRenderer([pubterm]), 10, 10, signal_acceleration_factor=1.0005,start_frame=35),
LoadingScreenCursor(screen, StaticRenderer([prompt]), 0, 14, start_frame=75, speed=2, no_blink=False),
]
#UnicodeNoise( screen, BasicText(), stop_frame=300 ),
main_menu_effects2 = [
Materialize(screen, StaticRenderer([sync]), 0, 0),
CredstickMenu(screen, StaticRenderer([credstick_display]), 0, 2),
Materialize(screen, StaticRenderer([alttxdisplay]), 0 , 18),
#Materialize(screen, StaticRenderer([txdisplay]), screen.width // 2 - 4 , 13),
]
#Materialize(screen, StaticRenderer([dapp_menu]), 0, 7),
scenes = [
Scene(loading_screen_effects, -1, name="LoadingScreen"),
Scene(main_menu_effects2, -1, name="MainMenu"),
]
screen.play(scenes, stop_on_resize=True)
root_logger.setLevel(logging.DEBUG)
else:
root_logger.setLevel(logging.INFO)
# Tell GTK+ to use out translations
locale.bindtextdomain('gtimelog', LOCALE_DIR)
locale.textdomain('gtimelog')
# Tell Python's gettext.gettext() to use our translations
gettext.bindtextdomain('gtimelog', LOCALE_DIR)
gettext.textdomain('gtimelog')
# Make ^C terminate the process
signal.signal(signal.SIGINT, signal.SIG_DFL)
# Run the app
app = Application()
mark_time("app created")
sys.exit(app.run(sys.argv))
def __init__(self):
super(Application, self).__init__(
application_id='org.gtimelog',
flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE,
)
GLib.set_application_name(_("Time Log"))
GLib.set_prgname('gtimelog')
self.add_main_option_entries([
make_option("--version", description=_("Show version number and exit")),
make_option("--debug", description=_("Show debug information on the console")),
])
def do_startup(self):
mark_time("in app startup")
self.check_schema()
self.create_data_directory()
Gtk.Application.do_startup(self)
mark_time("basic app startup done")
builder = Gtk.Builder.new_from_file(MENUS_UI_FILE)
self.set_app_menu(builder.get_object('app_menu'))
mark_time("menus loaded")
self.actions = self.Actions(self)
if not hasattr(self, 'set_accels_for_action'):
self.set_accels_for_action = self.fallback_set_accels
self.set_accels_for_action("win.detail-level::chronological", ["1"])
self.set_accels_for_action("win.detail-level::grouped", ["2"])
self.set_accels_for_action("win.detail-level::summary", ["3"])
self.set_accels_for_action("win.time-range::day", ["4"])
self.set_accels_for_action("win.time-range::week", ["5"])
self.set_accels_for_action("win.time-range::month", ["6"])
self.set_accels_for_action("win.show-task-pane", ["F9"])
self.set_accels_for_action("win.show-menu", ["F10"])
self.set_accels_for_action("win.go-back", ["Left"])
self.set_accels_for_action("win.go-forward", ["Right"])
self.set_accels_for_action("win.go-home", ["Home"])
self.set_accels_for_action("app.edit-log", ["E"])
def do_activate(self):
mark_time("in app activate")
if self.get_active_window() is not None:
self.get_active_window().present()
return
window = Window(self)
mark_time("have window")
self.add_window(window)
mark_time("added window")
window.show()
mark_time("showed window")
GLib.idle_add(mark_time, "in main loop")
mark_time("app activate done")
self.bind_property('timelog', self.task_entry, 'timelog', GObject.BindingFlags.DEFAULT)
self.bind_property('timelog', self.log_view, 'timelog', GObject.BindingFlags.DEFAULT)
self.bind_property('showing_today', self.log_view, 'showing_today', GObject.BindingFlags.DEFAULT)
self.bind_property('date', self.log_view, 'date', GObject.BindingFlags.DEFAULT)
self.bind_property('detail_level', self.log_view, 'detail_level', GObject.BindingFlags.SYNC_CREATE)
self.bind_property('time_range', self.log_view, 'time_range', GObject.BindingFlags.SYNC_CREATE)
self.task_entry.bind_property('text', self.log_view, 'current_task', GObject.BindingFlags.DEFAULT)
self.bind_property('subtitle', self.headerbar, 'subtitle', GObject.BindingFlags.DEFAULT)
self.task_pane = builder.get_object("task_pane")
self.task_list = TaskList()
swap_widget(builder, 'task_list', self.task_list)
self.task_list.connect('row-activated', self.task_list_row_activated)
self.bind_property('tasks', self.task_list, 'tasks', GObject.BindingFlags.DEFAULT)
self.actions = self.Actions(self)
self.actions.add_entry.set_enabled(False)
self.actions.send_report.set_enabled(True)
# couldn't figure out how to set action targets in the .ui file
builder.get_object('daily_report_toggle').set_detailed_action_name('win.time-range::day')
builder.get_object('weekly_report_toggle').set_detailed_action_name('win.time-range::week')
builder.get_object('monthly_report_toggle').set_detailed_action_name('win.time-range::month')
self.report_view = ReportView()
swap_widget(builder, 'report_view', self.report_view)
self.bind_property('timelog', self.report_view, 'timelog', GObject.BindingFlags.DEFAULT)
self.bind_property('date', self.report_view, 'date', GObject.BindingFlags.DEFAULT)
self.bind_property('time_range', self.report_view, 'time_range', GObject.BindingFlags.SYNC_CREATE)
self.recipient_entry.bind_property('text', self.report_view, 'recipient', GObject.BindingFlags.SYNC_CREATE)
# Workaround for a GTK+ 3.10 bug (https://bugzilla.gnome.org/show_bug.cgi?id=705673)
def __init__(self, win):
# On Ubuntu 14.04 LTS we must use FakePropertyAction
# On Ubuntu 15.04 we can use Gio.PropertyAction
# But what's the actual difference -- PyGI version? GTK version?
# What test do I make to determine which one to use?
if gi.__version__ < '3.14':
PropertyAction = FakePropertyAction
else:
PropertyAction = Gio.PropertyAction
self.detail_level = PropertyAction.new("detail-level", win, "detail-level")
win.add_action(self.detail_level)
self.time_range = PropertyAction.new("time-range", win, "time-range")
win.add_action(self.time_range)
self.show_view_menu = PropertyAction.new("show-view-menu", win.view_button, "active")
win.add_action(self.show_view_menu)
self.show_task_pane = PropertyAction.new("show-task-pane", win.task_pane, "visible")
win.add_action(self.show_task_pane)
self.show_menu = PropertyAction.new("show-menu", win.menu_button, "active")
self.cancel_report_button = builder.get_object("cancel_report_button")
self.recipient_entry = builder.get_object("recipient_entry")
self.tasks_infobar = builder.get_object("tasks_infobar")
self.tasks_infobar.connect('response', lambda *args: self.tasks_infobar.hide())
self.tasks_infobar_label = builder.get_object("tasks_infobar_label")
self.infobar = builder.get_object("report_infobar")
self.infobar.connect('response', lambda *args: self.infobar.hide())
self.infobar_label = builder.get_object("infobar_label")
self.headerbar = builder.get_object('headerbar')
self.time_label = builder.get_object('time_label')
self.task_entry = TaskEntry()
swap_widget(builder, 'task_entry', self.task_entry)
self.task_entry.grab_focus() # I specified this in the .ui file but it gets ignored
self.add_button = builder.get_object('add_button')
self.add_button.grab_default() # I specified this in the .ui file but it gets ignored
self.log_view = LogView()
swap_widget(builder, 'log_view', self.log_view)
self.bind_property('timelog', self.task_entry, 'timelog', GObject.BindingFlags.DEFAULT)
self.bind_property('timelog', self.log_view, 'timelog', GObject.BindingFlags.DEFAULT)
self.bind_property('showing_today', self.log_view, 'showing_today', GObject.BindingFlags.DEFAULT)
self.bind_property('date', self.log_view, 'date', GObject.BindingFlags.DEFAULT)
self.bind_property('detail_level', self.log_view, 'detail_level', GObject.BindingFlags.SYNC_CREATE)
self.bind_property('time_range', self.log_view, 'time_range', GObject.BindingFlags.SYNC_CREATE)
self.task_entry.bind_property('text', self.log_view, 'current_task', GObject.BindingFlags.DEFAULT)
self.bind_property('subtitle', self.headerbar, 'subtitle', GObject.BindingFlags.DEFAULT)
self.task_pane = builder.get_object("task_pane")
self.task_list = TaskList()
swap_widget(builder, 'task_list', self.task_list)
self.task_list.connect('row-activated', self.task_list_row_activated)
self.bind_property('tasks', self.task_list, 'tasks', GObject.BindingFlags.DEFAULT)
def on_preferences(self, action, parameter):
preferences = PreferencesDialog(self.get_active_window())
preferences.connect("response", lambda *args: preferences.destroy())
preferences.run()
self.task_pane = builder.get_object("task_pane")
self.task_list = TaskList()
swap_widget(builder, 'task_list', self.task_list)
self.task_list.connect('row-activated', self.task_list_row_activated)
self.bind_property('tasks', self.task_list, 'tasks', GObject.BindingFlags.DEFAULT)
self.actions = self.Actions(self)
self.actions.add_entry.set_enabled(False)
self.actions.send_report.set_enabled(True)
# couldn't figure out how to set action targets in the .ui file
builder.get_object('daily_report_toggle').set_detailed_action_name('win.time-range::day')
builder.get_object('weekly_report_toggle').set_detailed_action_name('win.time-range::week')
builder.get_object('monthly_report_toggle').set_detailed_action_name('win.time-range::month')
self.report_view = ReportView()
swap_widget(builder, 'report_view', self.report_view)
self.bind_property('timelog', self.report_view, 'timelog', GObject.BindingFlags.DEFAULT)
self.bind_property('date', self.report_view, 'date', GObject.BindingFlags.DEFAULT)
self.bind_property('time_range', self.report_view, 'time_range', GObject.BindingFlags.SYNC_CREATE)
self.recipient_entry.bind_property('text', self.report_view, 'recipient', GObject.BindingFlags.SYNC_CREATE)
# Workaround for a GTK+ 3.10 bug (https://bugzilla.gnome.org/show_bug.cgi?id=705673)
builder.get_object('back_button').connect('button-press-event', self.disable_double_click)
builder.get_object('forward_button').connect('button-press-event', self.disable_double_click)
builder.get_object('today_button').connect('button-press-event', self.disable_double_click)
mark_time('window created')
self.load_settings()
self.date = None # initialize today's date