コード例 #1
0
            self.components.sessionList.stringSelection = section
        
    def on_delBtn_command(self, event):
        msgtxt = 'Are you sure you want to delete "%s"?' % self.components.sessionList.stringSelection
        result = dialog.messageDialog(self, msgtxt, 'Caution!',
            wx.ICON_EXCLAMATION | wx.YES_NO | wx.NO_DEFAULT)
        if result.accepted:
            bull = self.cfg.remove_section(self.components.sessionList.stringSelection)
            fd = open(CONFIG_FILE, 'w')
            self.cfg.write(fd)
            fd.close()
            self.updateSessionList()
            self.components.sessionList.stringSelection = self.components.sessionList.items[0]

    def on_helpAbout_command(self, event):
        dlg = customDialogs.HTMLHelp(self)
        dlg.showModal()
        dlg.destroy()

    def updateSessionList(self):
        configlist = []
        for config in self.cfg.sections():
            if config != 'Defaults':
                configlist.append(config)
        configlist.sort()
        self.components.sessionList.items = configlist

if __name__ == '__main__':
    app = model.Application(pysshed)
    app.MainLoop()
コード例 #2
0
    def on_btnFactoryReset_command(self, event):
        try:
            self.handle.claimInterface(
                interfacenum)  # Open the USB device for traffic
            self.devicetohost(0x41, 0xff, 0)  # Reset to Default
            self.handle.releaseInterface()
        except:
            time.sleep(5)  # Wait for Mobo uC to reset itself
            self.OnUSB(-1)  # Read settings back again
            self.on_Refresh_command(-1)

    #############################################################
    # Exit Button
    #############################################################
    def on_Exit_command(self, event):
        self.Close()


#############################################################
# Here be Main
#############################################################
if __name__ == '__main__':
    app = model.Application(Launcher)

    # Main window resize on Windows platform
    if platform.system() == 'Windows':
        bg = app.getCurrentBackground()
        bg.size = (922, 620)

    app.MainLoop()
コード例 #3
0
        fit_check = self.components.FitPlotCheck.checked
        if fit_check:
            fit_str  = self.components.FitFmt.stringSelection
        else:
            fit_str = None

        show_pk = self.components.ShowPeak.checked
        show_pk_bgr = self.components.ShowPeakBgr.checked
        if show_pk:
            if show_pk_bgr:
                pk_str = 'Peaks+Bgr'
            else:
                pk_str = 'Peaks'
        else:
            pk_str = None
            
        # build cmd
        xrf_name = self.get_xrf_var_name()
        xrf = self.get_data(xrf_name)
        xrf_data.xrf_plot(xrf,d=data_str,f=fit_str,p=pk_str,
                         ylog=ylog,xlog=xlog,hold=hold) 

        return


##################################################
if __name__ == '__main__':
    app = model.Application(wxXRF)
    app.MainLoop()
コード例 #4
0
        if not url:
            #self.top.bell()
            self.message("[Error: No URL entered]")
            return
        self.rooturl = url
        dir = self.components.fldDirectory.text
        if not dir:
            self.sucker.savedir = None
        else:
            self.sucker.savedir = dir
            self.sucker.rootdir = os.path.dirname(websucker.Sucker.savefilename(self.sucker, url))
        #self.go_button.configure(state=DISABLED)
        self.components.btnGo.enabled = 0
        #self.auto_button.configure(state=DISABLED)
        #self.cancel_button.configure(state=NORMAL)
        self.components.btnCancel.enabled = 1
        self.message( '[running...]')
        self.sucker.stopit = 0
        t = threading.Thread(target=self.sucker.run1, args=(url,))
        t.start()

    def cancel(self):
        if self.sucker:
            self.sucker.stopit = 1
        self.message("[canceling...]")


if __name__ == '__main__':
    app = model.Application(WebSuckerView)
    app.MainLoop()
コード例 #5
0
        return getattr(self.components, name)

    def __init__(self, *args, **kw):
        """Initialize the form"""
        model.Background.__init__(self, *args, **kw)
        # Call the VB Form_Load
        # TODO: This is brittle - depends on how the private indicator is set
        if hasattr(self, "_MAINFORM__Form_Load"):
            self._MAINFORM__Form_Load()
        elif hasattr(self, "Form_Load"):
            self.Form_Load()


