Exemplo n.º 1
0
 def __init__(self):
     self.w = W.Dialog((440, 64), "Searching\xc9")
     self.w.searching = W.TextBox((4, 4, -4, 16), "")
     self.w.hits = W.TextBox((4, 24, -4, 16), "Hits: 0")
     self.w.canceltip = W.TextBox((4, 44, -4, 16),
                                  "Type cmd-period (.) to cancel.")
     self.w.open()
Exemplo n.º 2
0
    def __init__(self):
        self.template = "%s, %d point"
        self.fontsettings, self.tabsettings, self.windowsize = geteditorprefs()
        self.w = W.Dialog((328, 120), "Editor default settings")
        self.w.setfontbutton = W.Button((8, 8, 80, 16), "Set font\xc9", self.dofont)
        self.w.fonttext = W.TextBox((98, 10, -8, 14), self.template % (self.fontsettings[0], self.fontsettings[2]))

        self.w.picksizebutton = W.Button((8, 50, 80, 16), "Front window", self.picksize)
        self.w.xsizelabel = W.TextBox((98, 32, 40, 14), "Width:")
        self.w.ysizelabel = W.TextBox((148, 32, 40, 14), "Height:")
        self.w.xsize = W.EditText((98, 48, 40, 20), repr(self.windowsize[0]))
        self.w.ysize = W.EditText((148, 48, 40, 20), repr(self.windowsize[1]))

        self.w.cancelbutton = W.Button((-180, -26, 80, 16), "Cancel", self.cancel)
        self.w.okbutton = W.Button((-90, -26, 80, 16), "Done", self.ok)
        self.w.setdefaultbutton(self.w.okbutton)
        self.w.bind('cmd.', self.w.cancelbutton.push)
        self.w.open()
Exemplo n.º 3
0
    def show(self):
        self.visible = 1
        if self.w:
            self.w.wid.ShowWindow()
            self.w.wid.SelectWindow()
            self.w.find.edit.select(1)
            self.w.find.edit.selectall()
            return
        self.w = W.Dialog((420, 150), "Find")

        self.w.find = TitledEditText((10, 4, 300, 36), "Search for:")
        self.w.replace = TitledEditText((10, 100, 300, 36), "Replace with:")

        self.w.boxes = W.Group((10, 50, 300, 40))
        self.w.boxes.casesens = W.CheckBox((0, 0, 100, 16), "Case sensitive")
        self.w.boxes.wholeword = W.CheckBox((0, 20, 100, 16), "Whole word")
        self.w.boxes.wrap = W.CheckBox((110, 0, 100, 16), "Wrap around")

        self.buttons = [        ("Find",                "cmdf",  self.find),
                                ("Replace",          "cmdr",     self.replace),
                                ("Replace all",  None,   self.replaceall),
                                ("Don't find",  "cmdd",  self.dont),
                                ("Cancel",            "cmd.",    self.cancel)
                        ]
        for i in range(len(self.buttons)):
            bounds = -90, 22 + i * 24, 80, 16
            title, shortcut, callback = self.buttons[i]
            self.w[title] = W.Button(bounds, title, callback)
            if shortcut:
                self.w.bind(shortcut, self.w[title].push)
        self.w.setdefaultbutton(self.w["Don't find"])
        self.w.find.edit.bind("<key>", self.key)
        self.w.bind("<activate>", self.activate)
        self.w.bind("<close>", self.close)
        self.w.open()
        self.setparms()
        self.w.find.edit.select(1)
        self.w.find.edit.selectall()
        self.checkbuttons()
Exemplo n.º 4
0
"""Simple W demo -- shows how to make a window, and bind a function to a "key" event."""
import W

# key callback function
def tester(char, event):
    text = ` char ` + "\r" + ` ord(char) ` + "\r" + hex(
        ord(char)) + "\r" + oct(ord(char))
    window.keys.set(text)

# close callback
def close():
    window.close()

# new window
window = W.Dialog((180, 100), "Type a character")
# make a frame (a simple rectangle)
window.frame = W.Frame((5, 5, -5, -33))
# some labels, static text
window.captions = W.TextBox((10, 9, 43, -36), "char:\rdecimal:\rhex:\roctal:")
# another static text box
window.keys = W.TextBox((60, 9, 40, -36))
# a button
window.button = W.Button((-69, -24, 60, 16), "Done", close)
# bind the callbacks
window.bind("<key>", tester)
window.bind("cmdw", window.button.push)
# open the window
window.open()

Exemplo n.º 5
0

# key callback function
def tester(char, event):
    text = "%r\r%d\r%s\r%s" % (char, ord(char), hex(ord(chart)), oct(
        ord(char)))
    window.keys.set(text)


# close callback
def close():
    window.close()


# new window
window = W.Dialog((180, 100), "Type a character")

# make a frame (a simple rectangle)
window.frame = W.Frame((5, 5, -5, -33))

# some labels, static text
window.captions = W.TextBox((10, 9, 43, -36), "char:\rdecimal:\rhex:\roctal:")

# another static text box
window.keys = W.TextBox((60, 9, 40, -36))

# a button
window.button = W.Button((-69, -24, 60, 16), "Done", close)

# bind the callbacks
window.bind("<key>", tester)