Beispiel #1
0
    def Quit_Wizard(self):

        try:
            # Delete Sphere object
            General_cmd.unmask_Objects(self.exc)
            cmd.config_mouse(self.config_mouse)

            cmd.delete(self.SphereDisplay)
            cmd.refresh()
        except:
            pass

        # Catch error in App
        if self.ErrorCode > 0:
            self.App.WizardError = True

        # Re-enable controls
        
        self.App.ActiveWizard = None

        cmd.set_wizard()
        cmd.set_view(self.View)
        cmd.refresh()
                
        self.queue.put(lambda: self.top.SphereRunning(False))
        self.queue.put(lambda: self.top.top.root.deiconify())
        self.queue.put(lambda: self.top.top.root.update())
Beispiel #2
0
    def Start(self):

        self.queue.put(lambda: self.FlexAID.root.withdraw())
        cmd.window('hide')
        cmd.window('show')
        # self.queue.put(lambda: cmd.window('show'))
        cmd.refresh_wizard()

        self.ErrorCode = 1

        try:
            self.selection_mode = cmd.get("mouse_selection_mode")
            cmd.set("mouse_selection_mode", 0) # set selection mode to atomic

            # Mask objects
            self.exc = [self.LigDisplay]
            General_cmd.mask_Objects(self.exc)

            self.ErrorCode = 0
            
        except:
            self.queue.put(lambda: self.FlexAID.DisplayMessage("  ERROR: Could not start the Anchor Atom wizard", 1))
            self.queue.put(lambda: self.FlexAID.DisplayMessage("         The wizard will abort prematurely", 1))
            self.Quit_Wizard()
            return

        # Display the ligand from the PDB file
        if self.DisplayLigand() or self.RefreshDisplay():
            self.queue.put(lambda: self.FlexAID.DisplayMessage("  ERROR: Could not display the ligand", 1))
            self.queue.put(lambda: self.FlexAID.DisplayMessage("         The wizard will abort prematurely", 1))
            self.Quit_Wizard()
            return
        
        # remove any possible selection before selecting atoms
        cmd.deselect()
Beispiel #3
0
    def Quit_Wizard(self):
        
        try:
            General_cmd.unmask_Objects(self.exc)
            cmd.set('mouse_selection_mode', self.selection_mode)

            cmd.delete(self.LigDisplay)
            cmd.refresh()
            
            cmd.deselect()
            
        except:
            pass
      
        if self.ErrorCode > 0:
            self.FlexAID.WizardError = True
        
        self.FlexAID.WizardResult = self.AnchorAtom
        self.FlexAID.ActiveWizard = None
        
        self.queue.put(lambda: self.top.AnchorRunning(False))
        self.queue.put(lambda: self.FlexAID.root.deiconify())
        self.queue.put(lambda: self.FlexAID.root.update())

        cmd.set_wizard()
        cmd.set_view(self.View)
        cmd.refresh()
Beispiel #4
0
    def Toggle_Step1(self, *args):
        
        Sel = self.Step1Selection.get()

        if Sel != '' and self.top.ActiveFrame == self:
            if General_cmd.object_Exists(Sel):
                self.Flash(Sel)
                self.Step1bBtn.config(state='normal')
                
                self.Center = General_cmd.Get_CenterOfMass2(Sel, state=1)
                self.Width = General_cmd.Get_MaxWidth(Sel, state=1)
                self.Cleft = self.top.Default.TempBindingSite.Get_CleftName(Sel)

            else:
                self.DisplayMessage("The cleft '" + Sel + "'no longer exists.", 2)
                self.Step1bBtn.config(state='disabled')
                
                self.update_Step1_DDL()                
                self.Step1Selection.set('')

        else:
            self.Step1bBtn.config(state='disabled')

        if self.Step1Selection.get() != self.LastStep1Selection.get():
            self.dictSpheres.clear()
            self.update_Spheres()

        self.LastStep1Selection.set(Sel)