from vb2py.vbfunctions import *
from vb2py.vbdebug import *


class MAINFORM(Background):
    """ A form to test if colours are working correctly"""

    # VB2PY (UntranslatedCode) Attribute VB_Name = "frmColors"
    # VB2PY (UntranslatedCode) Attribute VB_GlobalNameSpace = False
    # VB2PY (UntranslatedCode) Attribute VB_Creatable = False
    # VB2PY (UntranslatedCode) Attribute VB_PredeclaredId = True
    # VB2PY (UntranslatedCode) Attribute VB_Exposed = False


if __name__ == '__main__':
    app = model.Application(MAINFORM)
    app.MainLoop()
コード例 #6
0
from PythonCard import model

class MainWindow(model.Background):
    
    def on_btnCtoF_mouseClick(self, event):
        cel = float(self.components.tfCel.text)
        fahr = cel * 9.0 / 5 + 32
        print('cel = ', cel, ' fahr = ', fahr)
        self.components.spinFahr.value = int(fahr)
        
    def on_btnFtoC_mouseClick(self, event):
        fahr = self.components.spinFahr.value
        cel = (fahr - 32) * 5.0 / 9
        celStr = '%.2f' % cel
        self.components.tfCel.text = celStr
        
    def on_menuConvertCtoF_select(self, event):
        cel = float(self.components.tfCel.text)
        fahr = cel * 9.0 / 5 + 32
        print('cel = ', cel, ' fahr = ', fahr)
        self.components.spinFahr.value = int(fahr)
        
    def on_menuConvertFtoC_select(self, event):
        fahr = self.components.spinFahr.value
        cel = (fahr - 32) * 5.0 / 9
        celStr = '%.2f' % cel
        self.components.tfCel.text = celStr
    

app = model.Application(MainWindow)
app.MainLoop()
コード例 #7
0
ファイル: TIO_CH20_1.py プロジェクト: devGB/Zombula
        self.components.StaticText4.text = ""
        self.components.StaticText5.text = "You have " + str(tries) + " left."

    def on_btnGuess_mouseClick(self, event):
        global done, guess, tries
        if not done:
            if tries > 1:
                if guess != secret:
                    guess = self.components.Spinner1.value  # get the player's guess
                    if guess < secret:
                        self.components.StaticText4.text = "Too low, ye scurvy dog!"
                    elif guess > secret:
                        self.components.StaticText4.text = "Too high, landlubber!"
                    tries = tries - 1  # used up one try
                    self.components.StaticText5.text = "You have " + str(
                        tries) + " left."

                elif guess == secret:
                    self.components.StaticText4.text = "Avast! Ye got it!  Found my secret, ye did!"
                    self.components.StaticText5.text = ""
                    done = True
            else:
                self.components.StaticText4.text = "No more guesses!  Better luck next time, matey!"
                self.components.StaticText5.text = "The secret number was " + str(
                    secret)
                done = True


app = model.Application(NumGuess)
app.MainLoop()
コード例 #8
0
                        ['roslaunch',
                        'sofie_ros',
                        'play_back.launch',
                        'usbcamrosbag:='+exportFileName,
                        'playbackspeed:='+self.experimentControlBackground.
                            components.playBackSpeed.getLineText(0)
                        ];
                    logging.debug('Executing command: '+str(processString))    
                    theProcess = Popen(processString)
                #print 'Waiting to Start again.'
                while self.experimentControlBackground.videoExporting == True:
                    time.sleep(0.1)
            except:
                pass
            self.experimentControlBackground.cleanViewVideo()
            if theProcess:
                theProcess.terminate()
            
if __name__ == '__main__':
    resourceString = resource_filename(__name__, 'data/gui_resource.txt')
    #print resourceString
    r_file = model.resource.ResourceFile(resourceString)
    app = model.Application(ExperimentControlBackground,rsrc=r_file.getResource())
    app.MainLoop()
