📚 docs(main): documentation add

This commit is contained in:
Eshan Roy
2024-06-03 14:29:45 +05:30
committed by GitHub
parent 5ca076164a
commit 547c4b67d3

View File

@@ -82,13 +82,16 @@ def signal_handler(sig, frame):
if __name__ == "__main__": if __name__ == "__main__":
try: try:
# signal.signal(signal.SIGINT, signal_handler) # signal.signal(signal.SIGINT, signal_handler)
# checks if a file specified by the variable lock_file exists
if not fn.os.path.isfile(lock_file): if not fn.os.path.isfile(lock_file):
# opens a file specified by the variable pid_file in write mode and writes the current process ID (os.getpid()) into it
with open(pid_file, "w") as f: with open(pid_file, "w") as f:
f.write(str(fn.os.getpid())) f.write(str(fn.os.getpid()))
# splash = SplashScreen() # splash = SplashScreen()
app = Main() app = Main()
app.run(None) app.run(None)
else: else:
# creates an instance of Gtk.MessageDialog, a dialog box for displaying messages to the user
md = Gtk.MessageDialog( md = Gtk.MessageDialog(
parent=Main(), parent=Main(),
flags=0, flags=0,
@@ -96,6 +99,7 @@ if __name__ == "__main__":
buttons=Gtk.ButtonsType.YES_NO, buttons=Gtk.ButtonsType.YES_NO,
text="%s Lock File Found" % app_name, text="%s Lock File Found" % app_name,
) )
# set additional formatted text in the dialog
md.format_secondary_markup( md.format_secondary_markup(
"A %s lock file has been found. This indicates there is already an instance of <b>%s</b> running.\n\ "A %s lock file has been found. This indicates there is already an instance of <b>%s</b> running.\n\
Click 'Yes' to remove the lock file and try running again" Click 'Yes' to remove the lock file and try running again"
@@ -103,6 +107,7 @@ if __name__ == "__main__":
) # noqa ) # noqa
result = md.run() result = md.run()
# destroyed after the user interacts with it
md.destroy() md.destroy()
if result in (Gtk.ResponseType.OK, Gtk.ResponseType.YES): if result in (Gtk.ResponseType.OK, Gtk.ResponseType.YES):