Debian Codegraph @

pynicotine/gtkgui/dialogs/about.py

raw
1 # COPYRIGHT (C) 2020-2025 Nicotine+ Contributors
2 #
3 # GNU GENERAL PUBLIC LICENSE
4 # Version 3, 29 June 2007
5 #
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18
19 import sys
20
21 from gi.repository import Gtk
22
23 import pynicotine
24 from pynicotine.core import core
25 from pynicotine.events import events
26 from pynicotine.gtkgui.application import GTK_API_VERSION
27 from pynicotine.gtkgui.widgets import ui
28 from pynicotine.gtkgui.widgets.dialogs import Dialog
29 from pynicotine.gtkgui.widgets.theme import add_css_class
30 from pynicotine.gtkgui.widgets.theme import remove_css_class
31 from pynicotine.utils import open_uri
32
33
34 class About(Dialog):
35
36 AUTHORS = [
37 "<b>Nicotine+ Team</b>",
38
39 ("<b>Mat (mathiascode)</b>"
40 "\n • Maintainer (2020–present)"
41 "\n • Developer"),
42
43 ("<b>Adam Cécile (eLvErDe)</b>"
44 "\n • Maintainer (2013–2016)"
45 "\n • Domain name administrator"
46 "\n • Source code migration from SVN to GitHub"
47 "\n • Developer"),
48
49 ("<b>Han Boetes</b>"
50 "\n • Tester"
51 "\n • Documentation"
52 "\n • Bug hunting"
53 "\n • Translation management"),
54
55 ("<b>alekksander</b>"
56 "\n • Tester"
57 "\n • Redesign of some graphics"),
58
59 ("<b>slook</b>"
60 "\n • Tester"
61 "\n • Accessibility improvements"),
62
63 ("<b>ketacat</b>"
64 "\n • Tester"),
65
66
67 "\n<b>Nicotine+ Team (Emeritus)</b>",
68
69 ("<b>daelstorm</b>"
70 "\n • Maintainer (2004–2009)"
71 "\n • Developer"),
72
73 ("<b>quinox</b>"
74 "\n • Maintainer (2009–2012)"
75 "\n • Developer"),
76
77 ("<b>Michael Labouebe (gfarmerfr)</b>"
78 "\n • Maintainer (2016–2017)"
79 "\n • Developer"),
80
81 ("<b>Kip Warner</b>"
82 "\n • Maintainer (2018–2020)"
83 "\n • Developer"
84 "\n • Debianization"),
85
86 ("<b>gallows (aka 'burp O')</b>"
87 "\n • Developer"
88 "\n • Packager"
89 "\n • Submitted Slack.Build file"),
90
91 ("<b>hedonist (formerly known as alexbk)</b>"
92 "\n • OS X Nicotine.app maintainer / developer"
93 "\n • Author of PySoulSeek, used for Nicotine core"),
94
95 ("<b>lee8oi</b>"
96 "\n • Bash commander"
97 "\n • New and updated /alias"),
98
99 ("<b>INMCM</b>"
100 "\n • Nicotine+ topic maintainer on ubuntuforums.org"),
101
102 ("<b>suser-guru</b>"
103 "\n • Suse Linux packager"
104 "\n • Nicotine+ RPM's for Suse 9.1, 9.2, 9.3, 10.0, 10.1"),
105
106 ("<b>osiris</b>"
107 "\n • Handy-man"
108 "\n • Documentation"
109 "\n • Some GNU/Linux packaging"
110 "\n • Nicotine+ on Win32"
111 "\n • Author of Nicotine+ guide"),
112
113 ("<b>Mutnick</b>"
114 "\n • Created Nicotine+ GitHub organization"
115 "\n • Developer"),
116
117 ("<b>Lene Preuss</b>"
118 "\n • Python 3 migration"
119 "\n • Unit and DEP-8 continuous integration testing"),
120
121
122 "\n<b>Nicotine Team (Emeritus)</b>",
123
124 ("<b>Ingmar K. Steen (Hyriand)</b>"
125 "\n • Maintainer (2003–2004)"),
126
127 ("<b>daelstorm</b>"
128 "\n • Beta tester"
129 "\n • Designer of most of the settings"
130 "\n • Made the Nicotine icons"),
131
132 ("<b>SmackleFunky</b>"
133 "\n • Beta tester"),
134
135 ("<b>Wretched</b>"
136 "\n • Beta tester"
137 "\n • Bringer of great ideas"),
138
139 ("<b>(va)\\*10^3</b>"
140 "\n • Beta tester"
141 "\n • Designer of Nicotine homepage and artwork (logos)"),
142
143 ("<b>sierracat</b>"
144 "\n • MacOSX tester"
145 "\n • soulseeX developer"),
146
147 ("<b>Gustavo J. A. M. Carneiro</b>"
148 "\n • Created the exception dialog"),
149
150 ("<b>SeeSchloss</b>"
151 "\n • Developer"
152 "\n • Created 1.0.8 Win32 installer"
153 "\n • Created Soulfind, open source Soulseek server written in D"),
154
155 ("<b>vasi</b>"
156 "\n • Mac developer"
157 "\n • Packaged Nicotine on OSX PowerPC"),
158
159
160 "\n<b>PySoulSeek Team (Emeritus)</b>",
161
162 ("<b>Alexander Kanavin</b>"
163 "\n • Maintainer (2001–2003)"),
164
165 ("<b>Nir Arbel</b>"
166 "\n • Helped with many protocol questions, and of course he designed and implemented the whole system"),
167
168 ("<b>Brett W. Thompson (Zip)</b>"
169 "\n • His client code was used to get an initial impression of how the system works"
170 "\n • Supplied the patch for logging chat conversations"),
171
172 ("<b>Josselin Mouette</b>"
173 "\n • Official Debian package maintainer"),
174
175 ("<b>blueboy</b>"
176 "\n • Former unofficial Debian package maintainer"),
177
178 ("<b>Christian Swinehart</b>"
179 "\n • Fink package maintainer"),
180
181 ("<b>Ingmar K. Steen (Hyriand)</b>"
182 "\n • Patches for upload bandwidth management, banning, various UI improvements and more"),
183
184 ("<b>Geert Kloosterman</b>"
185 "\n • A script for importing Windows Soulseek configuration"),
186
187 ("<b>Joe Halliwell</b>"
188 "\n • Submitted a patch for optionally discarding search results after closing a search tab"),
189
190 ("<b>Alexey Vyskubov</b>"
191 "\n • Code cleanups"),
192
193 ("<b>Jason Green (SmackleFunky)</b>"
194 "\n • Ignore list and auto-join checkbox, wishlists")]
195
196 TRANSLATORS = [
197 ("<b>Albanian</b>"
198 "\n • W L (2023–2024)"),
199
200 ("<b>Arabic</b>"
201 "\n • ButterflyOfFire (2024)"),
202
203 ("<b>Catalan</b>"
204 "\n • Aniol (2024–2025)"
205 "\n • Maite Guix (2022)"),
206
207 ("<b>Chinese (Simplified)</b>"
208 "\n • Ys413 (2024)"
209 "\n • Bonislaw (2023)"
210 "\n • hylau (2023)"
211 "\n • hadwin (2022)"),
212
213 ("<b>Czech</b>"
214 "\n • slrslr (2024–2025)"
215 "\n • burnmail123 (2021–2023)"),
216
217 ("<b>Danish</b>"
218 "\n • mathsped (2003–2004)"),
219
220 ("<b>Dutch</b>"
221 "\n • Toine Rademacher (toineenzo) (2023–2024)"
222 "\n • Han Boetes (hboetes) (2021–2024)"
223 "\n • Kenny Verstraete (2009)"
224 "\n • nince78 (2007)"
225 "\n • Ingmar K. Steen (Hyriand) (2003–2004)"),
226
227 ("<b>English</b>"
228 "\n • slook (2021–2024)"
229 "\n • Han Boetes (hboetes) (2021–2024)"
230 "\n • Mat (mathiascode) (2020–2024)"
231 "\n • Michael Labouebe (gfarmerfr) (2016)"
232 "\n • daelstorm (2004–2009)"
233 "\n • Ingmar K. Steen (Hyriand) (2003–2004)"),
234
235 ("<b>Esperanto</b>"
236 "\n • phlostically (2021)"),
237
238 ("<b>Estonian</b>"
239 "\n • rimasx (2024)"
240 "\n • PriitUring (2023)"),
241
242 ("<b>Euskara</b>"
243 "\n • Julen (2006–2007)"),
244
245 ("<b>Finnish</b>"
246 "\n • Kari Viittanen (Kalevi) (2006–2007)"),
247
248 ("<b>French</b>"
249 "\n • Saumon (2023)"
250 "\n • subu_versus (2023)"
251 "\n • zniavre (2007–2023)"
252 "\n • Maxime Leroy (Lisapple) (2021–2022)"
253 "\n • Mohamed El Morabity (melmorabity) (2021–2024)"
254 "\n • m-balthazar (2020)"
255 "\n • Michael Labouebe (gfarmerfr) (2016–2017)"
256 "\n • Monsieur Poisson (2009–2010)"
257 "\n • ManWell (2007)"
258 "\n • systr (2006)"
259 "\n • Julien Wajsberg (flashfr) (2003–2004)"),
260
261 ("<b>German</b>"
262 "\n • Han Boetes (hboetes) (2021–2024)"
263 "\n • phelissimo_ (2023)"
264 "\n • Meokater (2007)"
265 "\n • (._.) (2007)"
266 "\n • lippel (2004)"
267 "\n • Ingmar K. Steen (Hyriand) (2003–2004)"),
268
269 ("<b>Hungarian</b>"
270 "\n • Szia Tomi (2022–2024)"
271 "\n • Nils (2009)"
272 "\n • David Balazs (djbaloo) (2006–2020)"),
273
274 ("<b>Italian</b>"
275 "\n • Gabriele (Gabboxl) (2022–2023)"
276 "\n • ms-afk (2023)"
277 "\n • Gianluca Boiano (2020–2023)"
278 "\n • nicola (2007)"
279 "\n • dbazza (2003–2004)"),
280
281 ("<b>Latvian</b>"
282 "\n • Pagal3 (2022–2025)"),
283
284 ("<b>Lithuanian</b>"
285 "\n • mantas (2020)"
286 "\n • Žygimantas Beručka (2006–2009)"),
287
288 ("<b>Norwegian Bokmål</b>"
289 "\n • Allan Nordhøy (comradekingu) (2021)"),
290
291 ("<b>Polish</b>"
292 "\n • Mariusz (mariachini) (2017–2024)"
293 "\n • Amun-Ra (2007)"
294 "\n • thine (2007)"
295 "\n • Wojciech Owczarek (owczi) (2003–2004)"),
296
297 ("<b>Portuguese (Brazil)</b>"
298 "\n • Havokdan (2022–2023)"
299 "\n • Guilherme Santos (2022)"
300 "\n • b1llso (2022)"
301 "\n • Nicolas Abril (2021)"
302 "\n • yyyyyyyan (2020)"
303 "\n • Felipe Nogaroto Gonzalez (Suicide|Solution) (2006)"),
304
305 ("<b>Portuguese (Portugal)</b>"
306 "\n • ssantos (2023)"
307 "\n • Vinícius Soares (2023)"),
308
309 ("<b>Romanian</b>"
310 "\n • Slendi (xslendix) (2023)"),
311
312 ("<b>Russian</b>"
313 "\n • Kirill Feoktistov (SnIPeRSnIPeR) (2022–2024)"
314 "\n • Mehavoid (2021–2023)"
315 "\n • AHOHNMYC (2022)"),
316
317 ("<b>Slovak</b>"
318 "\n • Jozef Říha (2006–2008)"),
319
320 ("<b>Spanish (Chile)</b>"
321 "\n • MELERIX (2021–2023)"
322 "\n • tagomago (2021–2022)"
323 "\n • Strange (2021)"
324 "\n • Silvio Orta (2007)"
325 "\n • Dreslo (2003–2004)"),
326
327 ("<b>Spanish (Spain)</b>"
328 "\n • gallegonovato (2023–2024)"
329 "\n • MELERIX (2021–2023)"
330 "\n • tagomago (2021–2022)"
331 "\n • Strange (2021)"
332 "\n • Silvio Orta (2007)"
333 "\n • Dreslo (2003–2004)"),
334
335 ("<b>Swedish</b>"
336 "\n • mitramai (2021)"
337 "\n • Markus Magnuson (alimony) (2003–2004)"),
338
339 ("<b>Tamil</b>"
340 "\n • தமிழ்நேரம் (2025)"),
341
342 ("<b>Turkish</b>"
343 "\n • Oğuz Ersen (2021–2024)"),
344
345 ("<b>Ukrainian</b>"
346 "\n • Oleg Gritsun (2024–2025)"
347 "\n • uniss2209 (2022)")]
348
349 LICENSE = [
350 ("Nicotine+ is licensed under the <a href='https://www.gnu.org/licenses/gpl-3.0.html'>"
351 "GNU General Public License v3.0 or later</a>, with the following exceptions:"),
352
353 ("<b><a href='https://github.com/tinytag/tinytag'>tinytag</a> licensed under the MIT License.</b>"
354 "\nCopyright (c) 2014-2023 Tom Wallroth, Mat (mathiascode)"
355 "\n\nPermission is hereby granted, free of charge, to any person obtaining a copy "
356 'of this software and associated documentation files (the "Software"), to deal '
357 "in the Software without restriction, including without limitation the rights "
358 "to use, copy, modify, merge, publish, distribute, sublicense, and/or sell "
359 "copies of the Software, and to permit persons to whom the Software is "
360 "furnished to do so, subject to the following conditions: "
361 "\n\nThe above copyright notice and this permission notice shall be included in all "
362 "copies or substantial portions of the Software."),
363
364 ("<b><a href='https://github.com/madebybowtie/FlagKit'>FlagKit</a> icons licensed "
365 "under the MIT License.</b>"
366 "\nCopyright (c) 2016 Bowtie AB"
367 "\n\nPermission is hereby granted, free of charge, to any person obtaining a copy "
368 'of this software and associated documentation files (the "Software"), to deal '
369 "in the Software without restriction, including without limitation the rights "
370 "to use, copy, modify, merge, publish, distribute, sublicense, and/or sell "
371 "copies of the Software, and to permit persons to whom the Software is "
372 "furnished to do so, subject to the following conditions: "
373 "\n\nThe above copyright notice and this permission notice shall be included in all "
374 "copies or substantial portions of the Software."),
375
376 ("<b>IP2Location country data licensed under the "
377 "<a href='https://creativecommons.org/licenses/by-sa/4.0/'>CC-BY-SA-4.0 License</a>.</b>"
378 "\nCopyright (c) 2001–2024 Hexasoft Development Sdn. Bhd."
379 "\nNicotine+ uses the IP2Location LITE database for "
380 "<a href='https://lite.ip2location.com'>IP geolocation</a>.")]
381
382 def __init__(self, application):
383
384 (
385 self.application_version_label,
386 self.authors_container,
387 self.container,
388 self.copyright_label,
389 self.dependency_versions_label,
390 self.license_container,
391 self.main_icon,
392 self.status_container,
393 self.status_icon,
394 self.status_label,
395 self.status_spinner,
396 self.translators_container,
397 self.website_label
398 ) = ui.load(scope=self, path="dialogs/about.ui")
399
400 super().__init__(
401 parent=application.window,
402 content_box=self.container,
403 show_callback=self.on_show,
404 close_callback=self.on_close,
405 title=_("About"),
406 width=425,
407 height=540,
408 show_title=False
409 )
410
411 self.is_version_outdated = False
412
413 icon_name = pynicotine.__application_id__
414 icon_args = (Gtk.IconSize.BUTTON,) if GTK_API_VERSION == 3 else () # pylint: disable=no-member
415 website_text = _('Website')
416 gtk_version = f"{Gtk.get_major_version()}.{Gtk.get_minor_version()}.{Gtk.get_micro_version()}"
417
418 self.main_icon.set_from_icon_name(icon_name, *icon_args)
419 self.website_label.connect("activate-link", self.on_activate_link)
420
421 for label_widget, text in (
422 (self.application_version_label, f"{pynicotine.__application_name__} {pynicotine.__version__}"),
423 (self.dependency_versions_label, (f"GTK {gtk_version} • Python {sys.version.split()[0]}")),
424 (self.website_label, (f"<a href='{pynicotine.__website_url__}' title='{pynicotine.__website_url__}'>"
425 f"{website_text}</a>")),
426 (self.copyright_label, f"<small>{pynicotine.__copyright__}</small>")
427 ):
428 label_widget.set_markup(text)
429
430 for entries, container in (
431 (self.AUTHORS, self.authors_container),
432 (self.TRANSLATORS, self.translators_container),
433 (self.LICENSE, self.license_container)
434 ):
435 for text in entries:
436 label = Gtk.Label(label=text, use_markup=True, selectable=True, wrap=True, xalign=0, visible=True)
437
438 if entries is self.LICENSE:
439 label.connect("activate-link", self.on_activate_link)
440
441 if GTK_API_VERSION >= 4:
442 container.append(label) # pylint: disable=no-member
443 else:
444 container.add(label) # pylint: disable=no-member
445
446 events.connect("check-latest-version", self.on_check_latest_version)
447
448 def on_activate_link(self, _label, url):
449 open_uri(url)
450 return True
451
452 def on_check_latest_version(self, latest_version, is_outdated, error):
453
454 if error:
455 icon_name = "emblem-important-symbolic"
456 css_class = "error"
457 message = _("Error checking latest version: %s") % error
458
459 elif is_outdated:
460 icon_name = "dialog-warning-symbolic"
461 css_class = "warning"
462 message = _("New release available: %s") % latest_version
463
464 else:
465 icon_name = "object-select-symbolic"
466 css_class = "success"
467 message = _("Up to date")
468
469 self.is_version_outdated = is_outdated
470 icon_args = (Gtk.IconSize.BUTTON,) if GTK_API_VERSION == 3 else () # pylint: disable=no-member
471
472 self.status_label.set_label(message)
473
474 self.status_icon.set_from_icon_name(icon_name, *icon_args)
475 self.status_spinner.set_visible(False)
476 self.status_spinner.stop()
477
478 add_css_class(self.status_container, css_class)
479
480 def on_show(self, *_args):
481
482 if core.update_checker is None:
483 # Update checker is not loaded
484 return
485
486 if self.is_version_outdated:
487 # No need to check latest version again
488 return
489
490 if not self.is_visible():
491 return
492
493 for css_class in ("error", "warning", "success"):
494 remove_css_class(self.status_container, css_class)
495
496 self.status_label.set_label(_("Checking latest version…"))
497 self.status_spinner.set_visible(True)
498 self.status_spinner.start()
499 self.status_container.set_visible(True)
500
501 core.update_checker.check()
502
503 def on_close(self, *_args):
504
505 self.main_icon.grab_focus()
506 self.status_spinner.stop()
507 self.container.get_vadjustment().set_value(0)