Beispiel #5
0
    def Quit_Wizard(self):

        try:
            General_cmd.unmask_Objects(self.exc)
            cmd.set('mouse_selection_mode', self.selection_mode)

            cmd.delete(self.LigDisplay)
            cmd.refresh()

            cmd.deselect()

        except:
            pass

        if self.ErrorCode > 0:
            self.FlexAID.WizardError = True

        self.FlexAID.WizardResult = self.AnchorAtom
        self.FlexAID.ActiveWizard = None

        self.queue.put(lambda: self.top.AnchorRunning(False))
        self.queue.put(lambda: self.FlexAID.root.deiconify())
        self.queue.put(lambda: self.FlexAID.root.update())

        cmd.set_wizard()
        cmd.set_view(self.View)
        cmd.refresh()
Beispiel #6
0
    def Quit_Wizard(self):

        try:
            # Delete Sphere object
            General_cmd.unmask_Objects(self.exc)
            cmd.config_mouse(self.config_mouse)

            cmd.delete(self.SphereDisplay)
            cmd.refresh()
        except:
            pass

        # Catch error in App
        if self.ErrorCode > 0:
            self.App.WizardError = True

        # Re-enable controls

        self.App.ActiveWizard = None

        cmd.set_wizard()
        cmd.set_view(self.View)
        cmd.refresh()

        self.queue.put(lambda: self.top.SphereRunning(False))
        self.queue.put(lambda: self.top.top.root.deiconify())
        self.queue.put(lambda: self.top.top.root.update())
Beispiel #7
0
    def Start(self):

        # self.queue.put(lambda: self.top.top.root.withdraw())
        cmd.window('hide')
        cmd.refresh_wizard()
        cmd.orient()
        cmd.window('show')
        # self.queue.put(lambda: cmd.window('show'))
        self.ErrorCode = 1

        try:
            self.State = cmd.get_state()
            self.config_mouse = General_cmd.get_config_mouse()
            cmd.config_mouse('three_button_editing')
        
            self.exc = [ self.SphereDisplay ]
            General_cmd.mask_Objects(self.exc)

            # success
            self.ErrorCode = 0

        except:
            self.queue.put(lambda: self.App.DisplayMessage("  ERROR: Could not start the Sphere wizard", 1))
            self.queue.put(lambda: self.App.DisplayMessage("         The wizard will abort prematurely", 1))
            self.Quit_Wizard()
            return
            
        if self.DisplaySphere():
            self.queue.put(lambda: self.App.DisplayMessage("  ERROR: Could not display the Sphere", 1))
            self.queue.put(lambda: self.App.DisplayMessage("         The wizard will abort prematurely", 1))
            self.Quit_Wizard()
            return
Beispiel #8
0
    def Create_NewSphere(self):

        Center = General_cmd.Get_CenterOfMass2(self.TargetName, cmd.get_state())
        Width = General_cmd.Get_MaxWidth(self.TargetName, cmd.get_state())

        if len(Center) > 0 and Width != -1:
            self.Vars.BindingSite.Sphere = SphereObj.SphereObj(Width/4.0,Width/2.0,Center)
            self.sclResizeSphere.config(from_=0.5,to=self.Vars.BindingSite.Sphere.MaxRadius)
            self.SphereSize.set(self.Vars.BindingSite.Sphere.Radius)
        else:
            self.DisplayMessage("  ERROR: Could not display the default sphere", 1)
            self.RngOpt.set('')
