forked from mamolinux/battery-monitor
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix about window on indicator and refactor codes (mamolinux#51)
- Fix about window on settings page and indicator - Fix tab spacing - Move command line args to separate file to prepare for auto-generating manuals
- Loading branch information
Showing
5 changed files
with
123 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Copyright (C) 2021-2024 Himadri Sekhar Basu <[email protected]> | ||
# | ||
# This file is part of theme-manager. | ||
# | ||
# theme-manager is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# theme-manager is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with theme-manager. If not, see <http://www.gnu.org/licenses/> | ||
# or write to the Free Software Foundation, Inc., 51 Franklin Street, | ||
# Fifth Floor, Boston, MA 02110-1301, USA.. | ||
# | ||
# Author: Himadri Sekhar Basu <[email protected]> | ||
# | ||
import argparse | ||
import gettext | ||
import locale | ||
|
||
|
||
# i18n | ||
APP = 'battery-monitor' | ||
LOCALE_DIR = "/usr/share/locale" | ||
locale.bindtextdomain(APP, LOCALE_DIR) | ||
gettext.bindtextdomain(APP, LOCALE_DIR) | ||
gettext.textdomain(APP) | ||
_ = gettext.gettext | ||
|
||
description = _('A Python3-based GUI application to notify user about charging, discharging and not charging state of the laptop battery on Linux.') | ||
|
||
def command_line_args(): | ||
# Parse arguments | ||
parser = argparse.ArgumentParser(prog=APP, description=description, conflict_handler='resolve') | ||
|
||
parser.add_argument('-i', '--indicator', action='store_true', dest='start_indicator', default=False, help=_("Start Battery Monitor Indicator")) | ||
parser.add_argument('-t', '--test', action='store_true', dest='test_mode', default=False, help=_("Test Battery Monitor by running indicator")) | ||
parser.add_argument('-v', '--verbose', action='store_true', dest='show_debug', default=False, help=_("Print debug messages to stdout i.e. terminal")) | ||
parser.add_argument('-V', '--version', action='store_true', dest='show_version', default=False, help=_("Show version and exit")) | ||
|
||
return parser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,13 +19,13 @@ | |
# | ||
# Author: Himadri Sekhar Basu <[email protected]> | ||
# | ||
import argparse | ||
import gettext | ||
import locale | ||
import logging | ||
import sys | ||
|
||
from BatteryMonitor.config import APP, LOCALE_DIR, LOGFILE, __version__ | ||
from BatteryMonitor.cmd_lines import command_line_args | ||
from BatteryMonitor.indicator import BMIndicator | ||
from BatteryMonitor.gui import run_BMwindow | ||
|
||
|
@@ -36,22 +36,6 @@ | |
gettext.textdomain(APP) | ||
_ = gettext.gettext | ||
|
||
description = 'A Python3-based GUI application to change different colour variants of GTK, Icon, Cursor and other themes.' | ||
|
||
# Parse arguments | ||
parser = argparse.ArgumentParser(prog=APP, description=description, conflict_handler='resolve') | ||
|
||
parser.add_argument('-i', '--indicator', action='store_true', dest='start_indicator', default=False, help=("Start Battery Monitor Indicator")) | ||
parser.add_argument('-t', '--test', action='store_true', dest='test_mode', default=False, help=("Test Battery Monitor by running indicator")) | ||
parser.add_argument('-v', '--verbose', action='store_true', dest='show_debug', default=False, help=("Print debug messages to stdout i.e. terminal")) | ||
parser.add_argument('-V', '--version', action='store_true', dest='show_version', default=False, help=("Show version and exit")) | ||
|
||
args = parser.parse_args() | ||
|
||
if args.show_version: | ||
print("%s: version %s" % (APP, __version__)) | ||
sys.exit(0) | ||
|
||
# Create logger | ||
logger = logging.getLogger('BatteryMonitor') | ||
# Set logging level | ||
|
@@ -70,6 +54,16 @@ | |
# add the handler to the logger | ||
logger.addHandler(fHandler) | ||
|
||
# module logger | ||
module_logger = logging.getLogger('BatteryMonitor.main') | ||
|
||
parser = command_line_args() | ||
args = parser.parse_args() | ||
|
||
if args.show_version: | ||
print("%s: version %s" % (APP, __version__)) | ||
sys.exit(0) | ||
|
||
if args.show_debug: | ||
# be verbose only when "-v[erbose]" is supplied | ||
# Create StreamHandler which logs even debug messages | ||
|
@@ -88,10 +82,7 @@ | |
else: | ||
TEST_MODE = False | ||
|
||
# module logger | ||
module_logger = logging.getLogger('BatteryMonitor.main') | ||
|
||
def start_BM (): | ||
def start_BM(): | ||
if args.start_indicator: | ||
args.start_window = False | ||
# initiaing app indicator | ||
|