PanelInfo.py 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. """
  2. This file is part of RuneOptimizer.
  3. RuneOptimizer is free software: you can redistribute it and/or modify it
  4. under the terms of the GNU General Public License as published by the Free
  5. Software Foundation, either version 3 of the License, or (at your option)
  6. any later version.
  7. RuneOptimizer is distributed in the hope that it will be useful, but WITHOUT
  8. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  9. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  10. more details.
  11. You should have received a copy of the GNU General Public License along with
  12. RuneOptimizer. If not, see <https://www.gnu.org/licenses/>.
  13. """
  14. class PanelInfo(wx.Panel):
  15. """
  16. The panel that shows info about the app.
  17. Static content, just some labels.
  18. """
  19. def __init__(self, parent, id=wx.ID_ANY):
  20. """Initializes the panel.
  21. Sets up all the widgets.
  22. Parameters
  23. ----------
  24. parent : wx.*
  25. Panel parent.
  26. id : int, optional
  27. ID for the panel (default wx.ID_ANY).
  28. """
  29. # Parent constructor
  30. wx.Panel.__init__(self, parent=parent, id=id)
  31. # Prepare some fonts
  32. title_font = wx.Font(
  33. pointSize=14, family=wx.FONTFAMILY_DEFAULT,
  34. style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_BOLD
  35. )
  36. label_font = wx.Font(
  37. pointSize=10, family=wx.FONTFAMILY_DEFAULT,
  38. style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_NORMAL
  39. )
  40. content_font = wx.Font(
  41. pointSize=10, family=wx.FONTFAMILY_DEFAULT,
  42. style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_BOLD
  43. )
  44. wx.StaticText(
  45. parent=self, id=wx.ID_ANY, label=app_info["name"],
  46. pos=(30, 30), size=(400, 40)
  47. ).SetFont(title_font)
  48. wx.StaticText(
  49. parent=self, id=wx.ID_ANY, label="Application version:",
  50. pos=(40, 90), size=(150, 30), style=wx.ALIGN_RIGHT
  51. ).SetFont(label_font)
  52. wx.StaticText(
  53. parent=self, id=wx.ID_ANY, label=app_info["app_version"],
  54. pos=(200, 90), size=(400, 30)
  55. ).SetFont(content_font)
  56. wx.StaticText(
  57. parent=self, id=wx.ID_ANY, label="GUI version:",
  58. pos=(40, 120), size=(150, 30), style=wx.ALIGN_RIGHT
  59. ).SetFont(label_font)
  60. wx.StaticText(
  61. parent=self, id=wx.ID_ANY, label=app_info["gui_version"],
  62. pos=(200, 120), size=(400, 30)
  63. ).SetFont(content_font)
  64. wx.StaticText(
  65. parent=self, id=wx.ID_ANY, label="Author:",
  66. pos=(40, 150), size=(150, 30), style=wx.ALIGN_RIGHT
  67. ).SetFont(label_font)
  68. wx.StaticText(
  69. parent=self, id=wx.ID_ANY,
  70. label=app_info["author"] + " <" +app_info["author_mail"] + ">",
  71. pos=(200, 150), size=(400, 30)
  72. ).SetFont(content_font)
  73. y = 180
  74. for name, url in app_info["url"].items():
  75. wx.StaticText(
  76. parent=self, id=wx.ID_ANY, label=name + ":",
  77. pos=(40, y), size=(150, 30), style=wx.ALIGN_RIGHT
  78. ).SetFont(label_font)
  79. wx.adv.HyperlinkCtrl(
  80. parent=self, id=wx.ID_ANY, label=url,
  81. pos=(200-8, y-5), size=(400, 30), style=wx.adv.HL_ALIGN_LEFT
  82. ).SetFont(content_font)
  83. y += 30