Python源码示例:PyQt4.QtCore.QObject.__init__()
示例1
def __init__(self,DATA):
self.data = DATA
QMainWindow.__init__(self)
# set up User Interface (widgets, layout...)
self.setupUi(self)
# --- specify graph and label objects as declared in the gui file
self.data.pLL.graph = self.graph_LL
self.data.pLL.label = self.label_LL
self.data.pMC.graph = self.graph_MC
self.data.pMC.label = self.label_MC
#combo box entries, dictionary
self.cb_scale_entries = {0:24,1:2,2:1,3:0.16}
self.range = self._get_range()
for p in self.data.parameters: p.range = self._get_range()
self._setup_signal_slots()
self._setup_graphs()
self._start_acquisition()
示例2
def __init__(self, document, parent=None):
"""
A wrapper class for configuration updaters. It starts the running of
Configuration version updater that is the first updater.
:param document: The QDomDocument of the configuration
:type document: QDomDocument
:param parent: The parent of the QObject, even though unused.
:type parent: QWidget/NoneType
"""
QObject.__init__(self, parent)
self.file_handler = FilePaths()
self.log_file_path = '{}/logs/migration.log'.format(
self.file_handler.localPath()
)
self.base_updater = ConfigurationVersionUpdater(
document, self.log_file_path
)
self.document = document
示例3
def __init__(self, document, log_file, parent=None):
"""
Initializes ConfigurationVersionUpdater.
:param document: The configuration to be updated.
:type document: QDomDocument
:param log_file: The log file object
:type log_file: file
:param parent: The parent of QObject
:type parent: QWidget/NoneType
"""
QObject.__init__(self, parent)
self.document = document
self.log_file = log_file
self.config = StdmConfiguration.instance()
self.config_utils = ConfigurationUtils(document)
self.profiles_detail = OrderedDict()
示例4
def __init__(self, parent=None, context=None, slice_direction_index_source=None):
QObject.__init__(self, parent)
self._context = context
self._slice_direction = slice_direction_index_source
self._current_index_label = QLabel("")
self._current_index_label.setDisabled(True)
# the select-index-widgets
self.index_s_box = self._set_up_index_widget()
# the min max settings widgets
self._min_active, self._min_spinbox = self._set_up_min_max_widgets()
self._max_active, self._max_spinbox = self._set_up_min_max_widgets()
self._initialize(self._context.slice_data_source().indexes_for_direction(self._slice_direction).tolist())
示例5
def __init__(self, canvas):
"""Constructor
:param canvas:
"""
QObject.__init__(self)
self.canvas = canvas
# Set up slots so we can mimic the behaviour of QGIS when layers
# are added.
LOGGER.debug('Initialising canvas...')
# noinspection PyArgumentList
QgsMapLayerRegistry.instance().layersAdded.connect(self.addLayers)
# noinspection PyArgumentList
QgsMapLayerRegistry.instance().layerWasAdded.connect(self.addLayer)
# noinspection PyArgumentList
QgsMapLayerRegistry.instance().removeAll.connect(self.removeAllLayers)
# For processing module
self.destCrs = None
示例6
def __init__(self,layer, tolerance, uid, errors, unlinks):
QObject.__init__(self)
self.layer = layer
self.feat_count = self.layer.featureCount()
self.tolerance = tolerance
self.uid = uid
self.errors = errors
self.errors_features = {}
self.unlinks = unlinks
self.unlinked_features = []
self.unlinks_count = 0
self.ml_keys = {}
self.br_keys = {}
self.features = []
self.attributes = {}
self.geometries = {}
self.geometries_wkt = {}
self.geometries_vertices = {}
# create spatial index object
self.spIndex = QgsSpatialIndex()
self.layer_fields = [QgsField(i.name(), i.type()) for i in self.layer.dataProvider().fields()]
示例7
def __init__(self, iface, tableName, user, apiKey, owner=None, sql=None, geoJSON=None,
filterByExtent=False, spatiaLite=None, readonly=False, multiuser=False, isSQL=False):
self.iface = iface
self.user = user
self._apiKey = apiKey
self.layerType = 'ogr'
self.owner = owner
self.isSQL = isSQL
self.multiuser = multiuser
# SQLite available?
driverName = "SQLite"
sqLiteDrv = ogr.GetDriverByName(driverName)
self.database_path = QgisCartoDB.CartoDBPlugin.PLUGIN_DIR + '/db/database.sqlite'
self.datasource = sqLiteDrv.Open(self.database_path, True)
self.layerName = tableName
self.cartoTable = tableName
self.readonly = False
self._deletedFeatures = []
self.sql = sql
self.forceReadOnly = False or readonly
if sql is None:
sql = 'SELECT * FROM ' + self._schema() + self.cartoTable
if filterByExtent:
extent = self.iface.mapCanvas().extent()
sql = sql + " WHERE ST_Intersects(ST_GeometryFromText('{}', 4326), the_geom)".format(extent.asWktPolygon())
else:
self.forceReadOnly = True
self._loadData(sql, geoJSON, spatiaLite)
示例8
def __init__(self, iface, tableName, owner=None, dlg=None, sql=None, filterByExtent=False, readonly=False, multiuser=False):
QObject.__init__(self)
self.iface = iface
self.owner = owner
self.tableName = tableName
self.readonly = readonly
self.multiuser = multiuser
self.dlg = dlg
self.sql = sql
self.filterByExtent = filterByExtent
self.loop = None
示例9
def __init__(self, iface):
QObject.__init__(self)
QgsMessageLog.logMessage('GDAL Version: ' + str(gdal.VersionInfo('VERSION_NUM')), 'CartoDB Plugin', QgsMessageLog.INFO)
# Save reference to the QGIS interface
self.iface = iface
# initialize locale
locale = QSettings().value("locale/userLocale")[0:2]
localePath = os.path.join(CartoDBPlugin.PLUGIN_DIR, "i18n", "{}.qm".format(locale))
if os.path.exists(localePath):
self.translator = QTranslator()
self.translator.load(localePath)
if qVersion() > '4.3.3':
QCoreApplication.installTranslator(self.translator)
# SQLite available?
driverName = "SQLite"
self.sqLiteDrv = ogr.GetDriverByName(driverName)
if self.sqLiteDrv is None:
QgsMessageLog.logMessage('SQLite driver not found', 'CartoDB Plugin', QgsMessageLog.CRITICAL)
else:
QgsMessageLog.logMessage('SQLite driver is found', 'CartoDB Plugin', QgsMessageLog.INFO)
self.databasePath = CartoDBPlugin.PLUGIN_DIR + '/db/database.sqlite'
shutil.copyfile(CartoDBPlugin.PLUGIN_DIR + '/db/init_database.sqlite', self.databasePath)
self.layers = []
self.countLoadingLayers = 0
self.countLoadedLayers = 0
self._cdbMenu = None
self._mainAction = None
self._loadDataAction = None
self._createVizAction = None
self._addSQLAction = None
self.toolbar = CartoDBToolbar()
self._toolbarAction = None
self._menu = None
示例10
def __init__(self, test):
QObject.__init__(self)
self.test = test
示例11
def __init__(self, cartodbUser, apiKey, multiuser=False, hostname='carto.com'):
QObject.__init__(self)
self.multiuser = multiuser
self.apiKey = apiKey
self.cartodbUser = cartodbUser
self.hostname = hostname
self.apiUrl = "https://{}.{}/api/v1/".format(cartodbUser, hostname)
self.returnDict = True
self.manager = QNetworkAccessManager()
self.manager.finished.connect(self.returnFetchContent)
示例12
def __init__(self, crazyflie):
QObject.__init__(self)
self.cf = crazyflie
self.cf.add_port_callback(CRTPPort.SYNC, self._new_packet_cb)
self.dif = 0
self.cf_time = 0
self.timer = QTimer()
self.timer.timeout.connect(self.send_synchronisation)
self.timer.setInterval(1000/5) #5hz
self.initialized = False
self.counter = 0
self.error = 0.
self.cpuTime = 0.
self.flieTime = 0.
self.t0 = rospy.Time.now().to_nsec()
示例13
def __init__(self):
QObject.__init__(self)
self._objectToBeDeleted = None
示例14
def __init__(self):
QObject.__init__(self)
# create custom properties
self._materialCache = None
self._mapCache = None
self._metaData = None
self._buffer = {}
self._state = {}
#------------------------------------------------------------------------------------------------------------------------
# protected methods
#------------------------------------------------------------------------------------------------------------------------
示例15
def __init__(self):
QObject.__init__(self)
示例16
def __init__(self,DATA):
Thread.__init__(self)
QObject.__init__(self)
DATA.wants_abort = False
self.data = DATA #client data object
示例17
def __init__(self,config):
self.name = config.get('LOCALHOST','name')
self.ip = config.get('LOCALHOST','ip')
self.port = config.getint('LOCALHOST','port')
示例18
def __init__(self,config,p_index,p_attr):
self.p_index = p_index
self.attribute_name = str(p_attr)
self.name = config.get(str(p_attr),'name')
self.values = np.array([])
self.timestamps = np.array([])
self.logging = bool(int(config.get(str(p_attr),'logging')))
self.check_history = False
示例19
def __init__(self,config):
self.debug = True
self.wants_abort = False
self.update_interval = config.getfloat('gui','update_interval')
p_instances = config.get('parameters','p').split(",") #parameter instance names
#instanciate parameter objects
self.parameters = [self.PARAMETER(config,i,p) for i,p in enumerate(p_instances)] #instanciate parameter array
for i,p_i in enumerate(p_instances): #create human readable aliases, such that objects are accessible from clients according to the seetings.cfg entry in []
setattr(self,str(p_i),self.parameters[i])
self.localhost = self.LOCALHOST(config)
示例20
def __init__(self,parent,container, actionRef=None, register=False):
from stdm.security.authorization import Authorizer
QObject.__init__(self,parent)
self._container = container
self._register = register
self._actionReference = actionRef
self._contentGroups = OrderedDict()
self._widgets = []
self._userName = stdm.data.app_dbconn.User.UserName
self._authorizer = Authorizer(stdm.data.app_dbconn.User.UserName)
self._iter = 0
self._separatorAction = None
示例21
def __init__(self, username, containerItem=None, parent=None):
from stdm.security.authorization import Authorizer
QObject.__init__(self,parent)
HashableMixin.__init__(self)
self._username = username
self._contentItems = []
self._authorizer = Authorizer(self._username)
self._containerItem = containerItem
示例22
def __init__(self, username, groupName, action=None):
ContentGroup.__init__(self, username, action)
self._groupName = groupName
self._createDbOpContent()
示例23
def __init__(self, document, parent=None):
QObject.__init__(self, parent)
self.file_handler = FilePaths()
self.log_file_path = '{}/logs/migration.log'.format(
self.file_handler.localPath()
)
self.document = document
self.base_updater = DatabaseVersionUpdater(
self.log_file_path
)
示例24
def __init__(self, log_file, parent=None):
"""
Database version updater that registers all database updaters.
:param log_file: The log file object
:type log_file: Object
:param parent: The parent of the QObject
:type parent: QWidget/NoneType
"""
QObject.__init__(self, parent)
self.config = StdmConfiguration.instance()
self.log_file = log_file
示例25
def __init__(self, parent=None):
QObject.__init__(self, parent)
self._min_active, self._min_spinbox = self._set_up_opt_spin_box()
self._min_active.toggled.connect(self._value_changed)
self._min_spinbox.valueChanged.connect(self._value_changed)
self._max_active, self._max_spinbox = self._set_up_opt_spin_box()
self._max_active.toggled.connect(self._value_changed)
self._max_spinbox.valueChanged.connect(self._value_changed)
示例26
def __init__(self, model):
self._min_xlim = 0
self._max_xlim = model.width
self._min_ylim = 0
self._max_ylim = model.height
示例27
def __init__(self, slice_models=[], slice_data_source=None, colormap='seismic', interpolation='nearest',
image_size=None, has_data=True):
QObject.__init__(self)
self._available_slice_models = slice_models
""" :type: list[SliceModel] """
self._slice_data_source = slice_data_source
""" :type: SliceDataSource """
self._slice_data_source.slice_data_source_changed.connect(self._reset)
self._colormap_name = colormap
self._show_indicators = False
self._global_min = None
self._global_max = None
self._user_min_value = None
self._user_max_value = None
self._samples_unit = "Time (ms)"
self._interpolation = interpolation
self._symmetric_scale = True
self._image_size = image_size
self._has_data = has_data
self._view_limits = {}
if self._has_data:
self._assign_indexes()
for model in self._available_slice_models:
self._view_limits[model.index_direction['name']] = ViewLimit(model)
示例28
def __init__(self):
super(EmptyDataSource, self).__init__()
self._data = np.zeros((2, 2), dtype=np.single)
self._data[0, 0] = -1.0
self._data[1, 1] = 1.0
self._xlines = [0, 1]
self._ilines = [0, 1]
self._samples = [] # changed to allow dims() calculate len(samples)
示例29
def __init__(self, features, uid, errors):
QObject.__init__(self)
self.features = features
self.last_fid = features[-1][0]
self.errors = errors
self.uid = uid
self.brkeys = {}
self.errors_features = {}
self.vertices_occur = {}
self.edges_occur = {}
self.f_dict = {}
self.self_loops = []
for i in self.features:
self.f_dict[i[0]] = [i[1], i[2]]
for vertex in vertices_from_wkt_2(i[2]):
break
first = vertex
for vertex in vertices_from_wkt_2(i[2]):
pass
last = vertex
try:
self.vertices_occur[first] += [i[0]]
except KeyError, e:
self.vertices_occur[first] = [i[0]]
try:
self.vertices_occur[last] += [i[0]]
except KeyError, e:
self.vertices_occur[last] = [i[0]]