Funktionierender Prototyp des Serious Games zur Vermittlung von Wissen zu Software-Engineering-Arbeitsmodellen.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

regpy.py 2.2KB

1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. # (sort-of) Registry editor
  2. import commctrl
  3. import dialog
  4. import win32con
  5. import win32ui
  6. class RegistryControl:
  7. def __init__(self, key):
  8. self.key = key
  9. class RegEditPropertyPage(dialog.PropertyPage):
  10. IDC_LISTVIEW = 1000
  11. def GetTemplate(self):
  12. "Return the template used to create this dialog"
  13. w = 152 # Dialog width
  14. h = 122 # Dialog height
  15. SS_STD = win32con.WS_CHILD | win32con.WS_VISIBLE
  16. FRAMEDLG_STD = win32con.WS_CAPTION | win32con.WS_SYSMENU
  17. style = (
  18. FRAMEDLG_STD
  19. | win32con.WS_VISIBLE
  20. | win32con.DS_SETFONT
  21. | win32con.WS_MINIMIZEBOX
  22. )
  23. template = [
  24. [self.caption, (0, 0, w, h), style, None, (8, "Helv")],
  25. ]
  26. lvStyle = (
  27. SS_STD
  28. | commctrl.LVS_EDITLABELS
  29. | commctrl.LVS_REPORT
  30. | commctrl.LVS_AUTOARRANGE
  31. | commctrl.LVS_ALIGNLEFT
  32. | win32con.WS_BORDER
  33. | win32con.WS_TABSTOP
  34. )
  35. template.append(
  36. ["SysListView32", "", self.IDC_LISTVIEW, (10, 10, 185, 100), lvStyle]
  37. )
  38. return template
  39. class RegistryPage(RegEditPropertyPage):
  40. def __init__(self):
  41. self.caption = "Path"
  42. RegEditPropertyPage.__init__(self, self.GetTemplate())
  43. def OnInitDialog(self):
  44. self.listview = self.GetDlgItem(self.IDC_LISTVIEW)
  45. RegEditPropertyPage.OnInitDialog(self)
  46. # Setup the listview columns
  47. itemDetails = (commctrl.LVCFMT_LEFT, 100, "App", 0)
  48. self.listview.InsertColumn(0, itemDetails)
  49. itemDetails = (commctrl.LVCFMT_LEFT, 1024, "Paths", 0)
  50. self.listview.InsertColumn(1, itemDetails)
  51. index = self.listview.InsertItem(0, "App")
  52. self.listview.SetItemText(index, 1, "Path")
  53. class RegistrySheet(dialog.PropertySheet):
  54. def __init__(self, title):
  55. dialog.PropertySheet.__init__(self, title)
  56. self.HookMessage(self.OnActivate, win32con.WM_ACTIVATE)
  57. def OnActivate(self, msg):
  58. print("OnAcivate")
  59. def t():
  60. ps = RegistrySheet("Registry Settings")
  61. ps.AddPage(RegistryPage())
  62. ps.DoModal()
  63. if __name__ == "__main__":
  64. t()