def onViewOrb(self, event): sys_type = platform.system() selected = gen.get_Selection(self.lc) orbital = self.lc.GetItemText(selected[0]) basename = self.tc0.GetValue().split('/')[-1].split('.')[0] iso = self.tc4.GetValue() tu = (basename, orbital, iso) load_string = 'load {0}.xyz\n'.format(*tu) pos_iso = 'isoSurface pos {2} {0}.mo{1}a.cube\n'.format(*tu) neg_iso = 'isoSurface neg -{2} {0}.mo{1}a.cube\n'.format(*tu) with open('moplot.txt', 'w') as f: f.write(load_string) f.write(pos_iso) f.write(neg_iso) f.write('color $pos red\ncolor $neg blue\n') if self.status != 0: try: running = self.p.poll() if running == None: self.p.stdin.write('script moplot.txtt\n') self.p.stdin.close() except: print 'Problem exists with Jmol subprocess' if sys_type == 'Windows': self.p = Popen('jmol.jar -I -L -s moplot.txt', shell=True) self.status = 1 else: self.p = Popen('java -jar Jmol.jar -I -L -s moplot.txt', shell=True, stdout=PIPE, stdin=PIPE) self.status = 1
def onViewOrb(self, event): sys_type = platform.system() selected = gen.get_Selection(self.lc) orbital = self.lc.GetItemText(selected[0]) basename = self.tc0.GetValue().split('/')[-1].split('.')[0] iso = self.tc4.GetValue() tu = (basename, orbital, iso) load_string = 'load {0}.xyz\n'.format(*tu) pos_iso = 'isoSurface pos {2} {0}.mo{1}a.cube\n'.format(*tu) neg_iso = 'isoSurface neg -{2} {0}.mo{1}a.cube\n'.format(*tu) with open('moplot.txt','w') as f: f.write(load_string) f.write(pos_iso) f.write(neg_iso) f.write('color $pos red\ncolor $neg blue\n') if self.status != 0: try: running = self.p.poll() if running == None: self.p.stdin.write('script moplot.txtt\n') self.p.stdin.close() except: print 'Problem exists with Jmol subprocess' if sys_type == 'Windows': self.p = Popen('jmol.jar -I -L -s moplot.txt', shell=True) self.status = 1 else: self.p = Popen('java -jar Jmol.jar -I -L -s moplot.txt', shell=True, stdout=PIPE, stdin=PIPE) self.status = 1
def onDeleteServer(self,event,comp_list): selected = gen.get_Selection(self.server_lc) server = self.server_lc.GetItemText(selected[0]) try: con = lite.connect('cas.sqlite') cursor = con.cursor() q ="""DELETE FROM Servers WHERE name = '%s';""" %server print q con.execute(q) con.commit() except lite.Error, e: if con: con.rollback() print "Error %s:" % e.args[0] sys.exit(1)
def onDeleteServer(self, event, comp_list): selected = gen.get_Selection(self.server_lc) server = self.server_lc.GetItemText(selected[0]) try: con = lite.connect('cas.sqlite') cursor = con.cursor() q = """DELETE FROM Servers WHERE name = '%s';""" % server print q con.execute(q) con.commit() except lite.Error, e: if con: con.rollback() print "Error %s:" % e.args[0] sys.exit(1)
def onNewOrb(self, event): selected = gen.get_Selection(self.new_lc) self.neworb_tc.SetValue(self.new_lc.GetItemText(selected[0]))
def onOldOrb(self, event): selected = gen.get_Selection(self.active_lc) self.oldorb_tc.SetValue(self.active_lc.GetItemText(selected[0]))
def onNewOrb(self,event): selected = gen.get_Selection(self.new_lc) self.neworb_tc.SetValue(self.new_lc.GetItemText(selected[0]))
def onOldOrb(self,event): selected = gen.get_Selection(self.active_lc) self.oldorb_tc.SetValue(self.active_lc.GetItemText(selected[0]))