bit-team / backintime

Back In Time - An easy-to-use backup tool for GNU/Linux using rsync in the back
https://backintime.readthedocs.io
GNU General Public License v2.0
2.09k stars 204 forks source link

systrayicon: Use --debug #1793

Open buhtz opened 4 months ago

buhtz commented 4 months ago

I am not into qtsystrayicon.py so much. So I leave it to you Jürgen.

To my current observation the qtsystrayicon.py is not called with --debug if BIT is in debug mode. This should be changed.

But before that there is another problem. The first argument to qtsystrayicon.py is interpreted as the profile id. So if you call qtsystrayicon.py --debug the "--debug" is the profile id and will fail of course. One solution would be to remove the argument like this:

if __name__ == '__main__':

    logger.openlog()

    if "--debug" in sys.argv:  # HACK: Minimal arg parsing to enable debug-level logging
        logger.DEBUG = True
        sys.argv.remove('--debug')

Or to modify QtSysTrayIcon.__init()__ where you can find such a section:

        if len(sys.argv) > 1:
            if not self.config.setCurrentProfile(sys.argv[1]):
                logger.warning("Failed to change Profile_ID %s"
                               %sys.argv[1], self)

Not sure if the systrayicon will need to interpret more arguments then the profileid and --debug? Maybe just check all arguments if one of them is a number and use this?

My observation is based on research in relation to #1785