Exemplo n.º 1
0
    def lockdb(self, event): # wxGlade: MyFrame.<event_handler>
        print "Event handler `lockdb'"
        lockstatus = self.lockstate()
        print 'lock status now',lockstatus
        if lockstatus == -2: #disk full
            #mv Colorado_Aug2004.confi Colorado_Aug2004.config
            pylock.rmapelink()
            dlg = wx.MessageDialog(self, 'Lock Error. Disk Full', 'mswdblock disk error.', wx.OK|wx.ICON_ERROR)
            dlg.ShowModal()
            dlg.Destroy()
        #else:
        #    pylock.apelink()

        if lockstatus == 0:
            dlg = wx.MessageDialog(self, 'Your the Owner of the current lock.', 'mswdblock ok.', wx.OK|wx.ICON_INFORMATION)
            #pylock.newlock()
            #pylock.dbmklink()
            #pylock.mkdatalinks(os.environ['MSWDATA']+os.environ['USER']+'_data0', os.environ['MSWEXPORT']+os.environ['USER'])#+'_od10')
            dlg.ShowModal()
            dlg.Destroy()

        if lockstatus == -1:
            dlg = wx.MessageDialog(self, 'Lock Error. Cant override current lock', 'mswdblock error.', wx.OK|wx.ICON_ERROR)
            dlg.ShowModal()
            dlg.Destroy()

        if lockstatus == 1:
            dlg = wx.MessageDialog(self, 'Creating new lock.', 'mswdblock new.', wx.OK|wx.ICON_INFORMATION)
            pylock.newlock()
            pylock.dbmklink()
            pylock.mkdatalinks(os.environ['MSWDATA']+os.environ['USER']+'_data0', os.environ['MSWEXPORT']+os.environ['USER'])#+'_od10')
            dlg.ShowModal()
            dlg.Destroy()
        if lockstatus == 2:
            dlg = wx.MessageDialog(self, 'Overriding stale lock.', 'mswdblock killandstart', wx.OK|wx.ICON_INFORMATION)
            pylock.lockremove()
            pylock.newlock()
            pylock.dbrmlink()
            pylock.dbmklink()
            pylock.mkdatalinks(os.environ['MSWDATA']+os.environ['USER']+'_data0', os.environ['MSWEXPORT']+os.environ['USER'])#+'_od10')
            dlg.ShowModal()
            dlg.Destroy()
Exemplo n.º 2
0
 def unlockdb(self, event): # wxGlade: MyFrame.<event_handler>
     print "Event handler `unlockdb'"
     pylock.lockremove()
     self.SetStatusText("database lock removed: %s" % os.environ['USER'], 1)
     pylock.dbrmlink()
     pylock.rmdatalinks()