PanelInfo.py 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. """
  18. def __init__(self, parent, id=wx.ID_ANY):
  19. """Initializes the panel.
  20. Sets up all the widgets.
  21. Parameters
  22. ----------
  23. parent : wx.*
  24. Panel parent.
  25. id : int, optional
  26. ID for the panel (default wx.ID_ANY).
  27. """
  28. # Parent constructor
  29. wx.Panel.__init__(self, parent=parent, id=id)
  30. # Prepare some fonts
  31. titleFont = wx.Font(
  32. pointSize=14, family=wx.FONTFAMILY_DEFAULT,
  33. style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_BOLD
  34. )
  35. labelFont = wx.Font(
  36. pointSize=10, family=wx.FONTFAMILY_DEFAULT,
  37. style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_NORMAL
  38. )
  39. contentFont = wx.Font(
  40. pointSize=10, family=wx.FONTFAMILY_DEFAULT,
  41. style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_BOLD
  42. )
  43. titleLabel = wx.StaticText(
  44. parent=self, id=wx.ID_ANY, label=app_info["name"],
  45. pos=(30, 30), size=(400, 40)
  46. )
  47. titleLabel.SetFont(titleFont)
  48. text = wx.StaticText(
  49. parent=self, id=wx.ID_ANY, label="Application version:",
  50. pos=(40, 90), size=(150, 30), style=wx.ALIGN_RIGHT
  51. )
  52. text.SetFont(labelFont)
  53. text = wx.StaticText(
  54. parent=self, id=wx.ID_ANY, label=app_info["app_version"],
  55. pos=(200, 90), size=(400, 30)
  56. )
  57. text.SetFont(contentFont)
  58. text = wx.StaticText(
  59. parent=self, id=wx.ID_ANY, label="GUI version:",
  60. pos=(40, 120), size=(150, 30), style=wx.ALIGN_RIGHT
  61. )
  62. text.SetFont(labelFont)
  63. text = wx.StaticText(
  64. parent=self, id=wx.ID_ANY, label=app_info["gui_version"],
  65. pos=(200, 120), size=(400, 30)
  66. )
  67. text.SetFont(contentFont)
  68. text = wx.StaticText(
  69. parent=self, id=wx.ID_ANY, label="Author:",
  70. pos=(40, 150), size=(150, 30), style=wx.ALIGN_RIGHT
  71. )
  72. text.SetFont(labelFont)
  73. text = wx.StaticText(
  74. parent=self, id=wx.ID_ANY,
  75. label=app_info["author"] + " <" +app_info["author_mail"] + ">",
  76. pos=(200, 150), size=(400, 30)
  77. )
  78. text.SetFont(contentFont)
  79. y = 180
  80. for name, url in app_info["url"].items():
  81. text = wx.StaticText(
  82. parent=self, id=wx.ID_ANY, label=name + ":",
  83. pos=(40, y), size=(150, 30), style=wx.ALIGN_RIGHT
  84. )
  85. text.SetFont(labelFont)
  86. text = wx.adv.HyperlinkCtrl(
  87. parent=self, id=wx.ID_ANY, label=url,
  88. pos=(200-8, y-5), size=(400, 30), style=wx.adv.HL_ALIGN_LEFT
  89. )
  90. text.SetFont(contentFont)
  91. y += 30