rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
del self.old._v_is_cp
del self.new._v_is_cp
def migrate_references(self): """Migrate references annotation.""" # Restor the references annotation if hasattr(self, REFERENCE_ANNOTATION): at_references = getattr(self, REFERENCE_ANNOTATION) setattr(self.new, REFERENCE_ANNOTATION, at_references) # Run the reference manage_afterAdd to transition all copied # references is_cp = getattr(self.old, '_v_is_cp', _marker) self.new._v_is_cp = 0 Referenceable.manage_afterAdd(self.new, self.new, self.new.getParentNode()) if is_cp is not _marker: self.old._v_is_cp = is_cp else: del self.old._v_is_cp
def get_ole_storages(filename): STORAGES = {}
def get_ole_streams(filename): STREAMS = {}
def get_ole_storages(filename): STORAGES = {} doc = file(filename, 'rb').read() header, data = doc[0:512], doc[512:] del doc doc_magic = header[0:8] file_uid = header[8:24] rev_num = header[24:26] ver_num = header[26:28] byte_order = header[28:30] log_sect_size, = struct.unpack('<H', header[30:32]) log_short_sect_size, = struct.unpack('<H', header[32:34]) total_sat_sectors, = struct.unpack('<L', header[44:48]) dir_start_sid, = struct.unpack('<l', header[48:52]) min_stream_size, = struct.unpack('<L', header[56:60]) ssat_start_sid, = struct.unpack('<l', header[60:64]) total_ssat_sectors, = struct.unpack('<L', header[64:68]) msat_start_sid, = struct.unpack('<l', header[68:72]) total_msat_sectors, = struct.unpack('<L', header[72:76]) MSAT = struct.unpack('<109l', header[76:]) sect_size = 1 << log_sect_size short_sect_size = 1 << log_short_sect_size SECTORS = [] i = 0 while i < len(data): SECTORS.append(data[i:i+sect_size]) i += sect_size #del data total_sectors = len(SECTORS) print 'file magic: ' print_bin_data(doc_magic) print print 'file uid: ' print_bin_data(file_uid) print print 'revision number: ' print_bin_data(rev_num) print print 'version number: ' print_bin_data(ver_num) print print 'byte order: ' print_bin_data(byte_order) print print 'sector size :', hex(sect_size), sect_size print 'total sectors in file :', hex(total_sectors), total_sectors print 'short sector size :', hex(short_sect_size), short_sect_size print 'Total number of sectors used for the SAT :', hex(total_sat_sectors), total_sat_sectors print 'SID of first sector of the directory stream:', hex(dir_start_sid), dir_start_sid print 'Minimum size of a standard stream :', hex(min_stream_size), min_stream_size print 'SID of first sector of the SSAT :', hex(ssat_start_sid), ssat_start_sid print 'Total number of sectors used for the SSAT :', hex(total_ssat_sectors), total_ssat_sectors print 'SID of first additional sector of the MSAT :', hex(msat_start_sid), msat_start_sid print 'Total number of sectors used for the MSAT :', hex(total_msat_sectors), total_msat_sectors print 'MSAT (only header part): \n', MSAT MSAT_2nd = [] next = msat_start_sid while next > 0: msat_sector = struct.unpack('128l', SECTORS[next]) MSAT_2nd.extend(msat_sector[:127]) next = msat_sector[-1] print 'additional MSAT sectors: \n', MSAT_2nd sat_sectors = [x for x in MSAT if x >=0] sat_sectors += [x for x in MSAT_2nd if x >=0] print 'SAT resides in following sectors:\n', sat_sectors SAT = ''.join([SECTORS[sect] for sect in sat_sectors]) sat_sids_count = len(SAT) >> 2 SAT = struct.unpack('<%dl'%sat_sids_count, SAT) # SIDs tuple print 'SAT content:\n', SAT ssat_sectors = [] sid = ssat_start_sid while sid >= 0: ssat_sectors.append(sid) sid = SAT[sid] print 'SSAT sectors:\n', ssat_sectors ssids_count = total_ssat_sectors * (sect_size >> 2) print 'SSID count:', ssids_count SSAT = struct.unpack('<' + 'l'*ssids_count, ''.join([SECTORS[sect] for sect in ssat_sectors])) print 'SSAT content:\n', SSAT dir_stream_sectors = [] sid = dir_start_sid while sid >= 0: dir_stream_sectors.append(sid) sid = SAT[sid] print 'Directory sectors:\n', dir_stream_sectors dir_stream = ''.join([SECTORS[sect] for sect in dir_stream_sectors]) dir_entry_list = [] i = 0 while i < len(dir_stream): dir_entry_list.append(dir_stream[i:i+128]) # 128 -- dir entry size i += 128 del dir_stream print 'total directory entries:', len(dir_entry_list) dentry_types = { 0x00: 'Empty', 0x01: 'User storage', 0x02: 'User stream', 0x03: 'LockBytes', 0x04: 'Property', 0x05: 'Root storage' } node_colours = { 0x00: 'Red', 0x01: 'Black' } SHORT_SECTORS = [] short_sectors_data = '' for dentry in dir_entry_list: print 'DID', dir_entry_list.index(dentry) sz, = struct.unpack('<H', dentry[64:66]) print 'Size of the used area of the character buffer of the name:', sz if sz > 0 : name = dentry[0:sz-2].decode('utf_16_le', 'replace') else: name = '' print 'dir entry name:', repr(name) t, = struct.unpack('B', dentry[66]) print 'type of entry:', t, dentry_types[t] c, = struct.unpack('B', dentry[67]) print 'entry colour:', c, node_colours[c] did_left , = struct.unpack('<l', dentry[68:72]) print 'left child DID :', did_left did_right , = struct.unpack('<l', dentry[72:76]) print 'right child DID:', did_right did_root , = struct.unpack('<l', dentry[76:80]) print 'root DID :', did_root dentry_start_sid , = struct.unpack('<l', dentry[116:120]) print 'start SID :', dentry_start_sid stream_size , = struct.unpack('<L', dentry[120:124]) print 'stream size :', stream_size stream_data = '' if stream_size > 0: sid = dentry_start_sid chunks = [(sid, sid)] if stream_size >= min_stream_size: print 'stream stored as normal stream' while SAT[sid] >= 0: next_in_chain = SAT[sid] last_chunk_start, last_chunk_finish = chunks[-1] if next_in_chain - last_chunk_finish <= 1: chunks[-1] = last_chunk_start, next_in_chain else: chunks.extend([(next_in_chain, next_in_chain)]) sid = next_in_chain for s, f in chunks: stream_data += data[s*sect_size:(f+1)*sect_size] if t == 0x05: # root storage contains data for short streams short_sectors_data = stream_data i = 0 while i < len(short_sectors_data): SHORT_SECTORS.append(short_sectors_data[i:i+short_sect_size]) i += short_sect_size else: print 'stream stored as short-stream' while SSAT[sid] >= 0: next_in_chain = SSAT[sid] last_chunk_start, last_chunk_finish = chunks[-1] if next_in_chain - last_chunk_finish <= 1: chunks[-1] = last_chunk_start, next_in_chain else: chunks.extend([(next_in_chain, next_in_chain)]) sid = next_in_chain for s, f in chunks: stream_data += short_sectors_data[s*sect_size:(f+1)*sect_size] print 'chunks:', chunks if name != '': # BAD IDEA: names may be equal. NEED use full paths... STORAGES[name] = stream_data print return STORAGES
STORAGES[name] = stream_data
STREAMS[name] = stream_data
def get_ole_storages(filename): STORAGES = {} doc = file(filename, 'rb').read() header, data = doc[0:512], doc[512:] del doc doc_magic = header[0:8] file_uid = header[8:24] rev_num = header[24:26] ver_num = header[26:28] byte_order = header[28:30] log_sect_size, = struct.unpack('<H', header[30:32]) log_short_sect_size, = struct.unpack('<H', header[32:34]) total_sat_sectors, = struct.unpack('<L', header[44:48]) dir_start_sid, = struct.unpack('<l', header[48:52]) min_stream_size, = struct.unpack('<L', header[56:60]) ssat_start_sid, = struct.unpack('<l', header[60:64]) total_ssat_sectors, = struct.unpack('<L', header[64:68]) msat_start_sid, = struct.unpack('<l', header[68:72]) total_msat_sectors, = struct.unpack('<L', header[72:76]) MSAT = struct.unpack('<109l', header[76:]) sect_size = 1 << log_sect_size short_sect_size = 1 << log_short_sect_size SECTORS = [] i = 0 while i < len(data): SECTORS.append(data[i:i+sect_size]) i += sect_size #del data total_sectors = len(SECTORS) print 'file magic: ' print_bin_data(doc_magic) print print 'file uid: ' print_bin_data(file_uid) print print 'revision number: ' print_bin_data(rev_num) print print 'version number: ' print_bin_data(ver_num) print print 'byte order: ' print_bin_data(byte_order) print print 'sector size :', hex(sect_size), sect_size print 'total sectors in file :', hex(total_sectors), total_sectors print 'short sector size :', hex(short_sect_size), short_sect_size print 'Total number of sectors used for the SAT :', hex(total_sat_sectors), total_sat_sectors print 'SID of first sector of the directory stream:', hex(dir_start_sid), dir_start_sid print 'Minimum size of a standard stream :', hex(min_stream_size), min_stream_size print 'SID of first sector of the SSAT :', hex(ssat_start_sid), ssat_start_sid print 'Total number of sectors used for the SSAT :', hex(total_ssat_sectors), total_ssat_sectors print 'SID of first additional sector of the MSAT :', hex(msat_start_sid), msat_start_sid print 'Total number of sectors used for the MSAT :', hex(total_msat_sectors), total_msat_sectors print 'MSAT (only header part): \n', MSAT MSAT_2nd = [] next = msat_start_sid while next > 0: msat_sector = struct.unpack('128l', SECTORS[next]) MSAT_2nd.extend(msat_sector[:127]) next = msat_sector[-1] print 'additional MSAT sectors: \n', MSAT_2nd sat_sectors = [x for x in MSAT if x >=0] sat_sectors += [x for x in MSAT_2nd if x >=0] print 'SAT resides in following sectors:\n', sat_sectors SAT = ''.join([SECTORS[sect] for sect in sat_sectors]) sat_sids_count = len(SAT) >> 2 SAT = struct.unpack('<%dl'%sat_sids_count, SAT) # SIDs tuple print 'SAT content:\n', SAT ssat_sectors = [] sid = ssat_start_sid while sid >= 0: ssat_sectors.append(sid) sid = SAT[sid] print 'SSAT sectors:\n', ssat_sectors ssids_count = total_ssat_sectors * (sect_size >> 2) print 'SSID count:', ssids_count SSAT = struct.unpack('<' + 'l'*ssids_count, ''.join([SECTORS[sect] for sect in ssat_sectors])) print 'SSAT content:\n', SSAT dir_stream_sectors = [] sid = dir_start_sid while sid >= 0: dir_stream_sectors.append(sid) sid = SAT[sid] print 'Directory sectors:\n', dir_stream_sectors dir_stream = ''.join([SECTORS[sect] for sect in dir_stream_sectors]) dir_entry_list = [] i = 0 while i < len(dir_stream): dir_entry_list.append(dir_stream[i:i+128]) # 128 -- dir entry size i += 128 del dir_stream print 'total directory entries:', len(dir_entry_list) dentry_types = { 0x00: 'Empty', 0x01: 'User storage', 0x02: 'User stream', 0x03: 'LockBytes', 0x04: 'Property', 0x05: 'Root storage' } node_colours = { 0x00: 'Red', 0x01: 'Black' } SHORT_SECTORS = [] short_sectors_data = '' for dentry in dir_entry_list: print 'DID', dir_entry_list.index(dentry) sz, = struct.unpack('<H', dentry[64:66]) print 'Size of the used area of the character buffer of the name:', sz if sz > 0 : name = dentry[0:sz-2].decode('utf_16_le', 'replace') else: name = '' print 'dir entry name:', repr(name) t, = struct.unpack('B', dentry[66]) print 'type of entry:', t, dentry_types[t] c, = struct.unpack('B', dentry[67]) print 'entry colour:', c, node_colours[c] did_left , = struct.unpack('<l', dentry[68:72]) print 'left child DID :', did_left did_right , = struct.unpack('<l', dentry[72:76]) print 'right child DID:', did_right did_root , = struct.unpack('<l', dentry[76:80]) print 'root DID :', did_root dentry_start_sid , = struct.unpack('<l', dentry[116:120]) print 'start SID :', dentry_start_sid stream_size , = struct.unpack('<L', dentry[120:124]) print 'stream size :', stream_size stream_data = '' if stream_size > 0: sid = dentry_start_sid chunks = [(sid, sid)] if stream_size >= min_stream_size: print 'stream stored as normal stream' while SAT[sid] >= 0: next_in_chain = SAT[sid] last_chunk_start, last_chunk_finish = chunks[-1] if next_in_chain - last_chunk_finish <= 1: chunks[-1] = last_chunk_start, next_in_chain else: chunks.extend([(next_in_chain, next_in_chain)]) sid = next_in_chain for s, f in chunks: stream_data += data[s*sect_size:(f+1)*sect_size] if t == 0x05: # root storage contains data for short streams short_sectors_data = stream_data i = 0 while i < len(short_sectors_data): SHORT_SECTORS.append(short_sectors_data[i:i+short_sect_size]) i += short_sect_size else: print 'stream stored as short-stream' while SSAT[sid] >= 0: next_in_chain = SSAT[sid] last_chunk_start, last_chunk_finish = chunks[-1] if next_in_chain - last_chunk_finish <= 1: chunks[-1] = last_chunk_start, next_in_chain else: chunks.extend([(next_in_chain, next_in_chain)]) sid = next_in_chain for s, f in chunks: stream_data += short_sectors_data[s*sect_size:(f+1)*sect_size] print 'chunks:', chunks if name != '': # BAD IDEA: names may be equal. NEED use full paths... STORAGES[name] = stream_data print return STORAGES
return STORAGES
return STREAMS
def get_ole_storages(filename): STORAGES = {} doc = file(filename, 'rb').read() header, data = doc[0:512], doc[512:] del doc doc_magic = header[0:8] file_uid = header[8:24] rev_num = header[24:26] ver_num = header[26:28] byte_order = header[28:30] log_sect_size, = struct.unpack('<H', header[30:32]) log_short_sect_size, = struct.unpack('<H', header[32:34]) total_sat_sectors, = struct.unpack('<L', header[44:48]) dir_start_sid, = struct.unpack('<l', header[48:52]) min_stream_size, = struct.unpack('<L', header[56:60]) ssat_start_sid, = struct.unpack('<l', header[60:64]) total_ssat_sectors, = struct.unpack('<L', header[64:68]) msat_start_sid, = struct.unpack('<l', header[68:72]) total_msat_sectors, = struct.unpack('<L', header[72:76]) MSAT = struct.unpack('<109l', header[76:]) sect_size = 1 << log_sect_size short_sect_size = 1 << log_short_sect_size SECTORS = [] i = 0 while i < len(data): SECTORS.append(data[i:i+sect_size]) i += sect_size #del data total_sectors = len(SECTORS) print 'file magic: ' print_bin_data(doc_magic) print print 'file uid: ' print_bin_data(file_uid) print print 'revision number: ' print_bin_data(rev_num) print print 'version number: ' print_bin_data(ver_num) print print 'byte order: ' print_bin_data(byte_order) print print 'sector size :', hex(sect_size), sect_size print 'total sectors in file :', hex(total_sectors), total_sectors print 'short sector size :', hex(short_sect_size), short_sect_size print 'Total number of sectors used for the SAT :', hex(total_sat_sectors), total_sat_sectors print 'SID of first sector of the directory stream:', hex(dir_start_sid), dir_start_sid print 'Minimum size of a standard stream :', hex(min_stream_size), min_stream_size print 'SID of first sector of the SSAT :', hex(ssat_start_sid), ssat_start_sid print 'Total number of sectors used for the SSAT :', hex(total_ssat_sectors), total_ssat_sectors print 'SID of first additional sector of the MSAT :', hex(msat_start_sid), msat_start_sid print 'Total number of sectors used for the MSAT :', hex(total_msat_sectors), total_msat_sectors print 'MSAT (only header part): \n', MSAT MSAT_2nd = [] next = msat_start_sid while next > 0: msat_sector = struct.unpack('128l', SECTORS[next]) MSAT_2nd.extend(msat_sector[:127]) next = msat_sector[-1] print 'additional MSAT sectors: \n', MSAT_2nd sat_sectors = [x for x in MSAT if x >=0] sat_sectors += [x for x in MSAT_2nd if x >=0] print 'SAT resides in following sectors:\n', sat_sectors SAT = ''.join([SECTORS[sect] for sect in sat_sectors]) sat_sids_count = len(SAT) >> 2 SAT = struct.unpack('<%dl'%sat_sids_count, SAT) # SIDs tuple print 'SAT content:\n', SAT ssat_sectors = [] sid = ssat_start_sid while sid >= 0: ssat_sectors.append(sid) sid = SAT[sid] print 'SSAT sectors:\n', ssat_sectors ssids_count = total_ssat_sectors * (sect_size >> 2) print 'SSID count:', ssids_count SSAT = struct.unpack('<' + 'l'*ssids_count, ''.join([SECTORS[sect] for sect in ssat_sectors])) print 'SSAT content:\n', SSAT dir_stream_sectors = [] sid = dir_start_sid while sid >= 0: dir_stream_sectors.append(sid) sid = SAT[sid] print 'Directory sectors:\n', dir_stream_sectors dir_stream = ''.join([SECTORS[sect] for sect in dir_stream_sectors]) dir_entry_list = [] i = 0 while i < len(dir_stream): dir_entry_list.append(dir_stream[i:i+128]) # 128 -- dir entry size i += 128 del dir_stream print 'total directory entries:', len(dir_entry_list) dentry_types = { 0x00: 'Empty', 0x01: 'User storage', 0x02: 'User stream', 0x03: 'LockBytes', 0x04: 'Property', 0x05: 'Root storage' } node_colours = { 0x00: 'Red', 0x01: 'Black' } SHORT_SECTORS = [] short_sectors_data = '' for dentry in dir_entry_list: print 'DID', dir_entry_list.index(dentry) sz, = struct.unpack('<H', dentry[64:66]) print 'Size of the used area of the character buffer of the name:', sz if sz > 0 : name = dentry[0:sz-2].decode('utf_16_le', 'replace') else: name = '' print 'dir entry name:', repr(name) t, = struct.unpack('B', dentry[66]) print 'type of entry:', t, dentry_types[t] c, = struct.unpack('B', dentry[67]) print 'entry colour:', c, node_colours[c] did_left , = struct.unpack('<l', dentry[68:72]) print 'left child DID :', did_left did_right , = struct.unpack('<l', dentry[72:76]) print 'right child DID:', did_right did_root , = struct.unpack('<l', dentry[76:80]) print 'root DID :', did_root dentry_start_sid , = struct.unpack('<l', dentry[116:120]) print 'start SID :', dentry_start_sid stream_size , = struct.unpack('<L', dentry[120:124]) print 'stream size :', stream_size stream_data = '' if stream_size > 0: sid = dentry_start_sid chunks = [(sid, sid)] if stream_size >= min_stream_size: print 'stream stored as normal stream' while SAT[sid] >= 0: next_in_chain = SAT[sid] last_chunk_start, last_chunk_finish = chunks[-1] if next_in_chain - last_chunk_finish <= 1: chunks[-1] = last_chunk_start, next_in_chain else: chunks.extend([(next_in_chain, next_in_chain)]) sid = next_in_chain for s, f in chunks: stream_data += data[s*sect_size:(f+1)*sect_size] if t == 0x05: # root storage contains data for short streams short_sectors_data = stream_data i = 0 while i < len(short_sectors_data): SHORT_SECTORS.append(short_sectors_data[i:i+short_sect_size]) i += short_sect_size else: print 'stream stored as short-stream' while SSAT[sid] >= 0: next_in_chain = SSAT[sid] last_chunk_start, last_chunk_finish = chunks[-1] if next_in_chain - last_chunk_finish <= 1: chunks[-1] = last_chunk_start, next_in_chain else: chunks.extend([(next_in_chain, next_in_chain)]) sid = next_in_chain for s, f in chunks: stream_data += short_sectors_data[s*sect_size:(f+1)*sect_size] print 'chunks:', chunks if name != '': # BAD IDEA: names may be equal. NEED use full paths... STORAGES[name] = stream_data print return STORAGES
rlib_add_datasource_postgre = _rlib.rlib_add_datasource_postgre
rlib_add_datasource_postgres = _rlib.rlib_add_datasource_postgres
def _swig_getattr(self,class_type,name): method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError,name
rlib_set_database_encoding = _librlib.rlib_set_database_encoding
def _swig_getattr(self,class_type,name): method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError,name
rlib_set_parameter_encoding = _librlib.rlib_set_parameter_encoding rlib_set_encodings = _librlib.rlib_set_encodings
def _swig_getattr(self,class_type,name): method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError,name
rlib_init = _librlib.rlib_init
rlib_init = _rlib.rlib_init
def _swig_getattr(self,class_type,name): method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError,name
rlib_add_datasource_mysql = _librlib.rlib_add_datasource_mysql
rlib_add_datasource_mysql = _rlib.rlib_add_datasource_mysql
def _swig_getattr(self,class_type,name): method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError,name
rlib_add_datasource_postgre = _librlib.rlib_add_datasource_postgre
rlib_add_datasource_postgre = _rlib.rlib_add_datasource_postgre
def _swig_getattr(self,class_type,name): method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError,name
rlib_add_datasource_odbc = _librlib.rlib_add_datasource_odbc
rlib_add_datasource_odbc = _rlib.rlib_add_datasource_odbc
def _swig_getattr(self,class_type,name): method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError,name
rlib_add_datasource_xml = _librlib.rlib_add_datasource_xml
rlib_add_datasource_xml = _rlib.rlib_add_datasource_xml
def _swig_getattr(self,class_type,name): method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError,name
rlib_add_query_as = _librlib.rlib_add_query_as
rlib_add_query_as = _rlib.rlib_add_query_as
def _swig_getattr(self,class_type,name): method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError,name
rlib_add_report = _librlib.rlib_add_report
rlib_add_report = _rlib.rlib_add_report
def _swig_getattr(self,class_type,name): method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError,name
rlib_add_report_from_buffer = _librlib.rlib_add_report_from_buffer
rlib_add_report_from_buffer = _rlib.rlib_add_report_from_buffer
def _swig_getattr(self,class_type,name): method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError,name
rlib_execute = _librlib.rlib_execute
rlib_execute = _rlib.rlib_execute
def _swig_getattr(self,class_type,name): method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError,name
rlib_get_content_type_as_text = _librlib.rlib_get_content_type_as_text
rlib_get_content_type_as_text = _rlib.rlib_get_content_type_as_text
def _swig_getattr(self,class_type,name): method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError,name
rlib_spool = _librlib.rlib_spool
rlib_spool = _rlib.rlib_spool
def _swig_getattr(self,class_type,name): method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError,name
rlib_set_output_format = _librlib.rlib_set_output_format
rlib_set_output_format = _rlib.rlib_set_output_format
def _swig_getattr(self,class_type,name): method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError,name
rlib_add_resultset_follower_n_to_1 = _librlib.rlib_add_resultset_follower_n_to_1
rlib_add_resultset_follower_n_to_1 = _rlib.rlib_add_resultset_follower_n_to_1
def _swig_getattr(self,class_type,name): method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError,name
rlib_add_resultset_follower = _librlib.rlib_add_resultset_follower
rlib_add_resultset_follower = _rlib.rlib_add_resultset_follower
def _swig_getattr(self,class_type,name): method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError,name
rlib_set_output_format_from_text = _librlib.rlib_set_output_format_from_text
rlib_set_output_format_from_text = _rlib.rlib_set_output_format_from_text
def _swig_getattr(self,class_type,name): method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError,name
rlib_get_output = _librlib.rlib_get_output
rlib_get_output = _rlib.rlib_get_output
def _swig_getattr(self,class_type,name): method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError,name
rlib_get_output_length = _librlib.rlib_get_output_length
rlib_get_output_length = _rlib.rlib_get_output_length
def _swig_getattr(self,class_type,name): method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError,name
rlib_signal_connect = _librlib.rlib_signal_connect
rlib_signal_connect = _rlib.rlib_signal_connect
def _swig_getattr(self,class_type,name): method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError,name
rlib_signal_connect_string = _librlib.rlib_signal_connect_string
rlib_signal_connect_string = _rlib.rlib_signal_connect_string
def _swig_getattr(self,class_type,name): method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError,name
rlib_query_refresh = _librlib.rlib_query_refresh
rlib_query_refresh = _rlib.rlib_query_refresh
def _swig_getattr(self,class_type,name): method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError,name
rlib_add_parameter = _librlib.rlib_add_parameter
rlib_add_parameter = _rlib.rlib_add_parameter
def _swig_getattr(self,class_type,name): method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError,name
rlib_set_locale = _librlib.rlib_set_locale
rlib_set_locale = _rlib.rlib_set_locale
def _swig_getattr(self,class_type,name): method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError,name
rlib_set_output_parameter = _librlib.rlib_set_output_parameter
rlib_set_output_parameter = _rlib.rlib_set_output_parameter
def _swig_getattr(self,class_type,name): method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError,name
rlib_set_output_encoding = _librlib.rlib_set_output_encoding
rlib_set_output_encoding = _rlib.rlib_set_output_encoding
def _swig_getattr(self,class_type,name): method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError,name
rlib_set_datasource_encoding = _librlib.rlib_set_datasource_encoding
rlib_set_datasource_encoding = _rlib.rlib_set_datasource_encoding
def _swig_getattr(self,class_type,name): method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError,name
rlib_free = _librlib.rlib_free
rlib_free = _rlib.rlib_free
def _swig_getattr(self,class_type,name): method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError,name
rlib_version = _librlib.rlib_version
rlib_version = _rlib.rlib_version
def _swig_getattr(self,class_type,name): method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError,name
rlib_graph_add_bg_region = _librlib.rlib_graph_add_bg_region
rlib_graph_add_bg_region = _rlib.rlib_graph_add_bg_region
def _swig_getattr(self,class_type,name): method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError,name
rlib_graph_clear_bg_region = _librlib.rlib_graph_clear_bg_region
rlib_graph_clear_bg_region = _rlib.rlib_graph_clear_bg_region
def _swig_getattr(self,class_type,name): method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError,name
if aSystemFullID[SYSTEMPATH] == '/':
if aSystemFullID[SYSTEMPATH] == '':
def createSystemPathFromFullID( aSystemFullID ): if aSystemFullID[SYSTEMPATH] == '/': if aSystemFullID[ID] == '/': aNewSystemPath = '/' else: aNewSystemPath = '/' + aSystemFullID[ID] else: aNewSystemPath = aSystemFullID[SYSTEMPATH] + '/' +\ aSystemFullID[ID] return aNewSystemPath
else: aNewSystemPath = '/' + aSystemFullID[ID]
elif aSystemFullID[SYSTEMPATH] == '/': aNewSystemPath = aSystemFullID[SYSTEMPATH] + aSystemFullID[ID]
def createSystemPathFromFullID( aSystemFullID ): if aSystemFullID[SYSTEMPATH] == '/': if aSystemFullID[ID] == '/': aNewSystemPath = '/' else: aNewSystemPath = '/' + aSystemFullID[ID] else: aNewSystemPath = aSystemFullID[SYSTEMPATH] + '/' +\ aSystemFullID[ID] return aNewSystemPath
aNewSystemPath = aSystemFullID[SYSTEMPATH] + '/' +\ aSystemFullID[ID]
aNewSystemPath = aSystemFullID[SYSTEMPATH] + '/' + aSystemFullID[ID]
def createSystemPathFromFullID( aSystemFullID ): if aSystemFullID[SYSTEMPATH] == '/': if aSystemFullID[ID] == '/': aNewSystemPath = '/' else: aNewSystemPath = '/' + aSystemFullID[ID] else: aNewSystemPath = aSystemFullID[SYSTEMPATH] + '/' +\ aSystemFullID[ID] return aNewSystemPath
systemfullid3 = createFullID( 'System:/:/' )
systemfullid3 = createFullID( 'System::/' )
def createSystemPathFromFullID( aSystemFullID ): if aSystemFullID[SYSTEMPATH] == '/': if aSystemFullID[ID] == '/': aNewSystemPath = '/' else: aNewSystemPath = '/' + aSystemFullID[ID] else: aNewSystemPath = aSystemFullID[SYSTEMPATH] + '/' +\ aSystemFullID[ID] return aNewSystemPath
self.thePluginManager.printMessage( "%s: not numerical data\n" % aFullPNString )
aMessage = "Error: (%s) is not numerical data" %aFullPNString self.thePluginManager.printMessage( aMessage ) aDialog = ConfirmWindow(0,aMessage,'Error!')
def __init__( self, dirname, data, pluginmanager, root=None ):
self.addPopupMenu(0,1,0)
def __init__( self, dirname, data, pluginmanager, root=None ):
self.LoggerDataList.append( aLoggerStub.getDataWithStartEndInterval(self.StartTime, aEndTime, 1) )
if self.StartTime < aEndTime: self.LoggerDataList.append( aLoggerStub.getDataWithStartEndInterval(self.StartTime, aEndTime, 1) ) else: aValue = self.theSession.theSimulator.getEntityProperty( createFullPNString(self.theFullPN()) ) self.theFirstLog = [[self.StartTime,aValue,aValue,aValue,aValue]] self.LoggerDataList.append( self.theFirstLog )
def updateLoggerDataList(self): self.LoggerDataList =[] for aLogger in self.theLoggerList: aLoggerStub = LoggerStub( self.theSession.theSimulator, aLogger ) aEndTime = aLoggerStub.getEndTime() self.LoggerDataList.append( aLoggerStub.getDataWithStartEndInterval(self.StartTime, aEndTime, 1) )
self.FullDataList.append( array(LoggerData) )
if LoggerData != self.theFirstLog: self.FullDataList.append( array(LoggerData) )
def updateFullDataList( self ): num = 0 FullDataList_prev = self.FullDataList self.FullDataList = [] for LoggerData in self.LoggerDataList: if len(FullDataList_prev) > num : self.FullDataList.append( concatenate( (FullDataList_prev[num], array( LoggerData )))) if num >= len(FullDataList_prev): self.FullDataList.append( array(LoggerData) ) num += 1
if self.LoggerDataList[0] == (): pass else: self.updateFullDataList() self.xList = [] self.yList = [] if self.xaxis == None or self.xaxis == 'time': if self.yaxis == None: for num in range(len(self.LoggerDataList)): self.xList.append(self.FullDataList[num][:,0]) self.yList.append(self.FullDataList[num][:,1]) else: num = 2 for yaxis in self.yaxis: if yaxis == '': self.xList.append (['None']) self.yList.append (['None']) else:
try: if self.LoggerDataList[0] == (): pass else: self.updateFullDataList() self.xList = [] self.yList = [] if self.xaxis == None or self.xaxis == 'time': if self.yaxis == None: for num in range(len(self.LoggerDataList)): self.xList.append(self.FullDataList[num][:,0]) self.yList.append(self.FullDataList[num][:,1]) else: num = 2 for yaxis in self.yaxis: if yaxis == '': self.xList.append (['None']) self.yList.append (['None']) else:
def update( self ): if self.arg % 10 == 5: theStateList = self.setStateList() self.updateLoggerDataList() if self.LoggerDataList[0] == (): pass else: self.updateFullDataList() self.xList = [] self.yList = [] if self.xaxis == None or self.xaxis == 'time': if self.yaxis == None: for num in range(len(self.LoggerDataList)): self.xList.append(self.FullDataList[num][:,0]) self.yList.append(self.FullDataList[num][:,1])
else: if self.yaxis == None: for num in range(len(self.LoggerDataList)): try : self.xList.append ( eval(self.xaxis, self.entry)[:,1] ) except NameError: self.theSession.printMessage( "name '%s' is not defined \n" % self.xaxis ) self["entry1"].set_text ('time') self.changexaxis( self["entry1"] ) self.xList.append(self.FullDataList[0][:,0]) except (SyntaxError,TypeError): self.theSession.printMessage( "'%s' is SyntaxError or TypeError\n" % self.xaxis ) self["entry1"].set_text ('time') self.changexaxis( self["entry1"] ) self.xList.append(self.FullDataList[0][:,0]) self.yList.append ( self.FullDataList[num][:,1] )
def update( self ): if self.arg % 10 == 5: theStateList = self.setStateList() self.updateLoggerDataList() if self.LoggerDataList[0] == (): pass else: self.updateFullDataList() self.xList = [] self.yList = [] if self.xaxis == None or self.xaxis == 'time': if self.yaxis == None: for num in range(len(self.LoggerDataList)): self.xList.append(self.FullDataList[num][:,0]) self.yList.append(self.FullDataList[num][:,1])
num = 2 for yaxis in self.yaxis: if yaxis == '': self.xList.append (['None']) self.yList.append (['None']) else: try: self.xList.append( eval(self.xaxis, self.entry)[:,1])
if self.yaxis == None: for num in range(len(self.LoggerDataList)): try : self.xList.append ( eval(self.xaxis, self.entry)[:,1] )
def update( self ): if self.arg % 10 == 5: theStateList = self.setStateList() self.updateLoggerDataList() if self.LoggerDataList[0] == (): pass else: self.updateFullDataList() self.xList = [] self.yList = [] if self.xaxis == None or self.xaxis == 'time': if self.yaxis == None: for num in range(len(self.LoggerDataList)): self.xList.append(self.FullDataList[num][:,0]) self.yList.append(self.FullDataList[num][:,1])
self.changexaxis( self["entry1"] ) self.xList.append(self.FullDataList[0][:,0]) try: self.yList.append( eval(yaxis, self.entry)[:,1]) except NameError: self.theSession.printMessage( "name '%s' is not defined \n" % yaxis ) self["entry%i"%num].set_text ('') self.changeyaxis( self["entry%i"%num] ) self.yList.append(['None']) except (SyntaxError,TypeError): self.theSession.printMessage( "'%s' is SyntaxError or TypeError \n" % yaxis ) self["entry%i"%num].set_text ('') self.changeyaxis( self["entry%i"%num] ) self.yList.append(['None']) num += 1 if self.yaxis == None: num = 0 for LoggerData in self.LoggerDataList: if LoggerData == (): pass else:
self.changexaxis( self["entry1"] ) self.xList.append(self.FullDataList[0][:,0]) self.yList.append ( self.FullDataList[num][:,1] ) else: num = 2 for yaxis in self.yaxis: if yaxis == '': self.xList.append (['None']) self.yList.append (['None']) else: try: self.xList.append( eval(self.xaxis, self.entry)[:,1]) except NameError: self.theSession.printMessage( "name '%s' is not defined \n" % self.xaxis ) self["entry1"].set_text ('time') self.changexaxis( self["entry1"] ) self.xList.append(self.FullDataList[0][:,0]) except (SyntaxError,TypeError): self.theSession.printMessage( "'%s' is SyntaxError or TypeError\n" % self.xaxis ) self["entry1"].set_text ('time') self.changexaxis( self["entry1"] ) self.xList.append(self.FullDataList[0][:,0]) try: self.yList.append( eval(yaxis, self.entry)[:,1]) except NameError: self.theSession.printMessage( "name '%s' is not defined \n" % yaxis ) self["entry%i"%num].set_text ('') self.changeyaxis( self["entry%i"%num] ) self.yList.append(['None']) except (SyntaxError,TypeError): self.theSession.printMessage( "'%s' is SyntaxError or TypeError \n" % yaxis ) self["entry%i"%num].set_text ('') self.changeyaxis( self["entry%i"%num] ) self.yList.append(['None']) num += 1 if self.yaxis == None: num = 0 for LoggerData in self.LoggerDataList: if LoggerData == (): pass else: if theStateList[num] == 1: self.theDataList[num].set_points( None, None ) else: if self.scale == "log": if min(array(LoggerData)[:,1]) <= 0: self.theSession.printMessage( "value is under 0, set yaxis to linear scale\n" ) self.plot.set_yscale(PLOT_SCALE_LINEAR) self.scale = "linear" self.theDataList[num].set_points( self.xList[num], self.yList[num] ) num += 1 else: num = 0 for yaxis in self.yaxis:
def update( self ): if self.arg % 10 == 5: theStateList = self.setStateList() self.updateLoggerDataList() if self.LoggerDataList[0] == (): pass else: self.updateFullDataList() self.xList = [] self.yList = [] if self.xaxis == None or self.xaxis == 'time': if self.yaxis == None: for num in range(len(self.LoggerDataList)): self.xList.append(self.FullDataList[num][:,0]) self.yList.append(self.FullDataList[num][:,1])
self.theDataList[num].set_points( None, None ) else: if self.scale == "log": if min(array(LoggerData)[:,1]) <= 0:
self.theDataList[num].set_points(None,None) elif yaxis == '': self.theDataList[num].set_points(None,None) else : if self.scale == 'log': if min(array(LoggerData)[:,1] ) <= 0:
def update( self ): if self.arg % 10 == 5: theStateList = self.setStateList() self.updateLoggerDataList() if self.LoggerDataList[0] == (): pass else: self.updateFullDataList() self.xList = [] self.yList = [] if self.xaxis == None or self.xaxis == 'time': if self.yaxis == None: for num in range(len(self.LoggerDataList)): self.xList.append(self.FullDataList[num][:,0]) self.yList.append(self.FullDataList[num][:,1])
self.scale = "linear" self.theDataList[num].set_points( self.xList[num], self.yList[num] ) num += 1 else: num = 0 for yaxis in self.yaxis: if theStateList[num] == 1: self.theDataList[num].set_points(None,None) elif yaxis == '': self.theDataList[num].set_points(None,None) else : if self.scale == 'log': if min(array(LoggerData)[:,1] ) <= 0: self.theSession.printMessage( "value is under 0, set yaxis to linear scale\n" ) self.plot.set_yscale(PLOT_SCALE_LINEAR) self.scale = 'linear' self.theDataList[num].set_points(self.xList[num],self.yList[num]) num += 1
self.scale = 'linear' self.theDataList[num].set_points(self.xList[num],self.yList[num]) num += 1 except: pass
def update( self ): if self.arg % 10 == 5: theStateList = self.setStateList() self.updateLoggerDataList() if self.LoggerDataList[0] == (): pass else: self.updateFullDataList() self.xList = [] self.yList = [] if self.xaxis == None or self.xaxis == 'time': if self.yaxis == None: for num in range(len(self.LoggerDataList)): self.xList.append(self.FullDataList[num][:,0]) self.yList.append(self.FullDataList[num][:,1])
if( self.theSession == None ):
self.initializeComponents() self.theSelectedEntityList = [] self.theSelectedPluginInstanceList = [] self.CloseOrder = False def initializeComponents( self, session = None ): if ( session != None ): self.theSession = session self.thePluginManager = session.thePluginManager if ( self.theSession == None ):
def openWindow( self ):
self.theSelectedEntityList = [] self.theSelectedPluginInstanceList = [] self.CloseOrder = False
def openWindow( self ):
aVariable[MS_ENTITY_PROPERTYLIST][MS_VARIABLE_NUMCONC][MS_PROPERTY_FLAGS][MS_CHANGED_FLAG] = 1
def __recalculateConcentrations(self, aVariable, systemSize ): aValue = float( aVariable[MS_ENTITY_PROPERTYLIST][MS_VARIABLE_VALUE][MS_PROPERTY_VALUE] ) if systemSize != 0.0: newMolarConc = aValue / ( AVOGADRO * systemSize ) else: newMolarConc = 0.0 aVariable[MS_ENTITY_PROPERTYLIST][MS_VARIABLE_MOLARCONC][MS_PROPERTY_VALUE] = newMolarConc if systemSize != 0.0: newNumberConc = aValue / systemSize else: newNumberConc = 0.0 aVariable[MS_ENTITY_PROPERTYLIST][MS_VARIABLE_NUMCONC][MS_PROPERTY_VALUE] = newNumberConc
stmts : stmt stmts
stmts : stmts stmt | stmt
def p_stmts(t): ''' stmts : stmt stmts ''' t[0] = createList( 'stmts', t)
property_entity_list : property_entity property_entity_list
property_entity_list : property_entity_list property_entity
def p_property_entity_list(t): ''' property_entity_list : property_entity property_entity_list | property_entity | empty ''' t[0] = createList( 'property_entity_list', t )
valuelist : value valuelist
valuelist : valuelist value
def p_valuelist(t): ''' valuelist : value valuelist | value ''' t[0] = createList( 'valuelist', t )
matrixlist : matrix matrixlist
matrixlist : matrixlist matrix
def p_matrixlist(t): ''' matrixlist : matrix matrixlist | matrix ''' t[0] = createList( 'matrixlist', t )
print "Syntax error at line %d in %s. (near '%s')" % ( t.lineno, t.value )
print "Syntax error at line %d in %s. " % ( t.lineno, t.value )
def p_error(t): print "Syntax error at line %d in %s. (near '%s')" % ( t.lineno, t.value ) yacc.errok()
self.minmax[1]=self.minmax[0]*2
if self.minmax[0]==0: self.minmax[1]=1 else: self.minmax[1]=self.minmax[0]*2
def reframey(self): #no redraw! #get max and min from databuffers if self.zoomlevel==0: self.getminmax() if self.minmax[0]==self.minmax[1]: self.minmax[1]=self.minmax[0]*2 #calculate yframemin, max if self.scale_type=='linear': yrange=(self.minmax[1]-self.minmax[0])/(self.yframemax_when_rescaling-self.yframemin_when_rescaling) self.yframe[1]=self.minmax[1]+(1-self.yframemax_when_rescaling)*yrange self.yframe[0]=self.minmax[0]-(self.yframemin_when_rescaling*yrange) exponent=pow(10,floor(log10(self.yframe[1]-self.yframe[0]))) mantissa1=ceil(self.yframe[1]/exponent) mantissa0=floor(self.yframe[0]/exponent) ticks=mantissa1-mantissa0 if ticks>10: mantissa0=floor(mantissa0/2)*2 mantissa1=ceil(mantissa1/2)*2 ticks=(mantissa1-mantissa0)/2 elif ticks<5: ticks*=2 self.yticks_no=ticks
self.ygrid[1]=pow(10,floor(log10(self.yframe[1]))) self.ygrid[0]=pow(10,ceil(log10(self.yframe[0]))) diff=int(log10(self.ygrid[1]/self.ygrid[0])) if diff==0:diff=1 if diff<6: self.yticks_no=diff self.yticks_step=10
if self.yframe[1]>0 and self.yframe[0]>0: self.ygrid[1]=pow(10,floor(log10(self.yframe[1]))) self.ygrid[0]=pow(10,ceil(log10(self.yframe[0]))) diff=int(log10(self.ygrid[1]/self.ygrid[0])) if diff==0:diff=1 if diff<6: self.yticks_no=diff self.yticks_step=10 else: self.yticks_no=5 self.yticks_step=pow(10,ceil(diff/5))
def reframey(self): #no redraw! #get max and min from databuffers if self.zoomlevel==0: self.getminmax() if self.minmax[0]==self.minmax[1]: self.minmax[1]=self.minmax[0]*2 #calculate yframemin, max if self.scale_type=='linear': yrange=(self.minmax[1]-self.minmax[0])/(self.yframemax_when_rescaling-self.yframemin_when_rescaling) self.yframe[1]=self.minmax[1]+(1-self.yframemax_when_rescaling)*yrange self.yframe[0]=self.minmax[0]-(self.yframemin_when_rescaling*yrange) exponent=pow(10,floor(log10(self.yframe[1]-self.yframe[0]))) mantissa1=ceil(self.yframe[1]/exponent) mantissa0=floor(self.yframe[0]/exponent) ticks=mantissa1-mantissa0 if ticks>10: mantissa0=floor(mantissa0/2)*2 mantissa1=ceil(mantissa1/2)*2 ticks=(mantissa1-mantissa0)/2 elif ticks<5: ticks*=2 self.yticks_no=ticks
self.yticks_no=5 self.yticks_step=pow(10,ceil(diff/5))
self.theOwner.theSession.printMessage("negative value in range, falling back to linear scale") self.change_scale()
def reframey(self): #no redraw! #get max and min from databuffers if self.zoomlevel==0: self.getminmax() if self.minmax[0]==self.minmax[1]: self.minmax[1]=self.minmax[0]*2 #calculate yframemin, max if self.scale_type=='linear': yrange=(self.minmax[1]-self.minmax[0])/(self.yframemax_when_rescaling-self.yframemin_when_rescaling) self.yframe[1]=self.minmax[1]+(1-self.yframemax_when_rescaling)*yrange self.yframe[0]=self.minmax[0]-(self.yframemin_when_rescaling*yrange) exponent=pow(10,floor(log10(self.yframe[1]-self.yframe[0]))) mantissa1=ceil(self.yframe[1]/exponent) mantissa0=floor(self.yframe[0]/exponent) ticks=mantissa1-mantissa0 if ticks>10: mantissa0=floor(mantissa0/2)*2 mantissa1=ceil(mantissa1/2)*2 ticks=(mantissa1-mantissa0)/2 elif ticks<5: ticks*=2 self.yticks_no=ticks
anArgumentTuple = tuple( self.theDirectoryName ) + (sim,) + (data,)
anArgumentTuple = ( self.theDirectoryName, sim , data )
def createInstance( self, sim, data, parent=None ): aConstructor = self.theModule.__dict__[self.theName] anArgumentTuple = tuple( self.theDirectoryName ) + (sim,) + (data,) apply( aConstructor, anArgumentTuple )
if type(aMessage) == type([]) or type(aMessage) == type(()) :
if type(aMessage) == list:
def printMessage( self, aMessage ):
aMessage = '\n' + aMessage[0]
aMessage[0] = '\n' + aMessage[0]
def printMessage( self, aMessage ):
aString = str( aMessage )
aString = str( aLine )
def printMessage( self, aMessage ):
self.pull = 0 self.thePositiveFlag = 1 self.theAutoChangeFlag = 1 self.theActualValue = 0 self.theBarLength = 0 self.theMultiplier = 0
self.pull = FALSE self.thePositiveFlag = TRUE self.theFixFlag = FALSE self.theActualValue = FALSE self.theBarLength = FALSE self.theMultiplier = FALSE
def __init__( self, dirname, data, pluginmanager, root=None ):
'on_add_button_clicked' : self.updateByAddbutton, 'on_subtract_button_clicked' : self.updateBySubtractbutton,
'on_add_button_clicked' : self.updateByIncrease, 'on_subtract_button_clicked' : self.updateByDecrease,
def __init__( self, dirname, data, pluginmanager, root=None ):
'auto_button_toggled' : self.updateByAutoButton ,
'fix_checkbutton_toggled' : self.updateByFix ,
def __init__( self, dirname, data, pluginmanager, root=None ):
value = aValue self.theActualValue = value
self.theActualValue = aValue
def update( self ): aString = str( self.theFullPN()[ID] ) aString += ':\n' + str( self.theFullPN()[PROPERTY] ) self.theIDEntry.set_text ( aString )
= self.calculateBarLength( value ) aIndicator = (value / (float)(10**(self.theMultiplier))) \
= self.calculateBarLength( aValue ) aIndicator = (aValue / (float)(10**(self.theMultiplier))) \
def update( self ): aString = str( self.theFullPN()[ID] ) aString += ':\n' + str( self.theFullPN()[PROPERTY] ) self.theIDEntry.set_text ( aString )
self['progressbar'].set_format_string(str(value))
self['progressbar'].set_format_string(str(aValue))
def update( self ): aString = str( self.theFullPN()[ID] ) aString += ':\n' + str( self.theFullPN()[PROPERTY] ) self.theIDEntry.set_text ( aString )
def updateByAuto( self, value ): self.theAutoChangeFlag = 1 self.update() def updateByAddbutton( self , obj ): self['auto_button'].set_active( 0 )
def updateByAuto( self, aValue ): self.theFixFlag = 0 self.update() def updateByIncrease( self , obj ): self.theFixFlag = TRUE self['fix_checkbutton'].set_active( TRUE )
def updateByAuto( self, value ):
aNumber = string.atof( aNumberString )
try: aNumber = string.atof( aNumberString ) except: anErrorMessage = "Numeric charactor must be inputted!" aWarningWindow = ConfirmWindow(OK_MODE,anErrorMessage,'Error !') return None
def updateByAddbutton( self , obj ):
self.theAutoChangeFlag = 0 self.update() def updateBySubtractbutton( self,obj ): self['auto_button'].set_active( 0 )
self.update() def updateByDecrease( self,obj ): self.theFixFlag = TRUE self['fix_checkbutton'].set_active( TRUE )
def updateByAddbutton( self , obj ):
self.theAutoChangeFlag = 0
def updateBySubtractbutton( self,obj ):
if self.theAutoChangeFlag : pass else : self['auto_button'].set_active( 0 )
def updateByTextentry(self, obj):
aNumber = string.atof( aNumberString )
self['fix_checkbutton'].set_active( TRUE ) try: aNumber = string.atof( aNumberString ) except: anErrorMessage = "Numeric charactor must be inputted!" aWarningWindow = ConfirmWindow(OK_MODE,anErrorMessage,'Error !') return None self.theFixFlag = TRUE
def updateByTextentry(self, obj):
self.theAutoChangeFlag = 0 self.update() def updateByAutoButton(self, autobutton):
self.update() def updateByFix(self, autobutton): self.theFixFlag = self['fix_checkbutton'].get_active()
def updateByTextentry(self, obj):
if self['auto_button'].get_active() :
if self.theFixFlag == TRUE: aMultiplier = self.pull-2 else :
def calculateBarLength( self, value ):
else : aMultiplier = self.pull-2
def calculateBarLength( self, value ):
print aSubSystemList
def __loadProperty( self, anEml, aSystemPath='' ): # the default of aSystemPath is empty because # unlike __loadEntity() this starts with the root system
aEntryList = EntryListWindow.EntryListWindow( self, self.theSimulator )
aEntryList = EntryListWindow.EntryListWindow( self )
def createNewEntryList( self, button_obj ) : aEntryList = EntryListWindow.EntryListWindow( self, self.theSimulator )
self.theEntityListWindow.setSession( self.theSession )
def __loadData( self, *arg ) : """loads model or script file arg[0] --- ok button of FileSelection arg[1] --- 'Model'/'Script' (str) Return None """
self.theMessageWindowVisible = False self.hideMessageWindow() self.__resizeVertically( self['entitylistarea'].get_allocation()[3] )
self.theMessageWindowVisible = False self.hideMessageWindow() if self.theEntityListWindowVisible: self.__resizeVertically( self['entitylistarea'].get_allocation()[3] ) else: self.__resizeVertically( 0 )
def __toggleMessageWindow( self, *arg ) :
self.__resizeVertically( self.theMessageWindow.getActualSize()[1] )
if self.theMessageWindowVisible: self.__resizeVertically( self.theMessageWindow.getActualSize()[1] ) else: self.__resizeVertically( 0 )
def __toggleEntityListWindow( self, *arg ):
self.drawpoint_minmax(aFullPNString, datapoint) else: self.drawpoint_connect(aFullPNString, datapoint)
if not self.drawpoint_minmax(aFullPNString, x, y, ymax, ymin, lastx, lasty, lastymax, lastymin ): pass self.drawpoint_connect(aFullPNString, x, y, ymax, ymin, lastx, lasty, lastymax, lastymin )
def drawpoint(self, aFullPNString, datapoint): if self.strip_mode == 'history': self.drawpoint_minmax(aFullPNString, datapoint) else: self.drawpoint_connect(aFullPNString, datapoint)
def drawpoint_minmax(self, aFullPNString, datapoint): if self.trace_onoff[aFullPNString]==gtk.FALSE: return 0 x=self.convertx_to_plot(datapoint[DP_TIME]) ymax=self.converty_to_plot(datapoint[DP_MAX]) ymin=self.converty_to_plot(datapoint[DP_MIN]) lastx=self.lastx[aFullPNString] lastymax=self.lastymax[aFullPNString] lastymin=self.lastymin[aFullPNString] self.lastx[aFullPNString]=x self.lastymax[aFullPNString]=ymax self.lastymin[aFullPNString]=ymin
def drawpoint_minmax(self, aFullPNString, x, y, ymax, ymin, lastx, lasty, lastymax, lastymin ):
def drawpoint_minmax(self, aFullPNString, datapoint): #get datapoint x y values #convert to plot coordinates if self.trace_onoff[aFullPNString]==gtk.FALSE: return 0 x=self.convertx_to_plot(datapoint[DP_TIME]) ymax=self.converty_to_plot(datapoint[DP_MAX]) ymin=self.converty_to_plot(datapoint[DP_MIN])
if dx<2: self.drawminmax(aFullPNString,x,ymax, ymin) else:
self.drawminmax(aFullPNString,x,ymax, ymin) if dx>1: return True else: return False
def drawpoint_minmax(self, aFullPNString, datapoint): #get datapoint x y values #convert to plot coordinates if self.trace_onoff[aFullPNString]==gtk.FALSE: return 0 x=self.convertx_to_plot(datapoint[DP_TIME]) ymax=self.converty_to_plot(datapoint[DP_MAX]) ymin=self.converty_to_plot(datapoint[DP_MIN])
x0=lastx ymax0=lastymax ymin0=lastymin x1=x ymax1=ymax ymin1=ymin x=x0+1 while x<=x1: self.drawminmax(aFullPNString, x, ymax, ymin) x+=1
def drawpoint_minmax(self, aFullPNString, datapoint): #get datapoint x y values #convert to plot coordinates if self.trace_onoff[aFullPNString]==gtk.FALSE: return 0 x=self.convertx_to_plot(datapoint[DP_TIME]) ymax=self.converty_to_plot(datapoint[DP_MAX]) ymin=self.converty_to_plot(datapoint[DP_MIN])
def drawpoint_connect(self, aFullPNString, datapoint):
def drawpoint_connect(self, aFullPNString, x, y, ymax, ymin, lastx, lasty, lastymax, lastymin ):
def drawpoint_connect(self, aFullPNString, datapoint): #get datapoint x y values #convert to plot coordinates if self.trace_onoff[aFullPNString]==gtk.FALSE: return 0 x=self.convertx_to_plot(datapoint[0]) y=self.converty_to_plot(datapoint[1]) cur_point_within_frame=self.withinframes([x,y]) #getlastpoint, calculate change to the last lastx=self.lastx[aFullPNString] lasty=self.lasty[aFullPNString] self.lastx[aFullPNString]=x self.lasty[aFullPNString]=y last_point_within_frame=self.withinframes([lastx,lasty]) lastymax=self.lastymax[aFullPNString] lastymin=self.lastymin[aFullPNString] if lastx!=None : dx=abs(lastx-x)
if self.trace_onoff[aFullPNString]==gtk.FALSE: return 0 x=self.convertx_to_plot(datapoint[0]) y=self.converty_to_plot(datapoint[1]) cur_point_within_frame=self.withinframes([x,y]) lastx=self.lastx[aFullPNString] lasty=self.lasty[aFullPNString] self.lastx[aFullPNString]=x self.lasty[aFullPNString]=y last_point_within_frame=self.withinframes([lastx,lasty]) lastymax=self.lastymax[aFullPNString] lastymin=self.lastymin[aFullPNString]
def drawpoint_connect(self, aFullPNString, datapoint): #get datapoint x y values #convert to plot coordinates if self.trace_onoff[aFullPNString]==gtk.FALSE: return 0 x=self.convertx_to_plot(datapoint[0]) y=self.converty_to_plot(datapoint[1]) cur_point_within_frame=self.withinframes([x,y]) #getlastpoint, calculate change to the last lastx=self.lastx[aFullPNString] lasty=self.lasty[aFullPNString] self.lastx[aFullPNString]=x self.lasty[aFullPNString]=y last_point_within_frame=self.withinframes([lastx,lasty]) lastymax=self.lastymax[aFullPNString] lastymin=self.lastymin[aFullPNString] if lastx!=None : dx=abs(lastx-x)
if (not cur_point_within_frame) and (not last_point_within_frame):
def drawpoint_connect(self, aFullPNString, datapoint): #get datapoint x y values #convert to plot coordinates if self.trace_onoff[aFullPNString]==gtk.FALSE: return 0 x=self.convertx_to_plot(datapoint[0]) y=self.converty_to_plot(datapoint[1]) cur_point_within_frame=self.withinframes([x,y]) #getlastpoint, calculate change to the last lastx=self.lastx[aFullPNString] lasty=self.lasty[aFullPNString] self.lastx[aFullPNString]=x self.lasty[aFullPNString]=y last_point_within_frame=self.withinframes([lastx,lasty]) lastymax=self.lastymax[aFullPNString] lastymin=self.lastymin[aFullPNString] if lastx!=None : dx=abs(lastx-x)
pass else:
if True:
def drawpoint_connect(self, aFullPNString, datapoint): #get datapoint x y values #convert to plot coordinates if self.trace_onoff[aFullPNString]==gtk.FALSE: return 0 x=self.convertx_to_plot(datapoint[0]) y=self.converty_to_plot(datapoint[1]) cur_point_within_frame=self.withinframes([x,y]) #getlastpoint, calculate change to the last lastx=self.lastx[aFullPNString] lasty=self.lasty[aFullPNString] self.lastx[aFullPNString]=x self.lasty[aFullPNString]=y last_point_within_frame=self.withinframes([lastx,lasty]) lastymax=self.lastymax[aFullPNString] lastymin=self.lastymin[aFullPNString] if lastx!=None : dx=abs(lastx-x)
if y0<self.plotaread[1] and y1>=self.plotaread[1]:
if y0<self.plotaread[1] and y1<self.plotaread[1]: return if y0>self.plotaread[3] and y1>self.plotaread[3]: return if y0<self.plotaread[1]:
def drawpoint_connect(self, aFullPNString, datapoint): #get datapoint x y values #convert to plot coordinates if self.trace_onoff[aFullPNString]==gtk.FALSE: return 0 x=self.convertx_to_plot(datapoint[0]) y=self.converty_to_plot(datapoint[1]) cur_point_within_frame=self.withinframes([x,y]) #getlastpoint, calculate change to the last lastx=self.lastx[aFullPNString] lasty=self.lasty[aFullPNString] self.lastx[aFullPNString]=x self.lasty[aFullPNString]=y last_point_within_frame=self.withinframes([lastx,lasty]) lastymax=self.lastymax[aFullPNString] lastymin=self.lastymin[aFullPNString] if lastx!=None : dx=abs(lastx-x)
if y0>self.plotaread[3] and y1<=self.plotaread[3]:
if y0>self.plotaread[3] :
def drawpoint_connect(self, aFullPNString, datapoint): #get datapoint x y values #convert to plot coordinates if self.trace_onoff[aFullPNString]==gtk.FALSE: return 0 x=self.convertx_to_plot(datapoint[0]) y=self.converty_to_plot(datapoint[1]) cur_point_within_frame=self.withinframes([x,y]) #getlastpoint, calculate change to the last lastx=self.lastx[aFullPNString] lasty=self.lasty[aFullPNString] self.lastx[aFullPNString]=x self.lasty[aFullPNString]=y last_point_within_frame=self.withinframes([lastx,lasty]) lastymax=self.lastymax[aFullPNString] lastymin=self.lastymin[aFullPNString] if lastx!=None : dx=abs(lastx-x)
if y1<self.plotaread[1] and y0>=self.plotaread[1]:
if y1<self.plotaread[1]:
def drawpoint_connect(self, aFullPNString, datapoint): #get datapoint x y values #convert to plot coordinates if self.trace_onoff[aFullPNString]==gtk.FALSE: return 0 x=self.convertx_to_plot(datapoint[0]) y=self.converty_to_plot(datapoint[1]) cur_point_within_frame=self.withinframes([x,y]) #getlastpoint, calculate change to the last lastx=self.lastx[aFullPNString] lasty=self.lasty[aFullPNString] self.lastx[aFullPNString]=x self.lasty[aFullPNString]=y last_point_within_frame=self.withinframes([lastx,lasty]) lastymax=self.lastymax[aFullPNString] lastymin=self.lastymin[aFullPNString] if lastx!=None : dx=abs(lastx-x)
if y1>self.plotaread[3] and y0<=self.plotaread[3]:
if y1>self.plotaread[3]:
def drawpoint_connect(self, aFullPNString, datapoint): #get datapoint x y values #convert to plot coordinates if self.trace_onoff[aFullPNString]==gtk.FALSE: return 0 x=self.convertx_to_plot(datapoint[0]) y=self.converty_to_plot(datapoint[1]) cur_point_within_frame=self.withinframes([x,y]) #getlastpoint, calculate change to the last lastx=self.lastx[aFullPNString] lasty=self.lasty[aFullPNString] self.lastx[aFullPNString]=x self.lasty[aFullPNString]=y last_point_within_frame=self.withinframes([lastx,lasty]) lastymax=self.lastymax[aFullPNString] lastymin=self.lastymin[aFullPNString] if lastx!=None : dx=abs(lastx-x)
if x0<self.plotaread[0] and x1>=self.plotaread[0]:
if x0<self.plotaread[0] :
def drawpoint_connect(self, aFullPNString, datapoint): #get datapoint x y values #convert to plot coordinates if self.trace_onoff[aFullPNString]==gtk.FALSE: return 0 x=self.convertx_to_plot(datapoint[0]) y=self.converty_to_plot(datapoint[1]) cur_point_within_frame=self.withinframes([x,y]) #getlastpoint, calculate change to the last lastx=self.lastx[aFullPNString] lasty=self.lasty[aFullPNString] self.lastx[aFullPNString]=x self.lasty[aFullPNString]=y last_point_within_frame=self.withinframes([lastx,lasty]) lastymax=self.lastymax[aFullPNString] lastymin=self.lastymin[aFullPNString] if lastx!=None : dx=abs(lastx-x)
if x0>self.plotaread[2] and x1<=self.plotaread[2]:
if x0>self.plotaread[2] :
def drawpoint_connect(self, aFullPNString, datapoint): #get datapoint x y values #convert to plot coordinates if self.trace_onoff[aFullPNString]==gtk.FALSE: return 0 x=self.convertx_to_plot(datapoint[0]) y=self.converty_to_plot(datapoint[1]) cur_point_within_frame=self.withinframes([x,y]) #getlastpoint, calculate change to the last lastx=self.lastx[aFullPNString] lasty=self.lasty[aFullPNString] self.lastx[aFullPNString]=x self.lasty[aFullPNString]=y last_point_within_frame=self.withinframes([lastx,lasty]) lastymax=self.lastymax[aFullPNString] lastymin=self.lastymin[aFullPNString] if lastx!=None : dx=abs(lastx-x)
if x1<self.plotaread[0] and x0>=self.plotaread[0]:
if x1<self.plotaread[0] :
def drawpoint_connect(self, aFullPNString, datapoint): #get datapoint x y values #convert to plot coordinates if self.trace_onoff[aFullPNString]==gtk.FALSE: return 0 x=self.convertx_to_plot(datapoint[0]) y=self.converty_to_plot(datapoint[1]) cur_point_within_frame=self.withinframes([x,y]) #getlastpoint, calculate change to the last lastx=self.lastx[aFullPNString] lasty=self.lasty[aFullPNString] self.lastx[aFullPNString]=x self.lasty[aFullPNString]=y last_point_within_frame=self.withinframes([lastx,lasty]) lastymax=self.lastymax[aFullPNString] lastymin=self.lastymin[aFullPNString] if lastx!=None : dx=abs(lastx-x)