#    while True:
#        txt = sys.stdout.readline()
#        if not txt: 
#            break
#        txt=txt.replace("\r\n","\n").replace("\r\n","\n").replace('\\\\','\\')
#        self.components.taStdout.appendText(txt)
コード例 #9
0
ファイル: doodle.py プロジェクト: styresdc/testNotebook
            path, filename = os.path.split(self.filename)
        result = dialog.saveFileDialog(None, "Save As", path, filename)
        if result.accepted:
            path = result.paths[0]
            fileType = graphic.bitmapType(path)
            print fileType, path
            try:
                bmp = self.components.bufOff.getBitmap()
                bmp.SaveFile(path, fileType)
                return 1
            except:
                return 0
        else:
            return 0

    def on_menuEditCopy_select(self, event):
        clipboard.setClipboard(self.components.bufOff.getBitmap())

    def on_menuEditPaste_select(self, event):
        bmp = clipboard.getClipboard()
        if isinstance(bmp, wx.Bitmap):
            self.components.bufOff.drawBitmap(bmp)

    def on_editClear_command(self, event):
        self.components.bufOff.clear()


if __name__ == '__main__':
    app = model.Application(Doodle)
    app.MainLoop()
コード例 #10
0
        if result.accepted:
            self.openFile(result.paths[0])

    def on_menuFileOpenSlide_select(self, event):
        if self.fileList is not None and self.fileList != []:
            path = self.fileList[self.fileIndex]
            if imageFile(path):
                log.debug("image: %s" % path)
                viewer = os.path.abspath(
                    os.path.join('..', 'pictureViewer', 'pictureViewer.py'))
                if " " in path:
                    path = '"' + path + '"'
                try:
                    util.runScript(viewer, path)
                except:  # Fail gracefully if displaying fails
                    pass
            elif htmlFile(path):
                log.debug("html: %s" % path)
                import webbrowser
                webbrowser.open(path, 1, 1)

    def on_close(self, event):
        self.clockTimer.stop()
        self.bmp = None
        event.skip()


if __name__ == '__main__':
    app = model.Application(SlideShow)
    app.MainLoop()
コード例 #11
0
ファイル: wxXrrIntModel.py プロジェクト: jackey-qiu/tdl
        #
        hold = self.components.HoldRFY.checked
        bar = self.components.BarPlot.checked
        if self.components.PlotRFY.checked:
            if self.components.PlotData.checked:
                Rdat = self.get_Rdat()
                FYdat = self.get_FYdat()
            else:
                Rdat = None
                FYdat = None
            model.plot(ty='calc',
                       hold=hold,
                       FYflag=FYflag,
                       Rdat=Rdat,
                       FYdat=FYdat)
        if self.components.PlotDensity.checked:
            model.plot(ty='density', bar=bar, hold=hold)
        if self.components.PlotComps.checked:
            model.plot(ty='comp', bar=bar, hold=hold)
        if self.components.PlotElements.checked:
            model.plot(ty='el', bar=bar, hold=hold)
        if self.components.PlotFracs.checked:
            model.plot(ty='frac', bar=bar, hold=hold)


#############################################################################
#############################################################################
if __name__ == '__main__':
    app = model.Application(wxXrrModel)
    app.MainLoop()
コード例 #12
0
        if model == None: return
        #
        hold = self.components.HoldRFY.checked
        bar = self.components.BarPlot.checked
        if self.components.PlotRFY.checked:
            if self.components.PlotData.checked:
                Rdat = self.get_Rdat()
                FYdat = self.get_FYdat()
            else:
                Rdat = None
                FYdat = None
            model.plot(ty='calc',
                       hold=hold,
                       FYflag=FYflag,
                       Rdat=Rdat,
                       FYdat=FYdat)
        if self.components.PlotDensity.checked:
            model.plot(ty='density', bar=bar, hold=hold)
        if self.components.PlotComps.checked:
            model.plot(ty='comp', bar=bar, hold=hold)
        if self.components.PlotElements.checked:
            model.plot(ty='el', bar=bar, hold=hold)
        if self.components.PlotFracs.checked:
            model.plot(ty='frac', bar=bar, hold=hold)


##################################################
if __name__ == '__main__':
    app = model.Application(wxXrrBuilder)
    app.MainLoop()
