コード例 #1
0
ファイル: wxmsw.py プロジェクト: badbytes/pymeg
    def du(self, event): # wxGlade: MyFrame.<event_handler>
        print "Event handler `projectdu'"
        stats = projectdu.diskused()
        self.DU = self.tree_ctrl_1.AppendItem(self.USER, 'DiskUsage')
        self.tree_ctrl_1.Expand(self.USER)
        for i in range(0, len(stats)):
            self.du = self.tree_ctrl_1.AppendItem(self.DU, str(stats.items()[i]))
        self.SetStatusText("Disk Usage: %s" % os.environ['USER']+':'+str(stats['% Free']), 0)
        if stats['% Free'] < 10: #warning
            if stats['% Free'] <= 0: #warning
                dlg = wx.MessageDialog(self, 'disk usage error. Youve exceeded your allotment', 'Disk Hog!', wx.OK|wx.ICON_ERROR)
                dlg.ShowModal()
                dlg.Destroy()
                pylock.rmapelink()
                projectdu.plotdu()

                return -1
            else:
                pylock.apelink()
                dlg = wx.MessageDialog(self, 'Your about to loose acquisition ability. Disk Close to Full', 'move your sh**', wx.OK|wx.ICON_WARNING)
                dlg.ShowModal()
                dlg.Destroy()
                projectdu.plotdu()

                print 'mak'
                return 2
        else:
            pylock.apelink()
            print 'making links'
コード例 #2
0
ファイル: wxmsw.py プロジェクト: badbytes/pymeg
    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()
コード例 #3
0
ファイル: wxmsw.py プロジェクト: badbytes/pymeg
    def lockstate(self):
        print 'checking lock'
        checklockstatus = pylock.checklock()

        if checklockstatus == 0:
            self.SetStatusText("database lock: %s" % os.environ['USER'], 1)
            self.toolbar.SetToolNormalBitmap(103, wx.Bitmap("lock.png"))
            self.toolbar.ToggleTool(103, True)
            return 0
        if checklockstatus == -1:
            self.SetStatusText("database lock error:", 1)
            self.toolbar.ToggleTool(103, False)
            self.toolbar.SetToolNormalBitmap(103, wx.Bitmap("lock-broken.png"))
            print 'lock error test'

            return -1
        if checklockstatus == 1:
            self.SetStatusText("database new lock: %s" % os.environ['USER'], 1)
            #self.toolbar.SetToolNormalBitmap(103, wx.Bitmap("lock.png"))
            self.toolbar.ToggleTool(103, True)
            return 1
        if checklockstatus == 2:
            self.SetStatusText("database new lock: %s" % os.environ['USER'], 1)
            self.toolbar.SetToolNormalBitmap(103, wx.Bitmap("lock.png"))
            self.toolbar.ToggleTool(103, True)
            return 2
        if self.du('Null') == -1: #disk full
            pylock.rmapelink()
            dlg = wx.MessageDialog(self, 'Lock Error. Disk Full', 'mswdblock disk error.', wx.OK|wx.ICON_ERROR)
            dlg.ShowModal()
            dlg.Destroy()
            return -2
        if self.du('Null') == 2:
            dlg = wx.MessageDialog(self, 'Your about to loose acquisition ability. Disk Close to Full', 'move your stuff', wx.OK|wx.ICON_ERROR)
            dlg.ShowModal()
            dlg.Destroy()
            print 'something'

        print 'check lock status is',checklockstatus