Beispiel #9
0
    def Start(self):

        self.queue.put(lambda: self.FlexAID.root.withdraw())
        cmd.window('hide')
        cmd.window('show')
        # self.queue.put(lambda: cmd.window('show'))
        cmd.refresh_wizard()

        self.ErrorCode = 1        

        try:
            #self.selection_mode = cmd.get_setting_legacy("mouse_selection_mode")
            self.selection_mode = cmd.get("mouse_selection_mode")
            cmd.set("mouse_selection_mode", 0) # set selection mode to atomic

            # Mask objects
            self.exc = [self.LigDisplay, self.PossFlexDisplay, self.SelFlexDisplay]
            General_cmd.mask_Objects(self.exc)

            self.ErrorCode = 0

        except:
            self.queue.put(lambda: self.top.DisplayMessage("  ERROR: Could not start the Flexible Bonds wizard", 1))
            self.queue.put(lambda: self.top.DisplayMessage("         The wizard will abort prematurely", 1))
            self.Quit_Wizard()
            return

        # Display the ligand from the PDB file
        if self.DisplayLigand():
            self.queue.put(lambda: self.top.DisplayMessage("  ERROR: Could not display the ligand", 1))
            self.queue.put(lambda: self.top.DisplayMessage("         The wizard will abort prematurely", 1))
            self.Quit_Wizard()
            return

        # Display all Possible Flexible Bonds
        if self.show_FlexibleBonds():
            self.queue.put(lambda: self.top.DisplayMessage("  ERROR: Could not display the flexible bonds", 1))
            self.queue.put(lambda: self.top.DisplayMessage("         The wizard will abort prematurely", 1))
            self.Quit_Wizard()
            return

        # Display all Selected Flexible Bonds
        if self.show_SelectedBonds():
            self.queue.put(lambda: self.top.DisplayMessage("  ERROR: Could not display the selected flexible bonds", 1))
            self.queue.put(lambda: self.top.DisplayMessage("         The wizard will abort prematurely", 1))
            self.Quit_Wizard()
            return
        
        # remove any possible selection before selecting atoms
        cmd.deselect()
        cmd.unpick()
Beispiel #10
0
    def do_select(self, name):

        if self.pick_count < 1:
            self.atom1 = self.get_Atom(name)

            if len(self.atom1) > 0:
                if int(self.atom1[2]) == self.ResSeq and self.atom1[1] == 'LIG':
                    self.pickNextAtom()
                    self.highlight_Atom(self.atom1)
                else:
                    self.ErrorStatus = [ "You can only select atoms from the object " + self.LigDisplay + ". Try again." ]
            else:
                self.ErrorStatus = [ "No atoms could be selected in the object " + self.LigDisplay + ". Try again." ]

        else:
            self.atom2 = self.get_Atom(name)

            if len(self.atom2) > 0:
                if int(self.atom2[2]) == self.ResSeq and self.atom2[1] == 'LIG':
                    self.pickNextAtom()
                    self.highlight_Atom(self.atom2)

                    if not self.is_Valid(self.atom1, self.atom2):
                        self.ErrorStatus = [ "The selected bond cannot be set as flexible. Try again." ]
                    else:
                        # Already existing Possible Bond
                        if self.FlexIndex != 0:
                            if self.dictFlexBonds[self.FlexIndex][0]:
                                self.dictFlexBonds[self.FlexIndex][0] = 0
                            else:
                                self.dictFlexBonds[self.FlexIndex][0] = 1

                        # Force new bond
                        else:
                            self.Force_NewBond(General_cmd.get_ID(self.atom1[0], self.LigDisplay), 
                                               General_cmd.get_ID(self.atom2[0], self.LigDisplay))

                    self.show_SelectedBonds()
                    self.pick_count = 0

                    cmd.refresh_wizard()
                    cmd.delete(self.AtomDisplay)                    
                    cmd.refresh()

                else:
                    self.ErrorStatus = [ "No atoms could be selected in the object " + self.LigDisplay + ". Try again." ]
            
            else:
                self.ErrorStatus = [ "You can only select atoms from the object " + self.LigDisplay + ". Try again." ]
Beispiel #11
0
    def After_Show(self):

        self.Btn_RefreshOptMenu_Clicked()

        if self.LastdefaultOption != '' and General_cmd.object_Exists(
                self.LastdefaultOption):
            self.defaultOption.set(self.LastdefaultOption)