コード例 #13
0
            self.doLogResult(msg)
            event.RequestMore()

    def doLogResult(self, data):
        if data is not None:
            # code borrowed from the Message Watcher event history display
            log = self.components.fldLog
            log.SetReadOnly(0)
            if self.maxSizeLog and log.GetLength() > self.maxSizeLog:
                # delete many lines at once to reduce overhead
                text = log.GetText()
                endDel = text.index('\n', self.maxSizeLog / 10) + 1
                log.SetTargetStart(0)
                log.SetTargetEnd(endDel)
                log.ReplaceTarget("")
            log.GotoPos(log.GetLength())
            log.AddText(data)
            log.GotoPos(log.GetLength())
            log.SetReadOnly(1)
        else:
            pass

    def on_menuOptionsAllowAny_select(self, event):
        self.webServer.allowAny = self.menuBar.getChecked(
            'menuOptionsAllowAny')


if __name__ == '__main__':
    app = model.Application(WebServerView)
    app.MainLoop()
コード例 #14
0
        return msg % (self.game.guessdoor, prize)

    def resultsMsg(self):

        games = self.games
        changes = self.changes
        wins = self.wins
        wins_change = self.wins_change

        no_changes = games - changes
        wins_no_change = wins - wins_change
        lost_change = changes - wins_change
        lost_no_change = no_changes - wins_no_change

        msg = """
            Games Played: %d

            Changed Guess: %d
            Won: %d Lost: %d

            No Change: %d
            Won: %d Lost: %d
            """
        return msg % (games, changes, wins_change, lost_change, no_changes,
                      wins_no_change, lost_no_change)


if __name__ == '__main__':
    app = model.Application(MontyHallApp)
    app.MainLoop()
コード例 #15
0
            fileType = graphic.bitmapType(path)
            print fileType, path
            try:
                #bmp = self.components.bufOff.getBitmap()
                bmp = self.win3.components.bufOff.getBitmap()
                bmp.SaveFile(path, fileType)
                return 1
            except Exception, msg: # Should check for a particular exception
                return 0
        else:
            return 0

    def on_menuEditCopy_select(self, event):
        #clipboard.setClipboard(self.components.bufOff.getBitmap())
        clipboard.setClipboard(self.win3.components.bufOff.getBitmap())

    def on_menuEditPaste_select(self, event):
        bmp = clipboard.getClipboard()
        if isinstance(bmp, wx.Bitmap):
            #self.components.bufOff.drawBitmap(bmp)
            self.win3.components.bufOff.drawBitmap(bmp)

    def on_editClear_command(self, event):
        #self.components.bufOff.clear()
        self.win3.components.bufOff.clear()


if __name__ == '__main__':
    app = model.Application(TestSplitter)
    app.MainLoop()
コード例 #16
0
ファイル: recipe-535165.py プロジェクト: zlrs/code-1
        symbol = self.components.stock4.text
        get_quote(symbol)
        self.components.change4.text = quote
        
    def on_clear_mouseClick(self, event):
        self.components.stock1.text = ""
        self.components.stock2.text = ""
        self.components.stock3.text = ""
        self.components.stock4.text = ""
        self.components.change1.text = ""
        self.components.change2.text = ""
        self.components.change3.text = ""
        self.components.change4.text = ""

if __name__ == '__main__':
    app = model.Application(stock)
    app.MainLoop()


_______________________________________________________________________________

save following as stock.rsrc.py

