Exemple #1
0
 def create_dir(self, mode):
     client = library.connect(self.channel, self.port, self.mes_status,
                              [True])
     if client is False:
         return
     client.send(
         '[-1]eeprom string read(Uart_board, at16, 0x64, 12)\r\n'.encode(
             'utf-8'))
     response = client.recv(1024).decode('utf-8')
     client.close()
     start = response.find('("') + 2
     end = response.find('";DONE')
     fixture_id = response[start:end]
     temp_dir = fixture_id + '_' + mode
     if fixture_id in self.dir and mode not in self.dir:
         end = self.dir.rfind('/') + 1
         self.dir = self.dir[:end] + temp_dir
         if not os.path.exists(self.dir):
             os.mkdir(self.dir)
     elif fixture_id not in self.dir:
         if fixture_id[:3] in self.dir:
             end = self.dir.rfind('/')
             self.dir = self.dir[:end]
         self.dir = self.dir + '/' + temp_dir
         if not os.path.exists(self.dir):
             os.mkdir(self.dir)
Exemple #2
0
 def reboot_click(self):
     client = library.connect(self.channel, self.port, self.mes_status,
                              [True])
     client.send('[0]REBOOT()\r\n'.encode('utf-8'))
     time.sleep(3)
     i = 1
     while True:
         try:
             print('第%d次尝试连接ZYNQ板......' % i)
             client = library.connect(self.channel, self.port,
                                      self.mes_status, [True])
             client.send('[]SYS_DEFAULT()\r\n'.encode('utf-8'))
             response = client.recv(1024).decode('utf-8', 'ignore')
             if 'DONE' in response:
                 break
         except Exception as e:
             time.sleep(1)
             i += 1
     self.mes_status('重启' + self.channel + ' ZYNQ板成功!')
     return
Exemple #3
0
 def restart_click(self):
     client = library.connect(self.channel, self.port, self.mes_status,
                              [True])
     client.send('[0]RESTART()\r\n'.encode('utf-8'))
     i = 1
     while True:
         try:
             print('第%d次尝试连接cmd进程......' % i)
             client = library.connect(self.channel, self.port,
                                      self.mes_status, [True])
             client.send('[]SYS_DEFAULT()\r\n'.encode('utf-8'))
             response = client.recv(1024).decode('utf-8', 'ignore')
             if 'DONE' in response:
                 break
         except Exception as e:
             time.sleep(0.5)
             i += 1
     self.mes_status('重启' + self.channel + ':' + str(self.port) +
                     ' cmd进程成功!')
     return
def sample_database():
    check = lib.connect()
    if check == True:
        lib.create_tables()
        lib.initialize_data()
        if(hasattr(self,"parent") and self.parent!=None):
            self.parent.changed()
        MutableObject_interface.changed(self)


class ObjectListItem(Base):
    __tablename__ = 'ObjectList'
    name = Column(types.Unicode(255), nullable=False, primary_key=True)
    testObj=Column(MutableObject_interface.as_mutable(types.PickleType), nullable=True)

    def __init__(self,name):
        self.name=name
        self.testObj=None

if __name__ == '__main__':
    db=connect()

    print("insert testObj")
    testObj=ObjectListItem(u"testObj")
    db.insert(testObj)
    print db.session.dirty
    db.flushAndCommit()

    print("create MutableObserver")
    testM=MutableTree()
    child=MutableTree()
    child.data="test message"
    testM.addChild(child)
    testObj.testObj=testM
    print db.session.dirty
    db.flushAndCommit()
Exemple #6
0
def delete_func():
    library.delete_selected(int(selected_tuple[0]))
    view_func()


def update_func():
    index = selected_tuple[0]
    library.update_selected(entrie_values[0].get(), entrie_values[1].get(),
                            entrie_values[2].get(), entrie_values[3].get(),
                            index)
    view_func()


window = Tk()
library.connect()

label_text = ["Title", "Author", "Year", "ISBN"]
labels = []
entries = []
entrie_values = []

for i in range(0, len(label_text)):
    entrie_values.append(StringVar())
    labels.append(Label(window, text=label_text[i]))
    entries.append(Entry(window, textvariable=entrie_values[i]))

labels[0].grid(row=0, column=0)
labels[1].grid(row=0, column=2)
labels[2].grid(row=1, column=0)
labels[3].grid(row=1, column=2)