Beispiel #12
0
    def Toggle_Step1(self, *args):
        
        Sel = self.Step1Selection.get()

        if Sel != '' and self.top.ActiveFrame == self:
            if General_cmd.object_Exists(Sel):
                self.Flash(Sel)
                self.Step1bBtn.config(state='normal')
                
                self.Center = General_cmd.Get_CenterOfMass2(Sel, state=1)
                self.Width = General_cmd.Get_MaxWidth(Sel, state=1)
                self.Cleft = self.top.Default.TempBindingSite.Get_CleftName(Sel)

            else:
                self.DisplayMessage("The cleft '" + Sel + "'no longer exists.", 2)
                self.Step1bBtn.config(state='disabled')
                
                self.update_Step1_DDL()                
                self.Step1Selection.set('')

        else:
            self.Step1bBtn.config(state='disabled')

        if self.Step1Selection.get() != self.LastStep1Selection.get():
            self.dictSpheres.clear()
            self.update_Spheres()

        self.LastStep1Selection.set(Sel)
Beispiel #13
0
    def displayPartition(self):

        auto_zoom = cmd.get("auto_zoom")

        try:
            cmd.delete(self.PartitionDisplay)
            cmd.refresh()
        except:
            pass
            
        try:
            cmd.set("auto_zoom", 0)
            
            cmd.load(self.TempPartition, self.PartitionDisplay, format='pdb')
            cmd.refresh()

            cmd.hide('everything', self.PartitionDisplay)
            cmd.refresh()

            cmd.show('surface', self.PartitionDisplay)
            cmd.refresh()

            cmd.color('grey60', self.PartitionDisplay)
            cmd.refresh()
            
            General_cmd.Oscillate(self.Cleft.CleftName, 0.0)

        except:
            self.top.DisplayMessage("  ERROR: An error occured while displaying the partitionned cleft", 1)

        cmd.set("auto_zoom", auto_zoom)
Beispiel #14
0
    def CenterSphere(self, sel):

        if not self.top.WizardRunning():
            return

        Center = General_cmd.Get_CenterOfMass2(sel, cmd.get_state())

        if len(Center) > 0:
            self.top.ActiveWizard.SphereView.Set_Center(Center)
            self.top.ActiveWizard.DisplaySphere()
            self.defOptSphere.set(sel)
Beispiel #15
0
    def btn_Done(self):

        Center = General_cmd.Get_CenterOfMass2(self.SphereDisplay, self.State)
        if len(Center) > 0:
            self.SphereView.Set_Center(Center)

        self.Sphere.Set_Radius(self.SphereView.Radius)
        self.Sphere.Set_Center(self.SphereView.Center)

        self.App.WizardResult = 2
        self.Quit_Wizard()
Beispiel #16
0
    def is_Valid(self, atom1, atom2):

        # 2 hydrogens
        if atom1[4].strip()[0] == 'H' and atom2[4].strip()[0] == 'H':
            return 0
        # Distance is too far
        elif Geometry.distance(atom1[5:],atom2[5:]) > 2.0:
            return 0

        self.FlexIndex = self.is_Flexible(General_cmd.get_ID(atom1[0], self.LigDisplay), 
                                          General_cmd.get_ID(atom2[0], self.LigDisplay))

        # The bond cannot be defined
        if self.FlexIndex == -1:
            return 0
        # The bond can only be defined using force
        elif self.FlexIndex == 0 and not self.Force:
            return 0

        return 1
Beispiel #17
0
    def do_select(self, name):


        lt = cmd.index(name + ' &  !hydrogens')

        for t in lt:
            if t[0] != self.LigDisplay:
                self.ErrorStatus = [ "You can only select a non-Hydrogen from the object " + self.LigDisplay + ". Try again." ]
            else:
                self.AnchorAtom = General_cmd.get_ID(t[1],t[0])
                self.RefreshDisplay()
            break
        cmd.deselect()