{'application':{'type':'Application',
          'name':'Template',
    'backgrounds': [
    {'type':'Background',
          'name':'bgTemplate',
          'title':'Standard Template with File->Exit menu',
          'size':(711, 634),
          'style':['resizeable'],
コード例 #17
0
"""
pcard1.py
Chapter 10 WxWidgets
Author: William C. Gunnells
Rapid Python Programming
"""

from PythonCard import model


class Blah(model.Background):
    pass


if __name__ == "__main__":
    app = model.Application(Blah)
    app.MainLoop()
コード例 #18
0
#!/usr/bin/python
"""
__version__ = "$Revision: 1.10 $"
__date__ = "$Date: 2004/04/24 22:13:31 $"
"""

from PythonCard import model


class parablew(model.Background):
    def __init__(self, aParent, aBgRsrc):
        model.Background.__init__(self, aParent, aBgRsrc)
        self.appstr = "howdy"

    def hello(self, hellostr):
        self.hell0s = hellstr

    def on_btnHello_mouseClick(self, event):
        print self.appstr


if __name__ == '__main__':
    app = model.Application(parablew)
    app.MainLoop()
コード例 #19
0
import interactive


#@-node:pap.20070203162417.2:<< vb2pyUI declarations >>
#@nl
#@+others
#@+node:pap.20070203162417.3:class UI
class UI(model.Background):
    """vb2Py UI for doing conversion"""

    #@	@+others
    #@+node:pap.20070203172243:on_GoInteractive_mouseClick
    def on_GoInteractive_mouseClick(self, event):
        """Hit the interactive button"""
        form = model.childWindow(self, interactive.Interactive)
        form.visible = True

    #@-node:pap.20070203172243:on_GoInteractive_mouseClick
    #@-others


#@-node:pap.20070203162417.3:class UI
#@-others

if __name__ == '__main__':
    app = model.Application(UI)
    app.MainLoop()
#@-node:pap.20070203162417.1:@thin vb2pyMain.py
#@-leo
コード例 #20
0
ファイル: hangman.py プロジェクト: lzan1/Hello_World
                    self.components.arm1.visible = True
            else:
                self.components.body.visible = True
        else:
            self.components.head.visible = True

    def on_btnGuessLetter_mouseClick(self, event):
        result = dialog.textEntryDialog(self, 'enter the letter here:',
                                        'Hangman', '')
        guess = result.text
        if len(guess) == 1:
            self.components.stYourGuesses.text = \
              self.components.stYourGuesses.text + "  " + guess + " "
            if result.text in self.currentword:
                locations = find_letters(guess, self.currentword)
                self.components.stDisplayWord.text = replace_letters \
                  (self.components.stDisplayWord.text, locations, guess)
                if self.components.stDisplayWord.text.find('-') == -1:
                    dialog.alertDialog(self, 'You win!!!!!', 'Hangman')
                    self.new_game()
            else:
                self.wrong_guess()
        else:
            dialog.alertDialog(self, 'Type one letter only', 'Hangman')

    def on_cmdNewGame_command(self, event):
        self.new_game()


app = model.Application(Hangman)
app.MainLoop()
コード例 #21
0
        text = target.text.strip()
        if not text.startswith('http://'):
            text = 'http://' + text
        if target.text != text:
            target.text = text
        self.addTextToItems()
        self.components.htmlDisplay.text = self.components.fldURL.text

    def openFile(self, path):
        self.components.htmlDisplay.text = path

    def on_menuFileOpen_select(self, event):        
        wildcard = "HTML files (*.htm;*.html)|*.htm;*.html|All files (*.*)|*.*"
        result = dialog.openFileDialog(None, "Open file", '', '', wildcard)
        if result.accepted:
            path = result.paths[0]
            self.openFile(path)

    def on_fldURL_keyPress(self, event):
        keyCode = event.keyCode
        target = event.target
        if keyCode == 13:
            self.on_goURL_command(None)
        else:
            event.skip()


if __name__ == '__main__':
    app = model.Application(SimpleBrowser)
    app.MainLoop()
コード例 #22
0
            recalcBounds(bounds, t)
        elif char=='+':
            t.rt(angle)
        elif char=='-':
            t.lt(angle)
        elif char=='[':
            t.push()
        elif char==']':
            t.pop()
    return bounds

from PythonCard.tests import pyunit

class LSystemTests(pyunit.TestCase):
    def setUp(self):
        pass
    def tearDown(self):
        pass
    def testBoundsCheckBackwardMoves(self):
        bounds = drawAbstractFractal('BB+B', 1, 90, (10.0,20.0))
        # remember that down is positive in this coordinate system
        self.assertEqual([9.0, 20.0, 10.0, 22.0], bounds)
    def testBoundsCheckForwardMoves(self):
        bounds = drawAbstractFractal('FF-F', 1, 90, (10.0,20.0))
        # remember that down is positive in this coordinate system
        self.assertEqual([9.0, 18.0, 10.0, 20.0], bounds)

if __name__ == '__main__':
    app = model.Application(LSystem)
    app.MainLoop()
コード例 #23
0
                if self.time_cycle % 3 == 0:
                    self.hunger += 1
            else:  
                self.hunger += 1
                if self.time_cycle % 2 == 0:
                    self.happiness -= 1
            if self.hunger > 8:  self.hunger = 8
            if self.hunger < 0:  self.hunger = 0
            if self.hunger == 7 and (self.time_cycle % 2 ==0) :
                self.health -= 1
            if self.hunger == 8:  
                self.health -=1   
            if self.health > 8:  self.health = 8
            if self.health < 0:  self.health = 0
            if self.happiness > 8:  self.happiness = 8
            if self.happiness < 0:  self.happiness = 0
            self.components.HappyGauge.value = self.happiness
            self.components.HealthGauge.value = self.health
            self.components.HungerGauge.value = self.hunger

    
    def on_close(self, event):
        file = open("savedata_vp.pkl", "w")
        save_list = [self.happiness, self.health, self.hunger, datetime.datetime.now(), 
                     self.time_cycle, self.paused]    #added the paused state to the pickled data
        pickle.dump(save_list, file)
        event.Skip()
        
app = model.Application(MyBackground)
app.MainLoop()
コード例 #24
0
    def on_buttons_mouseClick(self, event):
        result = helpful.multiButtonDialog(self, 'some question',
                                           ['OK', 'Not OK', "Cancel"],
                                           "Test Dialog Title")
        print "Dialog result:\naccepted: %s\ntext: %s" % (result.accepted,
                                                          result.text)

        result = helpful.multiButtonDialog(self, 'Dad, can I go to the movies tonight', \
               ['Yes', 'No', 'Maybe', ('Ask me later', 'procrastination will be better tomorrow'), 'Ask your mum'], "Movies Dialog Title")
        print "Dialog result:\naccepted: %s\ntext: %s" % (result.accepted,
                                                          result.text)

    def on_boxes_mouseClick(self, event):
        boxes = [("already", False), ("later", True)]
        result = helpful.multiCheckBoxDialog(self, boxes,
                                             "Test Boxes Dialog Title")
        print "Dialog result:\naccepted: %s\n" % (
            result.accepted), result.boxes

        result = helpful.multiCheckBoxDialog(self, self.boxes,
                                             "Test Boxes Dialog Title")
        print "Dialog result:\naccepted: %s\n" % (
            result.accepted), result.boxes
        self.boxes = result.boxes


if __name__ == '__main__':
    app = model.Application(MyBackground, None, rsrc)
    app.MainLoop()
コード例 #25
0
                            '" will not be processed.', 'Alert')
                self.statusBar.text = 'Processing finished.'
            #Open dialog box telling that processing is finished and where can the resulting files be found
            self.inputdir = ''
            self.outputfile = ''
            self.outputpath = ''
            print 'Extract Some Corpora: finished at ' + strftime('%H-%M-%S')
            result = dialog.alertDialog(
                self, 'Results found in: ' + self.outputpath + '.',
                'Processing done')

    def on_menuFileExtractSomeCorpora_select(self, event):
        self.ExtractSomeCorpora()

    def on_btnExtractSomeCorpora_mouseClick(self, event):
        self.ExtractSomeCorpora()

    def on_menuHelpHelp_select(self, event):
        try:
            f = open('_READ_ME_FIRST.txt', "r")
            msg = f.read()
            result = dialog.scrolledMessageDialog(self, msg, 'readme.txt')
        except:
            result = dialog.alertDialog(self, 'Help file missing',
                                        'Problem with the Help file')


if __name__ == '__main__':
    app = model.Application(Extract_TMX_Corpus)
    app.MainLoop()
コード例 #26
0
        """Select the directory where the files to be processed are

        @result: object returned by the dialog window with attributes accepted (true if user clicked OK button, false otherwise) and
            path (list of strings containing the full pathnames to all files selected by the user)
        @self.inputdir: directory where files to be processed are (and where output files will be written)
        @self.statusBar.text: text displayed in the program window status bar"""

        result = dialog.directoryDialog(self, 'Choose a directory', 'a')
        if result.accepted:
            self.inputdir = result.path
            self.statusBar.text = self.inputdir + ' selected.'

    def on_menuFileSelectDirectory_select(self, event):
        self.SelectDirectory()

    def on_btnSelectDirectory_mouseClick(self, event):
        self.SelectDirectory()

    def on_menuHelpShowHelp_select(self, event):
        f = open('_READ_ME_FIRST.txt', "r")
        msg = f.read()
        result = dialog.scrolledMessageDialog(self, msg, '_READ_ME_FIRST.txt')

    def on_menuFileExit_select(self, event):
        sys.exit()


if __name__ == '__main__':
    app = model.Application(Moses2TMX)
    app.MainLoop()
コード例 #27
0
        if self.previousSource != self.components.fldSource.text:
            self.previousSource = self.components.fldSource.text
            self.recompile()

    # checkboxes
    def on_mouseClick(self, event):
        self.recompile()

    # radiobutton
    def on_radSearchString_select(self, event):
        self.reevaluate()

    def on_menuHelpReModule_select(self, event):
        module_url = "http://docs.python.org/lib/module-re.html"
        if sys.platform.startswith('win'):
            fn = os.path.dirname(os.__file__)
            fn = os.path.join(fn, os.pardir, "Doc", "lib", "module-re.html")
            fn = os.path.normpath(fn)
            if os.path.isfile(fn):
                module_url = fn
            del fn
        webbrowser.open(module_url)

    def on_menuHelpReHowTo_select(self, event):
        webbrowser.open('http://py-howto.sourceforge.net/regex/regex.html')


if __name__ == '__main__':
    app = model.Application(ReDemo)
    app.MainLoop()
コード例 #28
0
from PythonCard import flatfileDatabase, model
import os, sys
import ConfigParser

CONFIG_FILE = 'flatfileDatabase.ini'


class FlatfileDatabase(flatfileDatabase.FlatfileDatabase):
    def on_initialize(self, event):
        # override the config filename
        self.configFilename = CONFIG_FILE
        flatfileDatabase.FlatfileDatabase.on_initialize(self, event)


if __name__ == '__main__':
    # assume the ini file is in the same directory as the script
    path = os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])),
                        CONFIG_FILE)
    parser = ConfigParser.ConfigParser()
    parser.read(path)
    # the resourceFile is settable via the ini file
    resourceFile = parser.get('ConfigData', 'resourceFile')

    # KEA 2002-07-16
    # since all of the needed functionality is in the framework
    # classes, we don't have to subclass in this module, we can
    # just use the base class directly
    app = model.Application(FlatfileDatabase, resourceFile)
    app.MainLoop()
