|
27 | 27 | # noinspection PyAttributeOutsideInit |
28 | 28 | class Nse: |
29 | 29 | version: str = '5.2' |
30 | | - beta: Tuple[bool, int] = (True, 10) |
| 30 | + beta: Tuple[bool, int] = (True, 11) |
31 | 31 |
|
32 | 32 | def __init__(self, window: Tk) -> None: |
33 | 33 | self.intervals: List[int] = [1, 2, 3, 5, 10, 15] |
@@ -114,17 +114,36 @@ def get_icon(self) -> None: |
114 | 114 | self.load_nse_icon = True |
115 | 115 | except AttributeError: |
116 | 116 | if self.load_nse_icon: |
117 | | - icon_png_raw: requests.Response = requests.get(self.url_icon_png, headers=self.headers, stream=True) |
118 | | - with open('.NSE-OCA.png', 'wb') as f: |
119 | | - for chunk in icon_png_raw.iter_content(1024): |
120 | | - f.write(chunk) |
121 | | - self.icon_png_path = '.NSE-OCA.png' |
122 | | - if is_windows_10: |
123 | | - icon_ico_raw: requests.Response = requests.get(self.url_icon_ico, headers=self.headers, stream=True) |
124 | | - with open('.NSE-OCA.ico', 'wb') as f: |
125 | | - for chunk in icon_ico_raw.iter_content(1024): |
| 117 | + try: |
| 118 | + icon_png_raw: Optional[requests.Response] = requests.get(self.url_icon_png, headers=self.headers, |
| 119 | + stream=True) |
| 120 | + if icon_png_raw is None: |
| 121 | + self.load_nse_icon = False |
| 122 | + return |
| 123 | + with open('.NSE-OCA.png', 'wb') as f: |
| 124 | + for chunk in icon_png_raw.iter_content(1024): |
126 | 125 | f.write(chunk) |
127 | | - self.icon_ico_path = '.NSE-OCA.ico' |
| 126 | + self.icon_png_path = '.NSE-OCA.png' |
| 127 | + PhotoImage(file=self.icon_png_path) |
| 128 | + except Exception as err: |
| 129 | + print(err, sys.exc_info()[0], "17") |
| 130 | + self.load_nse_icon = False |
| 131 | + return |
| 132 | + if is_windows_10: |
| 133 | + try: |
| 134 | + icon_ico_raw: Optional[requests.Response] = requests.get(self.url_icon_ico, |
| 135 | + headers=self.headers, stream=True) |
| 136 | + if icon_ico_raw is None: |
| 137 | + self.icon_ico_path = None |
| 138 | + return |
| 139 | + with open('.NSE-OCA.ico', 'wb') as f: |
| 140 | + for chunk in icon_ico_raw.iter_content(1024): |
| 141 | + f.write(chunk) |
| 142 | + self.icon_ico_path = '.NSE-OCA.ico' |
| 143 | + except Exception as err: |
| 144 | + print(err, sys.exc_info()[0], "18") |
| 145 | + self.icon_ico_path = None |
| 146 | + return |
128 | 147 |
|
129 | 148 | def check_for_updates(self, auto: bool = True) -> None: |
130 | 149 | release_data: requests.Response = requests.get( |
|
0 commit comments