kopia lustrzana https://github.com/ctjacobs/pyqso
Style improvements.
rodzic
8f7975c30f
commit
7ce255ca55
|
@ -2,3 +2,4 @@
|
||||||
pyqso.debug
|
pyqso.debug
|
||||||
build/
|
build/
|
||||||
docs/build
|
docs/build
|
||||||
|
.DS_Store
|
||||||
|
|
22
bin/pyqso
22
bin/pyqso
|
@ -103,31 +103,29 @@ class PyQSO:
|
||||||
# Show the main window.
|
# Show the main window.
|
||||||
self.window.show_all()
|
self.window.show_all()
|
||||||
|
|
||||||
if(have_config):
|
if have_config:
|
||||||
if(not config.getboolean("general", "show_toolbox")):
|
if not config.getboolean("general", "show_toolbox"):
|
||||||
self.toolbox.toggle_visible_callback()
|
self.toolbox.toggle_visible_callback()
|
||||||
else:
|
else:
|
||||||
# Hide the Toolbox by default.
|
# Hide the Toolbox by default.
|
||||||
self.toolbox.toggle_visible_callback()
|
self.toolbox.toggle_visible_callback()
|
||||||
|
|
||||||
if(logbook_path):
|
if logbook_path:
|
||||||
logging.info("Opening logbook: %s" % logbook_path)
|
logging.info("Opening logbook: %s" % logbook_path)
|
||||||
self.logbook.open(path=logbook_path)
|
self.logbook.open(path=logbook_path)
|
||||||
else:
|
else:
|
||||||
# If no logbook path is specified at the command line,
|
# If no logbook path is specified at the command line,
|
||||||
# then check if the user wants to open a default logbook.
|
# then check if the user wants to open a default logbook.
|
||||||
(section, option) = ("general", "default_logbook")
|
(section, option) = ("general", "default_logbook")
|
||||||
if(have_config and config.has_option(section, option)):
|
if have_config and config.has_option(section, option):
|
||||||
open_default_logbook = config.getboolean(section, option)
|
open_default_logbook = config.getboolean(section, option)
|
||||||
(section, option) = ("general", "default_logbook_path")
|
(section, option) = ("general", "default_logbook_path")
|
||||||
if(open_default_logbook and config.has_option(section, option)):
|
if open_default_logbook and config.has_option(section, option):
|
||||||
logbook_path = config.get(section, option)
|
logbook_path = config.get(section, option)
|
||||||
if(logbook_path is not None and logbook_path != ""):
|
if logbook_path:
|
||||||
logging.info("Opening the default logbook: %s" % logbook_path)
|
logging.info("Opening the default logbook: %s" % logbook_path)
|
||||||
self.logbook.open(path=logbook_path)
|
self.logbook.open(path=logbook_path)
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
def show_about(self, widget):
|
def show_about(self, widget):
|
||||||
""" Show the About dialog, which includes license information. """
|
""" Show the About dialog, which includes license information. """
|
||||||
glade_file_path = importlib.resources.files("pyqso").joinpath("res", "pyqso.glade")
|
glade_file_path = importlib.resources.files("pyqso").joinpath("res", "pyqso.glade")
|
||||||
|
@ -136,16 +134,14 @@ class PyQSO:
|
||||||
about = self.builder.get_object("about_dialog")
|
about = self.builder.get_object("about_dialog")
|
||||||
about.run()
|
about.run()
|
||||||
about.destroy()
|
about.destroy()
|
||||||
return
|
|
||||||
|
|
||||||
def show_preferences(self, widget):
|
def show_preferences(self, widget):
|
||||||
""" Show the Preferences dialog. Any changes made by the user after clicking the 'Ok' button are saved in the configuration file. """
|
""" Show the Preferences dialog. Any changes made by the user after clicking the 'Ok' button are saved in the configuration file. """
|
||||||
preferences = PreferencesDialog(self)
|
preferences = PreferencesDialog(self)
|
||||||
response = preferences.dialog.run()
|
response = preferences.dialog.run()
|
||||||
if(response == Gtk.ResponseType.OK):
|
if response == Gtk.ResponseType.OK:
|
||||||
preferences.commit()
|
preferences.commit()
|
||||||
preferences.dialog.destroy()
|
preferences.dialog.destroy()
|
||||||
return
|
|
||||||
|
|
||||||
if(__name__ == "__main__"):
|
if(__name__ == "__main__"):
|
||||||
# Get any command line arguments.
|
# Get any command line arguments.
|
||||||
|
@ -155,7 +151,7 @@ if(__name__ == "__main__"):
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Output debugging messages to a file.
|
# Output debugging messages to a file.
|
||||||
if(args.debug):
|
if args.debug:
|
||||||
# Get the root logger.
|
# Get the root logger.
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
logger.setLevel(logging.DEBUG)
|
logger.setLevel(logging.DEBUG)
|
||||||
|
@ -166,7 +162,7 @@ if(__name__ == "__main__"):
|
||||||
logger.addHandler(handler)
|
logger.addHandler(handler)
|
||||||
|
|
||||||
# Enforce an absolute logbook file path.
|
# Enforce an absolute logbook file path.
|
||||||
if(args.logbook):
|
if args.logbook:
|
||||||
args.logbook = os.path.abspath(args.logbook)
|
args.logbook = os.path.abspath(args.logbook)
|
||||||
|
|
||||||
signal.signal(signal.SIGINT, signal.SIG_DFL) # Exit PyQSO if a SIGINT signal is captured.
|
signal.signal(signal.SIGINT, signal.SIG_DFL) # Exit PyQSO if a SIGINT signal is captured.
|
||||||
|
|
Ładowanie…
Reference in New Issue