コード例 #29
0
#!/usr/bin/python

"""
__version__ = "$Revision: 1.1 $"
__date__ = "$Date: 2004/09/14 17:28:46 $"
"""

from PythonCard import model

class Minimal(model.PageBackground):
    pass

if __name__ == '__main__':
    app = model.Application(Minimal)
    app.MainLoop()
コード例 #30
0
ファイル: wxCtrData.py プロジェクト: jackey-qiu/tdl
        pyplot.draw()
        pyplot.show()
        pyplot.ion()

    ######################################################
    def on_CorrPlot_mouseClick(self,event):
        self._plot_corr()
        
    def _plot_corr(self):
        # turn off interactive to speed up
        pyplot.ioff()

        ctr = self.get_ctr()
        if ctr == None: return
        point = int(self.components.PointNum.stringSelection)
        (scan,spnt) = ctr.get_scan(point)
        corr_params = ctr.corr_params[point]
        corr = ctr_data._get_corr(scan,spnt,corr_params)
        if ctr.scan_type[point] == 'image':
            corr.ctot_stationary(plot=True,fig=2)

        # show plot
        pyplot.draw()
        pyplot.show()
        pyplot.ion()

##################################################
if __name__ == '__main__':
    app = model.Application(wxCtrData)
    app.MainLoop()