Beispiel #18
0
    def Start(self):

        self.queue.put(lambda: self.FlexAID.root.withdraw())
        cmd.window('hide')
        cmd.window('show')
        # self.queue.put(lambda: cmd.window('show'))
        cmd.refresh_wizard()

        self.ErrorCode = 1

        try:
            self.selection_mode = cmd.get("mouse_selection_mode")
            cmd.set("mouse_selection_mode", 0)  # set selection mode to atomic

            # Mask objects
            self.exc = [self.LigDisplay]
            General_cmd.mask_Objects(self.exc)

            self.ErrorCode = 0

        except:
            self.queue.put(lambda: self.FlexAID.DisplayMessage(
                "  ERROR: Could not start the Anchor Atom wizard", 1))
            self.queue.put(lambda: self.FlexAID.DisplayMessage(
                "         The wizard will abort prematurely", 1))
            self.Quit_Wizard()
            return

        # Display the ligand from the PDB file
        if self.DisplayLigand() or self.RefreshDisplay():
            self.queue.put(lambda: self.FlexAID.DisplayMessage(
                "  ERROR: Could not display the ligand", 1))
            self.queue.put(lambda: self.FlexAID.DisplayMessage(
                "         The wizard will abort prematurely", 1))
            self.Quit_Wizard()
            return

        # remove any possible selection before selecting atoms
        cmd.deselect()
Beispiel #19
0
    def Load_Clefts(self):

        auto_zoom = cmd.get("auto_zoom")
        cmd.set("auto_zoom", 0)

        # for Cleft in self.TempBindingSite.listClefts:
        for CleftName in self.TempBindingSite.Get_SortedCleftNames():
            Cleft = self.TempBindingSite.Get_CleftName(CleftName)
            try:
                cmd.load(Cleft.CleftFile, Cleft.CleftName, state=1)
                cmd.refresh()

                if Cleft.Partition and Cleft.PartitionParent != None and \
                        General_cmd.object_Exists(Cleft.PartitionParent.CleftName):

                    General_cmd.Oscillate(Cleft.PartitionParent.CleftName, 0.0)
            except:
                self.top.DisplayMessage(
                    "  ERROR: Failed to load cleft object '" +
                    Cleft.CleftName + "'", 2)
                continue

        cmd.set("auto_zoom", auto_zoom)
Beispiel #20
0
    def Start(self):

        # self.queue.put(lambda: self.top.top.root.withdraw())
        cmd.window('hide')
        cmd.refresh_wizard()
        cmd.orient()
        cmd.window('show')
        # self.queue.put(lambda: cmd.window('show'))
        self.ErrorCode = 1

        try:
            self.State = cmd.get_state()
            self.config_mouse = General_cmd.get_config_mouse()
            cmd.config_mouse('three_button_editing')

            self.exc = [self.SphereDisplay]
            General_cmd.mask_Objects(self.exc)

            # success
            self.ErrorCode = 0

        except:
            self.queue.put(lambda: self.App.DisplayMessage(
                "  ERROR: Could not start the Sphere wizard", 1))
            self.queue.put(lambda: self.App.DisplayMessage(
                "         The wizard will abort prematurely", 1))
            self.Quit_Wizard()
            return

        if self.DisplaySphere():
            self.queue.put(lambda: self.App.DisplayMessage(
                "  ERROR: Could not display the Sphere", 1))
            self.queue.put(lambda: self.App.DisplayMessage(
                "         The wizard will abort prematurely", 1))
            self.Quit_Wizard()
            return
Beispiel #21
0
    def Quit_Wizard(self):
        
        try:
            
            #Delete the Residue objects
            cmd.delete(self.FlexSCDisplay)
            cmd.refresh()

            cmd.delete(self.ResidueDisplay)
            cmd.refresh()

            #cmd.delete(self.BackboneDisplay)
            #cmd.refresh()
            
        except:
            pass
            
        if self.ErrorCode != 1:
            General_cmd.unmask_Objects(self.exc)
            cmd.set('mouse_selection_mode', self.selection_mode)
            #cmd.config_mouse('three_button_editing', 1)

        if self.ErrorCode > 0:
            self.FlexAID.WizardError = True

        self.FlexAID.WizardResult = self.TargetFlex.Count_SideChain()

        self.queue.put(lambda: self.top.FlexSCRunning(False))
        self.FlexAID.ActiveWizard = None
        
        self.queue.put(lambda: self.FlexAID.root.deiconify())
        self.queue.put(lambda: self.FlexAID.root.update())

        cmd.set_wizard()
        cmd.set_view(self.View)
        cmd.refresh()
