mirror of
https://github.com/LorenEteval/Furious.git
synced 2026-10-07 06:18:05 +03:00
Feature: Added clear command to clear settings
Signed-off-by: LorenEteval <loren.eteval@proton.me>
This commit is contained in:
committed by
Loren Eteval
parent
5125dac85c
commit
e1762b7456
@@ -29,6 +29,7 @@ __all__ = [
|
||||
class AppBuiltinCommand(Enum):
|
||||
Empty = 'empty'
|
||||
RunAs = 'runas'
|
||||
Clear = 'clear'
|
||||
|
||||
|
||||
class AppBuiltinRouting(Enum):
|
||||
|
||||
+20
-1
@@ -38,6 +38,22 @@ __all__ = ['main']
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def runClearSettings():
|
||||
app = QtCore.QCoreApplication(sys.argv)
|
||||
app.setApplicationName(APPLICATION_NAME)
|
||||
app.setApplicationVersion(APPLICATION_VERSION)
|
||||
app.setOrganizationName(ORGANIZATION_NAME)
|
||||
app.setOrganizationDomain(ORGANIZATION_DOMAIN)
|
||||
|
||||
settings = QtCore.QSettings()
|
||||
settings.clear()
|
||||
settings.sync()
|
||||
|
||||
logger.info('application settings have been cleared')
|
||||
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
def runAppMain():
|
||||
process = AppMainProcess(functools.partial(Application, sys.argv))
|
||||
|
||||
@@ -142,7 +158,10 @@ def runAppMain():
|
||||
|
||||
def main():
|
||||
try:
|
||||
runAppMain()
|
||||
if len(sys.argv) > 1 and sys.argv[1] == AppBuiltinCommand.Clear.value:
|
||||
runClearSettings()
|
||||
else:
|
||||
runAppMain()
|
||||
except Exception:
|
||||
# Any non-exit exceptions
|
||||
|
||||
|
||||
Reference in New Issue
Block a user