Source code for Backup

"""
:filename:     Backup.py
:author:       thor@tordivel.no
:requirements: Scorpion 9.0.0.493 or higher

Scorpion plugin starting backup operation

::

  1.0.0.2, 11nov2015, RL: modified for autodoc
  1.0.0.1, 17sep2011, RL: requirements Scorpion 9.0.0.493 or higher

"""

__version__ = '1.0.0.2'

from Scorpion import PluginNotify,GetControlByHandle,ExecuteCmd,GetTool,SelectTagname,InputStr

[docs]class Backup(object): ''' Simple control with a button for starting Backup operation ''' def __init__(self,cntr,name): self.name=name cntr.deleteControls() #delete previous added controls if any self.button=cntr.addControl('Button',0,0) self.button.left=10 self.button.top=10 self.button.align = 5 self.button.anchors = 2 self.button.caption='Backup' self.button.font.bold=1 self.button.onClick=self.buttonClick def __del__(self): #print self,'__del__' pass
[docs] def __str__(self): ''' return a unique persistance name for host application storage ''' return '%s_%s'%(self.__class__.__name__,self.name)
[docs] def buttonClick(self,sender,args): ''' button click handler ''' if sender==self.button: ok,str0 = InputStr('Backup','Comment','') if ok : ExecuteCmd('Backup','comment='+str0)
[docs]def CreatePlugin(hWnd, name=''): ''' Scorpion Plugin Stub - Required ''' cntr=GetControlByHandle(hWnd) return Backup(cntr,name)