Beispiel #22
0
    def Start(self):
        
        self.queue.put(lambda: self.FlexAID.root.withdraw())
        cmd.window('hide')
        cmd.window('show')
        # self.queue.put(lambda: cmd.window('show'))
        cmd.refresh_wizard()

        # Display all Selected Flexible Bonds
        if self.show_SelectedSC():
            self.queue.put(lambda: self.FlexAID.DisplayMessage("  ERROR: Could not display selected flexible side-chains", 1))
            self.Quit_Wizard()
            return

        #self.selection_mode = cmd.get_setting_legacy("mouse_selection_mode")
        self.selection_mode = cmd.get("mouse_selection_mode")
        cmd.set("mouse_selection_mode", 1) # set selection mode to residue

        # Mask objects
        self.exc = [ self.TargetName ]
        General_cmd.mask_Objects(self.exc)
        
        if General_cmd.object_Exists(self.FlexAID.Config1.BindingSiteDisplay):
            cmd.zoom(self.FlexAID.Config1.BindingSiteDisplay)
        else:
            cmd.zoom(self.TargetName)


        # remove any possible selection before selecting atoms
        cmd.deselect()
              
        self.ErrorCode += 1
        
        
    #=======================================================================
        ''' update_SelectedSC : updates the view of selected flexible sc. ''' 
Beispiel #23
0
    def do_select(self, name):

        lt = cmd.index(name + ' &  !hydrogens')

        for t in lt:
            if t[0] != self.LigDisplay:
                self.ErrorStatus = [
                    "You can only select a non-Hydrogen from the object " +
                    self.LigDisplay + ". Try again."
                ]
            else:
                self.AnchorAtom = General_cmd.get_ID(t[1], t[0])
                self.RefreshDisplay()
            break
        cmd.deselect()
Beispiel #24
0
    def Btn_DisplayObject_Clicked(self, objtype):

        self.Set_Object_Variables(objtype)

        if self.VarName.get() != '':
            try:
                if not General_cmd.object_Exists(self.VarName.get()):
                    cmd.load(self.VarPath.get(), state=1)
                    cmd.refresh()
                else:                    
                    cmd.zoom(self.VarName.get())    
                    cmd.refresh()
            except:
                self.VarName.set('')
                self.VarPath.set('')
                self.VarProc.set('')
                self.top.SaveSessionFile = ''
                
                self.DisplayMessage("  ERROR: An error occured while displaying the object.", 1)
Beispiel #25
0
 def Load_Clefts(self):
         
     auto_zoom = cmd.get("auto_zoom")
     cmd.set("auto_zoom", 0)
     
     # for Cleft in self.TempBindingSite.listClefts:
     for CleftName in self.TempBindingSite.Get_SortedCleftNames():
             Cleft = self.TempBindingSite.Get_CleftName(CleftName)
             try:
                 cmd.load(Cleft.CleftFile, Cleft.CleftName, state=1)
                 cmd.refresh()
                 
                 if Cleft.Partition and Cleft.PartitionParent != None and \
                         General_cmd.object_Exists(Cleft.PartitionParent.CleftName):
                     
                     General_cmd.Oscillate(Cleft.PartitionParent.CleftName, 0.0)
             except:
                 self.top.DisplayMessage("  ERROR: Failed to load cleft object '" + Cleft.CleftName + "'", 2)
                 continue
                 
     cmd.set("auto_zoom", auto_zoom)
