|
6 | 6 | __author__ = 'Simon Robinson' |
7 | 7 | __copyright__ = 'Copyright (c) 2022 Simon Robinson' |
8 | 8 | __license__ = 'Apache 2.0' |
9 | | -__version__ = '2023-03-27' # ISO 8601 (YYYY-MM-DD) |
| 9 | +__version__ = '2023-03-28' # ISO 8601 (YYYY-MM-DD) |
10 | 10 |
|
11 | 11 | import abc |
12 | 12 | import argparse |
@@ -212,7 +212,8 @@ def initialise(log_file=None): |
212 | 212 | Log._LOGGER = logging.getLogger(APP_NAME) |
213 | 213 | if log_file or sys.platform == 'win32': |
214 | 214 | handler = logging.handlers.RotatingFileHandler( |
215 | | - log_file or '%s/%s.log' % (os.path.dirname(os.path.realpath(__file__)), APP_SHORT_NAME), |
| 215 | + log_file or '%s/%s.log' % (os.path.dirname(sys.executable if getattr(sys, 'frozen', False) else |
| 216 | + os.path.realpath(__file__)), APP_SHORT_NAME), |
216 | 217 | maxBytes=LOG_FILE_MAX_SIZE, backupCount=LOG_FILE_MAX_BACKUPS) |
217 | 218 | handler.setFormatter(logging.Formatter('%(asctime)s: %(message)s')) |
218 | 219 | elif sys.platform == 'darwin': |
@@ -2313,10 +2314,8 @@ def get_icon_size(text, font_size): |
2313 | 2314 | def create_config_menu(self): |
2314 | 2315 | items = [] |
2315 | 2316 | if len(self.proxies) <= 0: |
2316 | | - # note that we don't actually allow no servers when loading config, but just in case that behaviour changes |
2317 | | - items.append(pystray.MenuItem('Servers:', None, enabled=False)) |
2318 | | - items.append(pystray.MenuItem(' No servers configured', None, enabled=False)) |
2319 | | - items.append(pystray.Menu.SEPARATOR) |
| 2317 | + # note that we don't actually allow no servers when loading the config, so no need to generate a menu |
| 2318 | + return items # (avoids creating and then immediately regenerating the menu when servers are loaded) |
2320 | 2319 | else: |
2321 | 2320 | for server_type in ['IMAP', 'POP', 'SMTP']: |
2322 | 2321 | items.extend(App.get_config_menu_servers(self.proxies, server_type)) |
|
0 commit comments