regpy.py :  » Windows » pyExcelerator » pywin32-214 » pythonwin » pywin » tools » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Windows » pyExcelerator 
pyExcelerator » pywin32 214 » pythonwin » pywin » tools » regpy.py
# (sort-of) Registry editor
import win32ui
import dialog
import win32con
import commctrl

class RegistryControl:
  def __init__(self, key):
    self.key = key

class RegEditPropertyPage(dialog.PropertyPage):
  IDC_LISTVIEW = 1000
  def GetTemplate(self):
    "Return the template used to create this dialog"

    w = 152  # Dialog width
    h = 122  # Dialog height
    SS_STD = win32con.WS_CHILD | win32con.WS_VISIBLE
    FRAMEDLG_STD = win32con.WS_CAPTION | win32con.WS_SYSMENU
    style = FRAMEDLG_STD | win32con.WS_VISIBLE | win32con.DS_SETFONT | win32con.WS_MINIMIZEBOX
    template = [[self.caption, (0, 0, w, h), style, None, (8, 'Helv')], ]
    lvStyle = SS_STD | commctrl.LVS_EDITLABELS | commctrl.LVS_REPORT | commctrl.LVS_AUTOARRANGE | commctrl.LVS_ALIGNLEFT | win32con.WS_BORDER | win32con.WS_TABSTOP
    template.append(["SysListView32", "", self.IDC_LISTVIEW, (10, 10, 185, 100), lvStyle])
    return template

class RegistryPage(RegEditPropertyPage):
  def __init__(self):
    self.caption="Path"
    RegEditPropertyPage.__init__(self, self.GetTemplate())
  def OnInitDialog(self):
    self.listview = self.GetDlgItem(self.IDC_LISTVIEW)
    RegEditPropertyPage.OnInitDialog(self)
    # Setup the listview columns
    itemDetails = (commctrl.LVCFMT_LEFT, 100, "App", 0)
    self.listview.InsertColumn(0, itemDetails)
    itemDetails = (commctrl.LVCFMT_LEFT, 1024, "Paths", 0)
    self.listview.InsertColumn(1, itemDetails)

    index = self.listview.InsertItem(0,"App")
    self.listview.SetItemText(index, 1, "Path")


class RegistrySheet(dialog.PropertySheet):
  def __init__(self, title):
    dialog.PropertySheet.__init__(self, title)
    self.HookMessage(self.OnActivate, win32con.WM_ACTIVATE)
  def OnActivate(self, msg):
    print "OnAcivate"

def t():
  ps=RegistrySheet('Registry Settings')
  ps.AddPage(RegistryPage())
  ps.DoModal()

if __name__=='__main__':
  t()
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.