Beispiel #26
0
    def Btn_DisplayObject_Clicked(self, objtype):

        self.Set_Object_Variables(objtype)

        if self.VarName.get() != '':
            try:
                if not General_cmd.object_Exists(self.VarName.get()):
                    cmd.load(self.VarPath.get(), state=1)
                    cmd.refresh()
                else:
                    cmd.zoom(self.VarName.get())
                    cmd.refresh()
            except:
                self.VarName.set('')
                self.VarPath.set('')
                self.VarProc.set('')
                self.top.SaveSessionFile = ''

                self.DisplayMessage(
                    "  ERROR: An error occured while displaying the object.",
                    1)
Beispiel #27
0
    def get_Coords(self, atom_number, point):

        found = False

        try:
            atom_number = int(atom_number)

            atoms = cmd.get_model(self.LigDisplay, state=cmd.get_state())
            for at in atoms.atom:
                
                if General_cmd.get_ID(at.index, self.LigDisplay) == atom_number:
                    point.extend([at.coord[0],at.coord[1],at.coord[2]])
                    found = True
                    break

            if not found:
                return 1

        except:
            return 1

        return 0
Beispiel #28
0
    def Btn_RefreshOptMenu_Clicked(self):

        if self.PyMOL:
            exc = []
            General_cmd.Refresh_DDL(self.optionMenuWidget, self.defaultOption,
                                    exc, None)
Beispiel #29
0
 def Update_TempBindingSite(self):
     
     self.TempBindingSite.listClefts = \
         [ Cleft for Cleft in self.TempBindingSite.listClefts \
             if General_cmd.object_Exists(Cleft.CleftName) ]
Beispiel #30
0
 def After_Show(self):
                     
     self.Btn_RefreshOptMenu_Clicked()
     
     if self.LastdefaultOption != '' and General_cmd.object_Exists(self.LastdefaultOption):
         self.defaultOption.set(self.LastdefaultOption)
Beispiel #31
0
    def Btn_OptSphRefresh_Clicked(self):

        exc = [ self.BindingSiteDisplay, self.SphereDisplay ]
        General_cmd.Refresh_DDL(self.OptMenuSphere,self.defOptSphere,exc,self.CenterSphere)
Beispiel #32
0
    def Btn_CreatePartition(self):

        DestFile = ''
        Output = self.Step3Output.get()
        
        if General.validate_String(Output, '', False, False, True):
            self.DisplayMessage("  ERROR: Could not save the partition file because you entered an invalid name.", 2)
            return

        auto_zoom = cmd.get("auto_zoom")

        if Output != '':
            
            if not self.Vertex:
                self.top.DisplayMessage("  ERROR: Cannot save an empty cleft. Add spheres that include volume of the parent.", 1)
                return
            
            if General_cmd.object_Exists(Output):
                answer = tkMessageBox.askquestion("Question", 
                                                  message="An object with that name already exists. Would you like to overwrite it?",
                                                  icon='warning')
                if str(answer) == 'no':
                    return
                
            try:
                cmd.set("auto_zoom", 0)
                
                DestFile = os.path.join(self.top.GetCleftTempProject_Dir, Output + '.pdb')
                self.top.Manage.copy_TempPartition(self.TempPartition, DestFile)
                
                cmd.load(DestFile, Output, state=1)
                cmd.refresh()
                
                cmd.hide('everything', Output)
                cmd.refresh()

                cmd.show('surface', Output)
                cmd.refresh()
                
                partition_rgb = self.top.Default.SetPartitionColor(self.Cleft.CleftName)
                
                if len(partition_rgb):
                
                    cmd.color('partition', Output)
                    cmd.refresh()

                    cmd.delete(self.PartitionDisplay)
                    cmd.refresh()
                    
                    Cleft = CleftObj.CleftObj()
                    Cleft.CleftFile = DestFile
                    Cleft.CleftName = self.Step3Output.get()
                    Cleft.PartitionParent = self.Cleft
                    Cleft.Partition = True
                    Cleft.UTarget = self.Cleft.UTarget
                    Cleft.Set_CleftMD5()
                    Cleft.Color = General.rgb_to_hex(partition_rgb)
                    
                    self.top.Default.TempBindingSite.Add_Cleft(Cleft)
                    self.top.CopySession = False

                    # Put the partition cleft over its parent
                    General_cmd.Oscillate(self.Cleft.CleftName, 0.0)

                    self.Reset_Step1()
                    
                else:
                    self.top.DisplayMessage("  ERROR: Cleft '" + self.Cleft.CleftName + "' could not be found to set partition color", 1)

            except:
                self.top.DisplayMessage("  ERROR: Could not create partition object: File not found.", 1)
                
        else:
            self.top.DisplayMessage("  ERROR: Could not create partition object: Output is null.", 1)
            
        cmd.set("auto_zoom", auto_zoom)
