Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
regpy.py82 linesDownload Raw Back to tools
1# (sort-of) Registry editor2import commctrl3import dialog4import win32con5import win32ui6 7 8class RegistryControl:9    def __init__(self, key):10        self.key = key11 12 13class RegEditPropertyPage(dialog.PropertyPage):14    IDC_LISTVIEW = 100015 16    def GetTemplate(self):17        "Return the template used to create this dialog"18 19        w = 152  # Dialog width20        h = 122  # Dialog height21        SS_STD = win32con.WS_CHILD | win32con.WS_VISIBLE22        FRAMEDLG_STD = win32con.WS_CAPTION | win32con.WS_SYSMENU23        style = (24            FRAMEDLG_STD25            | win32con.WS_VISIBLE26            | win32con.DS_SETFONT27            | win32con.WS_MINIMIZEBOX28        )29        template = [30            [self.caption, (0, 0, w, h), style, None, (8, "Helv")],31        ]32        lvStyle = (33            SS_STD34            | commctrl.LVS_EDITLABELS35            | commctrl.LVS_REPORT36            | commctrl.LVS_AUTOARRANGE37            | commctrl.LVS_ALIGNLEFT38            | win32con.WS_BORDER39            | win32con.WS_TABSTOP40        )41        template.append(42            ["SysListView32", "", self.IDC_LISTVIEW, (10, 10, 185, 100), lvStyle]43        )44        return template45 46 47class RegistryPage(RegEditPropertyPage):48    def __init__(self):49        self.caption = "Path"50        RegEditPropertyPage.__init__(self, self.GetTemplate())51 52    def OnInitDialog(self):53        self.listview = self.GetDlgItem(self.IDC_LISTVIEW)54        RegEditPropertyPage.OnInitDialog(self)55        # Setup the listview columns56        itemDetails = (commctrl.LVCFMT_LEFT, 100, "App", 0)57        self.listview.InsertColumn(0, itemDetails)58        itemDetails = (commctrl.LVCFMT_LEFT, 1024, "Paths", 0)59        self.listview.InsertColumn(1, itemDetails)60 61        index = self.listview.InsertItem(0, "App")62        self.listview.SetItemText(index, 1, "Path")63 64 65class RegistrySheet(dialog.PropertySheet):66    def __init__(self, title):67        dialog.PropertySheet.__init__(self, title)68        self.HookMessage(self.OnActivate, win32con.WM_ACTIVATE)69 70    def OnActivate(self, msg):71        print("OnAcivate")72 73 74def t():75    ps = RegistrySheet("Registry Settings")76    ps.AddPage(RegistryPage())77    ps.DoModal()78 79 80if __name__ == "__main__":81    t()82 
codekingpro/portable-devtools · Team Ai