Beispiel #33
0
    def Update_TempBindingSite(self):

        self.TempBindingSite.listClefts = \
            [ Cleft for Cleft in self.TempBindingSite.listClefts \
                if General_cmd.object_Exists(Cleft.CleftName) ]
Beispiel #34
0
    def Flash(self, Sel):

        for i in range(0, 8):
            General_cmd.Oscillate(Sel, 0.025)
Beispiel #35
0
    def Btn_CreatePartition(self):

        DestFile = ''
        Output = self.Step3Output.get()
        
        if General.validate_String(Output, '', False, False, True):
            self.DisplayMessage("  ERROR: Could not save the partition file because you entered an invalid name.", 2)
            return

        auto_zoom = cmd.get("auto_zoom")

        if Output != '':
            
            if not self.Vertex:
                self.top.DisplayMessage("  ERROR: Cannot save an empty cleft. Add spheres that include volume of the parent.", 1)
                return
            
            if General_cmd.object_Exists(Output):
                answer = tkMessageBox.askquestion("Question", 
                                                  message="An object with that name already exists. Would you like to overwrite it?",
                                                  icon='warning')
                if str(answer) == 'no':
                    return
                
            try:
                cmd.set("auto_zoom", 0)
                
                DestFile = os.path.join(self.top.GetCleftTempProject_Dir, Output + '.pdb')
                self.top.Manage.copy_TempPartition(self.TempPartition, DestFile)
                
                cmd.load(DestFile, Output, state=1)
                cmd.refresh()
                
                cmd.hide('everything', Output)
                cmd.refresh()

                cmd.show('surface', Output)
                cmd.refresh()
                
                partition_rgb = self.top.Default.SetPartitionColor(self.Cleft.CleftName)
                
                if len(partition_rgb):
                
                    cmd.color('partition', Output)
                    cmd.refresh()

                    cmd.delete(self.PartitionDisplay)
                    cmd.refresh()
                    
                    Cleft = CleftObj.CleftObj()
                    Cleft.CleftFile = DestFile
                    Cleft.CleftName = self.Step3Output.get()
                    Cleft.PartitionParent = self.Cleft
                    Cleft.Partition = True
                    Cleft.UTarget = self.Cleft.UTarget
                    Cleft.Set_CleftMD5()
                    Cleft.Color = General.rgb_to_hex(partition_rgb)
                    
                    self.top.Default.TempBindingSite.Add_Cleft(Cleft)
                    self.top.CopySession = False

                    # Put the partition cleft over its parent
                    General_cmd.Oscillate(self.Cleft.CleftName, 0.0)

                    self.Reset_Step1()
                    
                else:
                    self.top.DisplayMessage("  ERROR: Cleft '" + self.Cleft.CleftName + "' could not be found to set partition color", 1)

            except:
                self.top.DisplayMessage("  ERROR: Could not create partition object: File not found.", 1)
                
        else:
            self.top.DisplayMessage("  ERROR: Could not create partition object: Output is null.", 1)
            
        cmd.set("auto_zoom", auto_zoom)
Beispiel #36
0
    def Btn_RefreshOptMenu_Clicked(self):

        General_cmd.Refresh_DDL(self.optionMenuWidget, self.defaultOption, [],
                                None)