def onEntry(self, event): n = QtCore.qrand() % self.m_stateCount + 1 while n == self.m_lastIndex: n = QtCore.qrand() % self.m_stateCount + 1 self.m_lastIndex = n self.machine().postEvent(StateSwitchEvent(n))
def runEaters(self): QtCore.qDebug('eaters.Eaters.newMap') self.placeholder = Placeholder(self) self.setCentralWidget(self.placeholder)
def __init__(self, mainwindow, ui_mainwindow): self.win = mainwindow self.ui = ui_mainwindow self.ui.setupUi(self.win) QtCore.pyqtRemoveInputHook() # to be called in __init__ of main-dialog-class addMPLToolBar(self.win, self.ui.canv) self.canv = self.ui.canv self.fig = self.canv.figure self.filehandler = self.streamhandler = None self.data = None self.daystream = None self.ppsd = None self.timer = QtCore.QTimer() connect(self.timer, signal('timeout()'), self.timerEvent) connect(self.ui.t1, signal('editingFinished()'), self.set_dates) connect(self.ui.t2, signal('editingFinished()'), self.set_dates) connect(self.ui.button, signal('clicked()'), self.add_ppsd) connect(self.ui.push_open, signal('clicked()'), self.open_ppsd) connect(self.ui.push_save, signal('clicked()'), self.save_ppsd) connect(self.ui.push_plot, signal('clicked()'), self.plot_ppsd) connect(self.ui.actionAdd_Console, signal('triggered()'), self.add_console) connect(self.ui.actionStart_IPython, signal('triggered()'), self.start_ipy) connect(self.ui.actionLogging_to_File, signal('triggered()'), self.logging_file) connect(self.ui.actionLogging_Window, signal('triggered()'), self.logging_window) self.set_dates() self.logging_window() log.info('Hallo')
def visualize(params, folder): #Check matching files list_files = glob.glob(folder+"/*_model*.dat"); print list_files; print "No. of files:", len(list_files); ### LOAD All the Models ### for model_file in list_files: model = pickle.load(open(model_file,'rb')); print ">Reading model :",model_file; print ">creating model..."; print model; ndmmodel = ndmModel.ndmModel(params['numI'], params['numH'], params['numO'], model['best_sol']); print ">model created!", type(ndmmodel); #visualise the model print ">visualizing model"; app = QtGui.QApplication(sys.argv); QtCore.qsrand(QtCore.QTime(0,0,0).secsTo(QtCore.QTime.currentTime())); widget2 = GraphWidget(ndmmodel,'Test Set'); widget2.show();
def keyPressEvent(self, event): key = event.key() if key == QtCore.Qt.Key_Up: self.centerNode.moveBy(0, -20) elif key == QtCore.Qt.Key_Down: self.centerNode.moveBy(0, 20) elif key == QtCore.Qt.Key_Left: self.centerNode.moveBy(-20, 0) elif key == QtCore.Qt.Key_Right: self.centerNode.moveBy(20, 0) elif key == QtCore.Qt.Key_Plus: self.scaleView(1.2) elif key == QtCore.Qt.Key_Minus: self.scaleView(1 / 1.2) elif key == QtCore.Qt.Key_A: node10=Node(self) self.s.addItem(node10) self.s.addItem(Edge(self.lastN, node10)) self.lastN=node10 elif key == QtCore.Qt.Key_Space or key == QtCore.Qt.Key_Enter: for item in self.scene().items(): if isinstance(item, Node): item.setPos(-150 + QtCore.qrand() % 300, -150 + QtCore.qrand() % 300) item.setScale(item.scale()*1.1) else: super(GraphWidget, self).keyPressEvent(event)
def paint(self, painter, option=None, widget=None): if self.validateImage(): wasSmoothPixmapTransform = painter.testRenderHint(QtGui.QPainter.SmoothPixmapTransform) painter.setRenderHint(QtGui.QPainter.SmoothPixmapTransform) if Colors.noRescale: # Let the painter scale the image for us. This may degrade # both quality and performance. if self.sharedImage.image is not None: painter.drawImage(self.pos(), self.sharedImage.image) else: painter.drawPixmap(self.pos(), self.sharedImage.pixmap) else: m = painter.worldMatrix() painter.setWorldMatrix(QtGui.QMatrix()) x = m.dx() y = m.dy() if self.noSubPixeling: x = QtCore.qRound(x) y = QtCore.qRound(y) if self.sharedImage.image is not None: painter.drawImage(QtCore.QPointF(x, y), self.sharedImage.image) else: painter.drawPixmap(QtCore.QPointF(x, y), self.sharedImage.pixmap) if not wasSmoothPixmapTransform: painter.setRenderHint(QtGui.QPainter.SmoothPixmapTransform, False)
def _got_notification(self, msg): try: msg_type, method, params = msgpack.unpackb(msg, encoding='utf-8') if msg_type != MSGPACKRPC_NOTIFICATION: self._rpc_error( 'Expected msgpack-rpc notification, but got: {}'.format( type)) return if method == 'registerChanged': idx, value = params self._reg_idx_to_object[idx].set_from_remote_notification(value) return if method == 'streamAcquisitionConfigChanged': time_span_seconds, points = params self._stream_acquisition_config = (time_span_seconds, points) self.stream_acquisition_config_changed.emit( *self._stream_acquisition_config) return if method == 'shutdown': self._shutdown() return QtC.qWarning( 'Received unknown notification type: {}{}'.format(method, params)) except Exception as e: self._rpc_error('Error while handling notification: {} ({})'.format(e, type(e)))
def meta_config(ui, repo, **opts): configFiles = ui.configlist('checkmeta', 'pattern_files', default=os.path.join(repo.root, ".hgmeta")) app = QtGui.QApplication(sys.argv) for fileName in configFiles: if not os.path.isfile(fileName): # noinspection PyTypeChecker choice = QtGui.QMessageBox.question( None, _("File missing"), _("The file {0} doesn't exist," " create it?").format(fileName), QtGui.QMessageBox.Yes | QtGui.QMessageBox.No ) QtCore.qDebug(str(choice)) if choice == QtGui.QMessageBox.Yes: # just create the file empty with open(fileName, 'a'): pass else: return dialog = CheckConfigurationDialog(ui, configFiles) dialog.show() app.exec_()
def listed(self, _file): if self._current_item is not None: crc = self._current_item[0] if crc in _file.name().toLower(): QtCore.qDebug("Found " + _file.name()) self._download(_file.name()) self._list_after_cd = False
def onNewFrame(self, frame, time): self.mutex.acquire() try: self.frameTime = time self.currCvFrame = frame # may need to make a deep copy (found, pos, view, allFish) = self.trackWidget.findFish(self.currCvFrame) if found: self.fishPosUpdate = found self.fishPos = pos self.allFish = allFish if not self.currState == State.OFF: self.arenaData['runs'][self.currRun]['video'].append((self.frameTime, None)) # if self.paramNumFish.value() == 1: # self.arenaData['runs'][self.currRun]['tracking'].append((self.frameTime, self.fishPos[0], self.fishPos[1])) # else: d = [self.frameTime, pos[0], pos[1]] for nFish in range(1, min(self.paramNumFish.value(),len(allFish))): d.append(allFish[nFish][0]) d.append(allFish[nFish][1]) # print d self.arenaData['runs'][self.currRun]['tracking'].append(tuple(d)) self.arenaView = view except: print 'CocaineController:onNewFrame failed' traceback.print_exc() QtCore.pyqtRemoveInputHook() ipdb.set_trace() finally: self.mutex.release()
def got_packet(self, packet): if packet.stream_idx != self.channel: return samples = packet.samples interval = packet.sample_interval_seconds pi = self.plotWidget.getPlotItem() x_range = len(samples) * interval if x_range != self._last_x_range: self._last_x_range = x_range pi.setRange(xRange=(0, self._last_x_range), padding = 0) self._add_extra_items_from_dict() if self._use_trigger(): try: samples = samples[packet.trigger_offset:] except IndexError: QtC.qCritical('Invalid trigger offset {} (have: {} samples)'. format(packet.trigger_offset, len(samples))) sample_times = np.linspace(0, (len(samples) - 1) * interval, len(samples)) self._plot_curve.setData(sample_times, samples)
def rescale(self): """ Redefine zoomer to set scale major ticks to one . see qwt_plot_zoomer.cpp line 343 """ plt = self.plot() if not plt: return rect = self.zoomStack()[self.zoomRectIndex()] if rect != self.scaleRect(): doReplot = plt.autoReplot() plt.setAutoReplot(False) x1 = rect.left() x2 = rect.right() if plt.axisScaleDiv(self.xAxis()).lowerBound() > plt.axisScaleDiv(self.xAxis()).upperBound(): QtCore.qSwap(x1, x2) # re-implemented axis so that there are only major ticks with step 1.0 # original CPP code: plt.setAxisScale(self.xAxis(), x1, x2) plt.setAxisScale(self.xAxis(), x1, x2, 1.0) y1 = rect.top() y2 = rect.bottom() if plt.axisScaleDiv(self.yAxis()).lowerBound() > plt.axisScaleDiv(self.yAxis()).upperBound(): QtCore.qSwap(y1, y2) plt.setAxisScale(self.yAxis(), y1, y2) plt.setAutoReplot(doReplot) plt.replot()
def updateExperimentalState(self): if not self.currState == State.OFF: self.mutex.acquire() try: t = time.time() #only update status bar if arena is selected. if self.isCurrent(): self.arenaMain.statusBar().showMessage('SwitchesCompleted: %d TimeSinceSwitch: %f' % (self.currSwitch, t - self.lastSwitchTime)) #handle State Changes if t >= self.lastSwitchTime + self.paramSwitchTime.value(): self.currSwitch += 1 self.lastSwitchTime = t if self.currSwitch > self.paramNumSwitches.value(): self.currState = State.OFF self.arenaData['runs'][self.currRun]['endTime'] = t self.startButton.setText('Start Switches') self.startButton.setChecked(False) self.paramGroup.setDisabled(False) self.infoGroup.setDisabled(False) self.updateProjectorDisplay() self.arenaData['runs'][self.currRun]['switchTimes'].append(t) self.saveResults() except: print 'CocaineController:updateState failed' traceback.print_exc() QtCore.pyqtRemoveInputHook() ipdb.set_trace() finally: self.mutex.release()
def __init__(self, argv=None, user_ns=None, user_global_ns=None, debug=0, shell_class=MTInteractiveShell): from PyQt4 import QtCore, QtGui try: # present in PyQt4-4.2.1 or later QtCore.pyqtRemoveInputHook() except AttributeError: pass if QtCore.PYQT_VERSION_STR == '4.3': warn('''PyQt4 version 4.3 detected. If you experience repeated threading warnings, please update PyQt4. ''') self.exec_ = hijack_qt4() # Allows us to use both Tk and QT. self.tk = get_tk() self.IP = make_IPython(argv, user_ns=user_ns, user_global_ns=user_global_ns, debug=debug, shell_class=shell_class, on_kill=[QtGui.qApp.exit]) # HACK: slot for banner in self; it will be passed to the mainloop # method only and .run() needs it. The actual value will be set by # .mainloop(). self._banner = None threading.Thread.__init__(self)
def initMap(self): QtCore.qDebug('sim_map.Map.initMap') self.timer = QtCore.QBasicTimer() self.setFrameStyle(QtGui.QFrame.Panel | QtGui.QFrame.Raised) self.objects = [] self.setFocusPolicy(QtCore.Qt.StrongFocus) self.setFixedSize(Map.MapWidth, Map.MapHeight) self.isStarted = False self.isPaused = False self.clearMap() self.dragXstart = -1 self.dragYstart = -1 self.dragXend = -1 self.dragYend = -1 self.dragObject = None self.mouseActionType = Map.NoAction self.saveToImage = True self.mapChanged = False self.robot = None self.target = None self.vbox = QtGui.QVBoxLayout() self.setLayout(self.vbox) self.simStats = SimStats(self)
def _channel_connection_failed(self, msg): QtC.qWarning('[{}] Connection failed: {}'.format( self.sender().resource.display_name, msg)) # Immediately rescan to swiftly recover from intermittent connection # problems. self.force_rescan.emit()
def saveMap(self, confirmation = False): QtCore.qDebug('simulator.Simulator.saveMap') if (not self.placeholder is None) and (not self.placeholder.simMap is None) and self.placeholder.simMap.changed(): if self.fname.length() > 0: msgBox = QtGui.QMessageBox(); msgBox.setText("The document has been modified."); msgBox.setInformativeText("Do you want to save your changes?"); msgBox.setStandardButtons(QtGui.QMessageBox.Save | QtGui.QMessageBox.Discard | QtGui.QMessageBox.Cancel); msgBox.setDefaultButton(QtGui.QMessageBox.Save); ret = msgBox.exec_(); if ret == QtGui.QMessageBox.Save: self.placeholder.simMap.save(self.fname) return True elif ret == QtGui.QMessageBox.Discard: return True else: return False else: fname = QtGui.QFileDialog.getSaveFileName(self, 'Save file map', '', 'Simulator maps (*.map)') if fname.length() > 0: self.fname = fname self.setWindowTitle(self.fname) if self.fname.length() > 0: self.placeholder.simMap.save(self.fname) print(self.fname) return True
def Main(): app = QtGui.QApplication(sys.argv) app.setWindowIcon(QtGui.QIcon(QtGui.QPixmap(":/ts2.png"))) qtTranslator = QtCore.QTranslator() qtTranslator.load("qt_" + QtCore.QLocale.system().name(), QtCore.QLibraryInfo.location( QtCore.QLibraryInfo.TranslationsPath)) app.installTranslator(qtTranslator) ts2Translator = QtCore.QTranslator() ts2Translator.load(QtCore.QLocale.system(), "ts2", "_", "i18n", ".qm") app.installTranslator(ts2Translator) QtCore.qDebug(QtCore.QLocale.system().name()) try: mw = mainwindow.MainWindow() mw.show() return app.exec_(); except: gui.dialogs.ExceptionDialog.popupException(None) #QMessageBox.critical(None, #QObject.trUtf8(QObject(), "Error"), #str(e), #QMessageBox.StandardButtons(QMessageBox.Ok)) return 1 else: return 0
def main(): """ This is where the main program execution begins. @return: None """ app = QtGui.QApplication(sys.argv) app.setStyle('Plastique') QtCore.qsrand(QtCore.QTime(0,0,0).secsTo(QtCore.QTime.currentTime())) #make a splash screen to show while application initializes screendir = os.path.dirname(os.path.abspath('__file__')) pixmap = QtGui.QPixmap(os.path.join(screendir,"SideMail/Resources/splashscreen.png")) splash = QtGui.QSplashScreen(pixmap, QtCore.Qt.WindowStaysOnTopHint) splash.setMask(pixmap.mask()) splash.show() splash.showMessage((u'Starting...'), QtCore.Qt.AlignRight | QtCore.Qt.AlignBottom, QtCore.Qt.yellow) app.processEvents() widget = SideMail() widget.show() #hide splash when done loading splash.finish(widget) sys.exit(app.exec_())
def insert_property(classdict,name,property_placeholder): notify_name = name + '_changed' notify = QtCore.pyqtSignal(property_placeholder.property_type) classdict[notify_name] = notify getter = property_placeholder.create_getter(name) setter = property_placeholder.create_full_setter(name,notify_name) classdict[name] = QtCore.pyqtProperty(property_placeholder.property_type,fget=getter,fset=setter,notify=notify)
def main(): app = QtGui.QApplication(sys.argv) QtCore.qsrand(QtCore.QTime(0,0,0).secsTo(QtCore.QTime.currentTime())) qtp = QtCore.QThreadPool(app).globalInstance() MainW= QtGui.QMainWindow() ui = MainWindow() ui.show() sys.exit(app.exec_())
def main(): """ Consolidate running the application. """ QtCore.pyqtRemoveInputHook() app = QtGui.QApplication(sys.argv) ugridviz = UgridViz() print app.exec_()
def setRange(self, minValue, maxValue): if minValue < 0 or maxValue > 99 or minValue > maxValue: QtCore.qWarning("LCDRange::setRange(%d, %d)\n" "\tRange must be 0..99\n" "\tand minValue must not be greater than maxValue" % (minValue, maxValue)) return self.slider.setRange(minValue, maxValue)
def breakpoint(): """ open up the python debugger here and poke around Very helpful, I should have figured this out ages ago! """ QtCore.pyqtRemoveInputHook() import pdb pdb.set_trace()
def __init__(self, target): super(LightningStrikesTransition, self).__init__() self.setEventSource(self) self.setEventType(QtCore.QEvent.Timer) self.setTargetState(target) QtCore.qsrand(QtCore.QDateTime.currentDateTime().toTime_t()) self.startTimer(1000)
def handleMessage(self): socket = self._server.nextPendingConnection() if socket.waitForReadyRead(self._timeout): self.emit(QtCore.SIGNAL('messageAvailable'), QtCore.QString.fromUtf8(socket.readAll().data())) socket.disconnectFromServer() else: QtCore.qDebug(socket.errorString().toLatin1())
def ipython(): debug.init() global main_window, app import __main__ if 'IPython' in __main__.__class__.__module__: QtCore.pyqtRemoveInputHook() compileUis() app, main_window = createWindow() return app, main_window
def _download(self, _filename): _local_filename = join( unicode(self.config.value("save_files_to").toString()), unicode(_filename)) _file = QtCore.QFile(_local_filename) _file.open(QtCore.QIODevice.WriteOnly) get = self.ftp.get(_filename, _file) QtCore.qDebug("Getting %s" % _filename) self._files[get] = _file
def importSet (module, name): """ Import a set of data """ QtCore.qWarning ("Importing %s" % name) try: __import__ (module) except dbapi2.IntegrityError, e: QtGui.QMessageBox.critical(None, QtGui.qApp.tr("Error importing data"), QtGui.qApp.tr("Message returned by database is:.\n" "\"%s\"" % e), QtGui.QMessageBox.Ok)
def drawBackgroundToPixmap(self): r = self.scene.sceneRect() self.background = QtGui.QPixmap(QtCore.qRound(r.width()), QtCore.qRound(r.height())) self.background.fill(QtCore.Qt.black) painter = QtGui.QPainter(self.background) bg = QtGui.QImage(':/images/demobg.png') painter.drawImage(0, 0, bg)
def showWidget(self): """Required for main modules to be inserted into the menu""" self.isVisible = True self.alarm_widget.setVisible(True) btns = ["CONTEXT"] self.emit(QtCore.SIGNAL('requestButtonPrompt'), btns)
def __init__(self, type, parent=None): super(ThumbListWidget, self).__init__(parent) self.setIconSize(QtCore.QSize(124, 124)) self.setDragDropMode(QtGui.QAbstractItemView.DragDrop) self.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection) self.setAcceptDrops(True)
def task(): wallet.synchronize() self.emit(QtCore.SIGNAL('accept'))
class Communicate(QtCore.QObject): closeApp = QtCore.pyqtSignal()
class DanbooruPoolWidget(QtGui.QWidget): poolDownloadRequested = QtCore.pyqtSignal(int) def __init__(self, api_data, parent=None): super(DanbooruPoolWidget, self).__init__(parent) loadUi(POOL_UI, self) self._api_data = api_data self._current_row = 0 self._page = 1 self._api_data.poolRetrieved.connect(self.add_row) self._api_data.poolDownloadFinished.connect(self.resize_columns) self.fetchButton.clicked.connect(self.fetch_pools) self.poolTable.itemDoubleClicked.connect(self.get_pool) self.setSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed) QtCore.QTimer.singleShot(2000, self.fetch_pools) def resize_columns(self): self.poolTable.resizeColumnsToContents() self.poolTable.resizeColumnToContents(3) def add_row(self, pool_item): current_row = self._current_row self.poolTable.insertRow(current_row) self._current_row += 1 pool_id = QtGui.QTableWidgetItem(pool_item.id) pool_name = QtGui.QTableWidgetItem(pool_item.name) pool_posts = QtGui.QTableWidgetItem(pool_item.post_count) pool_description = QtGui.QTableWidgetItem(pool_item.description) pool_id.setToolTip(kdecore.i18n("Double click to download")) pool_name.setToolTip(kdecore.i18n("Double click to download")) pool_posts.setToolTip(kdecore.i18n("Double click to download")) pool_description.setToolTip(kdecore.i18n("Double click to download")) pool_id.setData(QtCore.Qt.UserRole, QtCore.QVariant(pool_item.id)) pool_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(pool_item.id)) pool_posts.setData(QtCore.Qt.UserRole, QtCore.QVariant(pool_item.id)) pool_description.setData(QtCore.Qt.UserRole, QtCore.QVariant(pool_item.id)) self.poolTable.setItem(current_row, 0, pool_id) self.poolTable.setItem(current_row, 1, pool_name) self.poolTable.setItem(current_row, 2, pool_posts) self.poolTable.setItem(current_row, 3, pool_description) self.poolTable.sortItems(0, order=QtCore.Qt.DescendingOrder) #self.poolTable.resizeColumnsToContents() #self.poolTable.resizeColumnToContents(3) def clear(self): self.poolTable.clear() row_iterator = reversed(xrange(0, self.poolTable.rowCount())) column_iterator = reversed(xrange(0, self.poolTable.columnCount())) for row in row_iterator: self.poolTable.removeRow(row) self._current_row = 0 self._page = 1 def fetch_pools(self): self._api_data.get_pool_list(page=self._page) self._page += 1 def get_pool(self, table_item): pool_id = table_item.data(QtCore.Qt.UserRole).toPyObject() pool_id = int(unicode(pool_id)) self.poolDownloadRequested.emit(pool_id)
class SelectEventWindow(QtGui.QMainWindow): # Give the window a closed signal. This is necessary for the faked # multi-window application. closed = QtCore.pyqtSignal() # A signal that is emitted when the "Choose event" button has been clicked. event_chosen = QtCore.pyqtSignal(Event) def __init__(self, base_url): QtGui.QMainWindow.__init__(self) self.base_url = base_url self.ui = ui_select_event_window.Ui_SelectEventWindow() self.ui.setupUi(self) center_Qt_window(self) # Init event list and currently selected event. self.events = [] self.currently_selected_event = None self.current_selected_event_object = None self.init_widgets() self.connect_signals_and_slots() self.update_plot() def init_widgets(self): """ """ # Set the timeframe to the last two week. self.ui.starttime.setDateTime( UTCtoQDateTime(UTCDateTime() - 86000 * 14)) self.ui.endtime.setDateTime(UTCtoQDateTime(UTCDateTime())) self.ui.webView.setPage(GoogleMapsWebView()) map_file = os.path.abspath(os.path.join(os.path.dirname( inspect.getfile(inspect.currentframe())), "resources", "html_resources", "map.html")) self.ui.webView.load(QtCore.QUrl.fromLocalFile(map_file)) self.ui.webView.page().mainFrame().addToJavaScriptWindowObject("pyObj", self) def closeEvent(self, event): self.closed.emit() event.accept() @QtCore.pyqtSlot(str) def set_lat_long_bounds(self, bounds): """ Set the latitude longitude bounds as a string, e.g.: "((lat_ne, long_ne), (lat_sw, long_sw))" Used as a callback in the WebView JavaScript Code. """ self.north_east, self.south_west = [map(float, _i.split(", ")) \ for _i in str(bounds)[2:-2].split("), (")] self.ui.northeast_label.setText("%.3f, %.3f" % (self.north_east[0], self.north_east[1])) self.ui.southwest_label.setText("%.3f, %.3f" % (self.south_west[0], self.south_west[1])) @QtCore.pyqtSlot(str) def event_selected(self, event_id): """ Called when a new event has been selected. The event_id should be enough to identify it. Used as a callback in the WebView JavaScript Code. """ # Reset all detail object as soon as a new event is selected. Also # disable the "Choose event" button. self.ui.choose_event_button.setEnabled(False) self.ui.selected_event_p_phase_picks.setText("-") self.ui.selected_event_s_phase_picks.setText("-") self.ui.selected_event_warning.setText("") self.current_selected_event_object = None for event in self.events: if event["resource_name"] == event_id: self.currently_selected_event = event break # Handle an eventual error. if self.currently_selected_event is None: QtGui.QMessageBox.critical(self, "Error", "Selected event not found on the Python side. Please " + \ "contact the developer or fix the code yourself...") return ev = self.currently_selected_event self.ui.selected_event_id_label.setText(ev["resource_name"]) self.ui.selected_latitude_label.setText("%.4f" % ev["latitude"]) self.ui.selected_longitude_label.setText("%.4f" % ev["longitude"]) self.ui.selected_depth_label.setText("%.4f" % ev["depth"]) self.ui.selected_origin_time_label.setText(str(ev["datetime"])) self.ui.selected_magnitude_label.setText("%.3f %s" % \ (ev["magnitude"], ev["magnitude_type"])) # Last but not least enable the detail loading button. self.ui.selected_event_load_details.setEnabled(True) def connect_signals_and_slots(self): self.ui.search_events_button.clicked.connect(self.search_for_events) self.ui.selected_event_load_details.clicked.connect(\ self.load_event_object) self.ui.choose_event_button.clicked.connect(self.choose_event) self.ui.cancel_button.clicked.connect(self.close) def choose_event(self): if self.current_selected_event_object is None: QtGui.QMessageBox.critical(self, "Error", "The event object cannot be found... Please " + \ "contact the developer or fix the code yourself...") return self.event_chosen.emit(self.current_selected_event_object) self.close() def load_event_object(self): """ Loads the currently selected event from the Seishub database. """ if self.currently_selected_event is None: QtGui.QMessageBox.critical(self, "Error", "Selected event not found - something is wrong. Please " + \ "contact the developer or fix the code yourself...") return from obspy.seishub import Client client = Client(base_url=self.base_url) try: resource = client.event.getResource( \ self.currently_selected_event["resource_name"]) except Exception, e: error_type_str = e.__class__.__name__ msg_box = QtGui.QMessageBox() msg_box.setIcon(QtGui.QMessageBox.Critical) msg_box.setText("Retrieving event from the SeisHub server " + \ "failed!") msg_box.setDetailedText("{err_type}({message})".format( \ err_type=error_type_str, message=str(e))) msg_box.exec_() return file_object = StringIO.StringIO(resource) self.current_selected_event_object = \ readSeishubEventFile(file_object)[0] # Get the P and S wave pick counts. p_picks = len([_i for _i in self.current_selected_event_object.picks \ if _i.phase_hint == "P"]) s_picks = len([_i for _i in self.current_selected_event_object.picks \ if _i.phase_hint == "S"]) if p_picks == 0 and s_picks == 0: self.ui.selected_event_warning.setText( \ "Warning: Event has no associated picks.") return # If all is fine, update the pick count and enable the user to choose # the event. self.ui.selected_event_p_phase_picks.setText(str(p_picks)) self.ui.selected_event_s_phase_picks.setText(str(s_picks)) self.ui.choose_event_button.setEnabled(True)
def setupUi(self, Dialog): Dialog.setObjectName(_fromUtf8("Dialog")) Dialog.resize(860, 694) self.gridLayout_2 = QtGui.QGridLayout(Dialog) self.gridLayout_2.setMargin(3) self.gridLayout_2.setSpacing(3) self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2")) self.verticalLayout_7 = QtGui.QVBoxLayout() self.verticalLayout_7.setObjectName(_fromUtf8("verticalLayout_7")) self.horizontalLayout_22 = QtGui.QHBoxLayout() self.horizontalLayout_22.setObjectName( _fromUtf8("horizontalLayout_22")) self.label = QtGui.QLabel(Dialog) self.label.setFocusPolicy(QtCore.Qt.StrongFocus) self.label.setObjectName(_fromUtf8("label")) self.horizontalLayout_22.addWidget(self.label) spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_22.addItem(spacerItem) self.selectButton = QtGui.QPushButton(Dialog) self.selectButton.setFocusPolicy(QtCore.Qt.StrongFocus) self.selectButton.setObjectName(_fromUtf8("selectButton")) self.horizontalLayout_22.addWidget(self.selectButton) self.verticalLayout_7.addLayout(self.horizontalLayout_22) self.listWidget = QtGui.QListWidget(Dialog) self.listWidget.setFocusPolicy(QtCore.Qt.StrongFocus) self.listWidget.setObjectName(_fromUtf8("listWidget")) self.verticalLayout_7.addWidget(self.listWidget) self.horizontalLayout_15 = QtGui.QHBoxLayout() self.horizontalLayout_15.setObjectName( _fromUtf8("horizontalLayout_15")) self.countLabel = QtGui.QLabel(Dialog) self.countLabel.setFocusPolicy(QtCore.Qt.StrongFocus) self.countLabel.setObjectName(_fromUtf8("countLabel")) self.horizontalLayout_15.addWidget(self.countLabel) spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_15.addItem(spacerItem1) self.deleteButton = QtGui.QPushButton(Dialog) self.deleteButton.setFocusPolicy(QtCore.Qt.StrongFocus) self.deleteButton.setObjectName(_fromUtf8("deleteButton")) self.horizontalLayout_15.addWidget(self.deleteButton) self.verticalLayout_7.addLayout(self.horizontalLayout_15) self.gridLayout_2.addLayout(self.verticalLayout_7, 0, 0, 1, 1) self.dockWidget = QtGui.QDockWidget(Dialog) self.dockWidget.setFocusPolicy(QtCore.Qt.StrongFocus) self.dockWidget.setObjectName(_fromUtf8("dockWidget")) self.dockWidgetContents = QtGui.QWidget() self.dockWidgetContents.setObjectName(_fromUtf8("dockWidgetContents")) self.gridLayout_6 = QtGui.QGridLayout(self.dockWidgetContents) self.gridLayout_6.setMargin(0) self.gridLayout_6.setSpacing(0) self.gridLayout_6.setObjectName(_fromUtf8("gridLayout_6")) self.consoleEdit = QtGui.QPlainTextEdit(self.dockWidgetContents) self.consoleEdit.setFocusPolicy(QtCore.Qt.StrongFocus) self.consoleEdit.setFrameShape(QtGui.QFrame.NoFrame) self.consoleEdit.setFrameShadow(QtGui.QFrame.Raised) self.consoleEdit.setLineWrapMode(QtGui.QPlainTextEdit.WidgetWidth) self.consoleEdit.setReadOnly(True) self.consoleEdit.setObjectName(_fromUtf8("consoleEdit")) self.gridLayout_6.addWidget(self.consoleEdit, 0, 0, 1, 1) self.dockWidget.setWidget(self.dockWidgetContents) self.gridLayout_2.addWidget(self.dockWidget, 1, 0, 1, 2) self.verticalLayout_8 = QtGui.QVBoxLayout() self.verticalLayout_8.setObjectName(_fromUtf8("verticalLayout_8")) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) self.label_2 = QtGui.QLabel(Dialog) self.label_2.setFocusPolicy(QtCore.Qt.StrongFocus) self.label_2.setObjectName(_fromUtf8("label_2")) self.horizontalLayout.addWidget(self.label_2) self.offsetEdit = QtGui.QLineEdit(Dialog) self.offsetEdit.setEnabled(True) self.offsetEdit.setMinimumSize(QtCore.QSize(0, 0)) self.offsetEdit.setFocusPolicy(QtCore.Qt.StrongFocus) self.offsetEdit.setReadOnly(True) self.offsetEdit.setObjectName(_fromUtf8("offsetEdit")) self.horizontalLayout.addWidget(self.offsetEdit) self.offsetButton = QtGui.QToolButton(Dialog) self.offsetButton.setFocusPolicy(QtCore.Qt.StrongFocus) self.offsetButton.setText(_fromUtf8("")) self.offsetButton.setObjectName(_fromUtf8("offsetButton")) self.horizontalLayout.addWidget(self.offsetButton) self.verticalLayout_8.addLayout(self.horizontalLayout) self.horizontalLayout_11 = QtGui.QHBoxLayout() self.horizontalLayout_11.setObjectName( _fromUtf8("horizontalLayout_11")) self.verticalLayout_5 = QtGui.QVBoxLayout() self.verticalLayout_5.setObjectName(_fromUtf8("verticalLayout_5")) self.outlierGroup = QtGui.QGroupBox(Dialog) self.outlierGroup.setFocusPolicy(QtCore.Qt.StrongFocus) self.outlierGroup.setFlat(False) self.outlierGroup.setCheckable(True) self.outlierGroup.setObjectName(_fromUtf8("outlierGroup")) self.gridLayout_4 = QtGui.QGridLayout(self.outlierGroup) self.gridLayout_4.setObjectName(_fromUtf8("gridLayout_4")) self.horizontalLayout_8 = QtGui.QHBoxLayout() self.horizontalLayout_8.setObjectName(_fromUtf8("horizontalLayout_8")) self.label_7 = QtGui.QLabel(self.outlierGroup) self.label_7.setFocusPolicy(QtCore.Qt.StrongFocus) self.label_7.setObjectName(_fromUtf8("label_7")) self.horizontalLayout_8.addWidget(self.label_7) spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_8.addItem(spacerItem2) self.iqrWindowBox = QtGui.QSpinBox(self.outlierGroup) self.iqrWindowBox.setFocusPolicy(QtCore.Qt.StrongFocus) self.iqrWindowBox.setMaximum(9999) self.iqrWindowBox.setProperty("value", 365) self.iqrWindowBox.setObjectName(_fromUtf8("iqrWindowBox")) self.horizontalLayout_8.addWidget(self.iqrWindowBox) self.gridLayout_4.addLayout(self.horizontalLayout_8, 2, 0, 1, 1) self.horizontalLayout_6 = QtGui.QHBoxLayout() self.horizontalLayout_6.setObjectName(_fromUtf8("horizontalLayout_6")) self.label_5 = QtGui.QLabel(self.outlierGroup) self.label_5.setFocusPolicy(QtCore.Qt.StrongFocus) self.label_5.setObjectName(_fromUtf8("label_5")) self.horizontalLayout_6.addWidget(self.label_5) spacerItem3 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_6.addItem(spacerItem3) self.sigmaEdit = QtGui.QLineEdit(self.outlierGroup) self.sigmaEdit.setMaximumSize(QtCore.QSize(80, 16777215)) self.sigmaEdit.setFocusPolicy(QtCore.Qt.StrongFocus) self.sigmaEdit.setLayoutDirection(QtCore.Qt.LeftToRight) self.sigmaEdit.setInputMask(_fromUtf8("")) self.sigmaEdit.setObjectName(_fromUtf8("sigmaEdit")) self.horizontalLayout_6.addWidget(self.sigmaEdit) self.gridLayout_4.addLayout(self.horizontalLayout_6, 0, 0, 1, 1) self.verticalLayout_2 = QtGui.QVBoxLayout() self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2")) self.label_19 = QtGui.QLabel(self.outlierGroup) self.label_19.setFocusPolicy(QtCore.Qt.StrongFocus) self.label_19.setObjectName(_fromUtf8("label_19")) self.verticalLayout_2.addWidget(self.label_19) self.horizontalLayout_4 = QtGui.QHBoxLayout() self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4")) self.outlierDirEdit = QtGui.QLineEdit(self.outlierGroup) self.outlierDirEdit.setEnabled(True) self.outlierDirEdit.setFocusPolicy(QtCore.Qt.StrongFocus) self.outlierDirEdit.setReadOnly(True) self.outlierDirEdit.setObjectName(_fromUtf8("outlierDirEdit")) self.horizontalLayout_4.addWidget(self.outlierDirEdit) self.outlierDirButton = QtGui.QToolButton(self.outlierGroup) self.outlierDirButton.setFocusPolicy(QtCore.Qt.StrongFocus) self.outlierDirButton.setText(_fromUtf8("")) self.outlierDirButton.setObjectName(_fromUtf8("outlierDirButton")) self.horizontalLayout_4.addWidget(self.outlierDirButton) self.verticalLayout_2.addLayout(self.horizontalLayout_4) self.gridLayout_4.addLayout(self.verticalLayout_2, 3, 0, 1, 1) self.horizontalLayout_7 = QtGui.QHBoxLayout() self.horizontalLayout_7.setObjectName(_fromUtf8("horizontalLayout_7")) self.label_6 = QtGui.QLabel(self.outlierGroup) self.label_6.setFocusPolicy(QtCore.Qt.StrongFocus) self.label_6.setObjectName(_fromUtf8("label_6")) self.horizontalLayout_7.addWidget(self.label_6) spacerItem4 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_7.addItem(spacerItem4) self.iqrBox = QtGui.QSpinBox(self.outlierGroup) self.iqrBox.setFocusPolicy(QtCore.Qt.StrongFocus) self.iqrBox.setMaximum(5) self.iqrBox.setProperty("value", 1) self.iqrBox.setObjectName(_fromUtf8("iqrBox")) self.horizontalLayout_7.addWidget(self.iqrBox) self.gridLayout_4.addLayout(self.horizontalLayout_7, 1, 0, 1, 1) self.horizontalLayout_19 = QtGui.QHBoxLayout() self.horizontalLayout_19.setObjectName( _fromUtf8("horizontalLayout_19")) self.label_20 = QtGui.QLabel(self.outlierGroup) self.label_20.setFocusPolicy(QtCore.Qt.StrongFocus) self.label_20.setObjectName(_fromUtf8("label_20")) self.horizontalLayout_19.addWidget(self.label_20) spacerItem5 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_19.addItem(spacerItem5) self.outlierNameEdit = QtGui.QLineEdit(self.outlierGroup) self.outlierNameEdit.setFocusPolicy(QtCore.Qt.StrongFocus) self.outlierNameEdit.setObjectName(_fromUtf8("outlierNameEdit")) self.horizontalLayout_19.addWidget(self.outlierNameEdit) self.gridLayout_4.addLayout(self.horizontalLayout_19, 4, 0, 1, 1) self.verticalLayout_5.addWidget(self.outlierGroup) self.analysisGroup = QtGui.QGroupBox(Dialog) self.analysisGroup.setFocusPolicy(QtCore.Qt.StrongFocus) self.analysisGroup.setCheckable(True) self.analysisGroup.setObjectName(_fromUtf8("analysisGroup")) self.verticalLayout_9 = QtGui.QVBoxLayout(self.analysisGroup) self.verticalLayout_9.setObjectName(_fromUtf8("verticalLayout_9")) self.horizontalLayout_24 = QtGui.QHBoxLayout() self.horizontalLayout_24.setObjectName( _fromUtf8("horizontalLayout_24")) self.label_8 = QtGui.QLabel(self.analysisGroup) self.label_8.setFocusPolicy(QtCore.Qt.StrongFocus) self.label_8.setObjectName(_fromUtf8("label_8")) self.horizontalLayout_24.addWidget(self.label_8) spacerItem6 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_24.addItem(spacerItem6) self.polyBox = QtGui.QSpinBox(self.analysisGroup) self.polyBox.setFocusPolicy(QtCore.Qt.StrongFocus) self.polyBox.setProperty("value", 1) self.polyBox.setObjectName(_fromUtf8("polyBox")) self.horizontalLayout_24.addWidget(self.polyBox) self.verticalLayout_9.addLayout(self.horizontalLayout_24) self.horizontalLayout_25 = QtGui.QHBoxLayout() self.horizontalLayout_25.setObjectName( _fromUtf8("horizontalLayout_25")) self.label_9 = QtGui.QLabel(self.analysisGroup) self.label_9.setFocusPolicy(QtCore.Qt.StrongFocus) self.label_9.setObjectName(_fromUtf8("label_9")) self.horizontalLayout_25.addWidget(self.label_9) spacerItem7 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_25.addItem(spacerItem7) self.periodEdit = QtGui.QLineEdit(self.analysisGroup) self.periodEdit.setEnabled(True) self.periodEdit.setFocusPolicy(QtCore.Qt.StrongFocus) self.periodEdit.setObjectName(_fromUtf8("periodEdit")) self.horizontalLayout_25.addWidget(self.periodEdit) self.verticalLayout_9.addLayout(self.horizontalLayout_25) self.verticalLayout_3 = QtGui.QVBoxLayout() self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3")) self.label_10 = QtGui.QLabel(self.analysisGroup) self.label_10.setFocusPolicy(QtCore.Qt.StrongFocus) self.label_10.setObjectName(_fromUtf8("label_10")) self.verticalLayout_3.addWidget(self.label_10) self.horizontalLayout_5 = QtGui.QHBoxLayout() self.horizontalLayout_5.setObjectName(_fromUtf8("horizontalLayout_5")) self.logDirEdit = QtGui.QLineEdit(self.analysisGroup) self.logDirEdit.setEnabled(True) self.logDirEdit.setFocusPolicy(QtCore.Qt.StrongFocus) self.logDirEdit.setReadOnly(True) self.logDirEdit.setObjectName(_fromUtf8("logDirEdit")) self.horizontalLayout_5.addWidget(self.logDirEdit) self.logDirButton = QtGui.QToolButton(self.analysisGroup) self.logDirButton.setFocusPolicy(QtCore.Qt.StrongFocus) self.logDirButton.setText(_fromUtf8("")) self.logDirButton.setObjectName(_fromUtf8("logDirButton")) self.horizontalLayout_5.addWidget(self.logDirButton) self.verticalLayout_3.addLayout(self.horizontalLayout_5) self.verticalLayout_9.addLayout(self.verticalLayout_3) self.verticalLayout_4 = QtGui.QVBoxLayout() self.verticalLayout_4.setObjectName(_fromUtf8("verticalLayout_4")) self.label_11 = QtGui.QLabel(self.analysisGroup) self.label_11.setFocusPolicy(QtCore.Qt.StrongFocus) self.label_11.setObjectName(_fromUtf8("label_11")) self.verticalLayout_4.addWidget(self.label_11) self.horizontalLayout_9 = QtGui.QHBoxLayout() self.horizontalLayout_9.setObjectName(_fromUtf8("horizontalLayout_9")) self.saveDirEdit = QtGui.QLineEdit(self.analysisGroup) self.saveDirEdit.setEnabled(True) self.saveDirEdit.setFocusPolicy(QtCore.Qt.StrongFocus) self.saveDirEdit.setReadOnly(True) self.saveDirEdit.setObjectName(_fromUtf8("saveDirEdit")) self.horizontalLayout_9.addWidget(self.saveDirEdit) self.saveDirButton = QtGui.QToolButton(self.analysisGroup) self.saveDirButton.setFocusPolicy(QtCore.Qt.StrongFocus) self.saveDirButton.setText(_fromUtf8("")) self.saveDirButton.setObjectName(_fromUtf8("saveDirButton")) self.horizontalLayout_9.addWidget(self.saveDirButton) self.verticalLayout_4.addLayout(self.horizontalLayout_9) self.verticalLayout_9.addLayout(self.verticalLayout_4) self.horizontalLayout_10 = QtGui.QHBoxLayout() self.horizontalLayout_10.setObjectName( _fromUtf8("horizontalLayout_10")) self.label_14 = QtGui.QLabel(self.analysisGroup) self.label_14.setFocusPolicy(QtCore.Qt.StrongFocus) self.label_14.setObjectName(_fromUtf8("label_14")) self.horizontalLayout_10.addWidget(self.label_14) spacerItem8 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_10.addItem(spacerItem8) self.saveNameEdit = QtGui.QLineEdit(self.analysisGroup) self.saveNameEdit.setFocusPolicy(QtCore.Qt.StrongFocus) self.saveNameEdit.setObjectName(_fromUtf8("saveNameEdit")) self.horizontalLayout_10.addWidget(self.saveNameEdit) self.verticalLayout_9.addLayout(self.horizontalLayout_10) self.verticalLayout_5.addWidget(self.analysisGroup) self.horizontalLayout_11.addLayout(self.verticalLayout_5) self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.timeGroup = QtGui.QGroupBox(Dialog) self.timeGroup.setFocusPolicy(QtCore.Qt.StrongFocus) self.timeGroup.setCheckable(True) self.timeGroup.setObjectName(_fromUtf8("timeGroup")) self.gridLayout = QtGui.QGridLayout(self.timeGroup) self.gridLayout.setObjectName(_fromUtf8("gridLayout")) self.timeEdit = QtGui.QPlainTextEdit(self.timeGroup) self.timeEdit.setFocusPolicy(QtCore.Qt.StrongFocus) self.timeEdit.setLineWrapMode(QtGui.QPlainTextEdit.NoWrap) self.timeEdit.setObjectName(_fromUtf8("timeEdit")) self.gridLayout.addWidget(self.timeEdit, 0, 0, 1, 1) self.verticalLayout.addWidget(self.timeGroup) self.stackingGroup = QtGui.QGroupBox(Dialog) self.stackingGroup.setEnabled(False) self.stackingGroup.setFocusPolicy(QtCore.Qt.StrongFocus) self.stackingGroup.setCheckable(True) self.stackingGroup.setObjectName(_fromUtf8("stackingGroup")) self.gridLayout_3 = QtGui.QGridLayout(self.stackingGroup) self.gridLayout_3.setObjectName(_fromUtf8("gridLayout_3")) self.horizontalLayout_3 = QtGui.QHBoxLayout() self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3")) self.label_4 = QtGui.QLabel(self.stackingGroup) self.label_4.setFocusPolicy(QtCore.Qt.StrongFocus) self.label_4.setObjectName(_fromUtf8("label_4")) self.horizontalLayout_3.addWidget(self.label_4) spacerItem9 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_3.addItem(spacerItem9) self.cmeBox = QtGui.QComboBox(self.stackingGroup) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.cmeBox.sizePolicy().hasHeightForWidth()) self.cmeBox.setSizePolicy(sizePolicy) self.cmeBox.setFocusPolicy(QtCore.Qt.StrongFocus) self.cmeBox.setObjectName(_fromUtf8("cmeBox")) self.cmeBox.addItem(_fromUtf8("")) self.cmeBox.addItem(_fromUtf8("")) self.horizontalLayout_3.addWidget(self.cmeBox) self.gridLayout_3.addLayout(self.horizontalLayout_3, 0, 0, 1, 1) self.verticalLayout_6 = QtGui.QVBoxLayout() self.verticalLayout_6.setObjectName(_fromUtf8("verticalLayout_6")) self.label_3 = QtGui.QLabel(self.stackingGroup) self.label_3.setFocusPolicy(QtCore.Qt.StrongFocus) self.label_3.setObjectName(_fromUtf8("label_3")) self.verticalLayout_6.addWidget(self.label_3) self.horizontalLayout_2 = QtGui.QHBoxLayout() self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2")) self.cmeEdit = QtGui.QLineEdit(self.stackingGroup) self.cmeEdit.setEnabled(False) self.cmeEdit.setFocusPolicy(QtCore.Qt.StrongFocus) self.cmeEdit.setReadOnly(True) self.cmeEdit.setObjectName(_fromUtf8("cmeEdit")) self.horizontalLayout_2.addWidget(self.cmeEdit) self.cmeButton = QtGui.QToolButton(self.stackingGroup) self.cmeButton.setFocusPolicy(QtCore.Qt.StrongFocus) self.cmeButton.setText(_fromUtf8("")) self.cmeButton.setObjectName(_fromUtf8("cmeButton")) self.horizontalLayout_2.addWidget(self.cmeButton) self.verticalLayout_6.addLayout(self.horizontalLayout_2) self.gridLayout_3.addLayout(self.verticalLayout_6, 1, 0, 1, 1) self.verticalLayout.addWidget(self.stackingGroup) self.horizontalLayout_11.addLayout(self.verticalLayout) self.verticalLayout_8.addLayout(self.horizontalLayout_11) self.horizontalLayout_23 = QtGui.QHBoxLayout() self.horizontalLayout_23.setObjectName( _fromUtf8("horizontalLayout_23")) self.label_24 = QtGui.QLabel(Dialog) self.label_24.setFocusPolicy(QtCore.Qt.StrongFocus) self.label_24.setObjectName(_fromUtf8("label_24")) self.horizontalLayout_23.addWidget(self.label_24) self.progressBar = QtGui.QProgressBar(Dialog) self.progressBar.setFocusPolicy(QtCore.Qt.StrongFocus) self.progressBar.setProperty("value", 0) self.progressBar.setObjectName(_fromUtf8("progressBar")) self.horizontalLayout_23.addWidget(self.progressBar) self.batchButton = QtGui.QPushButton(Dialog) self.batchButton.setFocusPolicy(QtCore.Qt.StrongFocus) self.batchButton.setObjectName(_fromUtf8("batchButton")) self.horizontalLayout_23.addWidget(self.batchButton) self.verticalLayout_8.addLayout(self.horizontalLayout_23) self.gridLayout_2.addLayout(self.verticalLayout_8, 0, 1, 1, 1) self.retranslateUi(Dialog) QtCore.QMetaObject.connectSlotsByName(Dialog)
def setupUi(self, Dialog): Dialog.setObjectName(_fromUtf8("Dialog")) Dialog.resize(1028, 698) Dialog.setStyleSheet(_fromUtf8("background-color: rgb(91, 91, 91);")) self.groupBox = QtGui.QGroupBox(Dialog) self.groupBox.setGeometry(QtCore.QRect(0, -1, 1021, 91)) self.groupBox.setStyleSheet( _fromUtf8("background-color: rgb(153, 204, 204);")) self.groupBox.setObjectName(_fromUtf8("groupBox")) self.textEdit = QtGui.QTextEdit(self.groupBox) self.textEdit.setGeometry(QtCore.QRect(140, 24, 541, 21)) self.textEdit.setStyleSheet( _fromUtf8("background-color: rgb(255, 255, 255);")) self.textEdit.setObjectName(_fromUtf8("textEdit")) self.pushButton = QtGui.QPushButton(self.groupBox) self.pushButton.setGeometry(QtCore.QRect(140, 60, 83, 20)) self.pushButton.setStyleSheet( _fromUtf8("color: rgb(255, 255, 255);\n" "background-color: rgb(0, 192, 0);")) self.pushButton.setObjectName(_fromUtf8("pushButton")) self.pushButton_4 = QtGui.QPushButton(self.groupBox) self.pushButton_4.setGeometry(QtCore.QRect(230, 60, 83, 20)) self.pushButton_4.setStyleSheet( _fromUtf8("background-color: rgb(255, 220, 168);")) self.pushButton_4.setObjectName(_fromUtf8("pushButton_4")) self.groupBox_3 = QtGui.QGroupBox(self.groupBox) self.groupBox_3.setGeometry(QtCore.QRect(4, 20, 131, 61)) self.groupBox_3.setStyleSheet( _fromUtf8("background-color: rgb(51, 153, 204);")) self.groupBox_3.setObjectName(_fromUtf8("groupBox_3")) self.comboBox = QtGui.QComboBox(self.groupBox_3) self.comboBox.setGeometry(QtCore.QRect(10, 21, 111, 24)) self.comboBox.setStyleSheet( _fromUtf8("background-color: rgb(220, 220, 220);")) self.comboBox.setObjectName(_fromUtf8("comboBox")) self.label_2 = QtGui.QLabel(self.groupBox) self.label_2.setGeometry(QtCore.QRect(419, 49, 141, 12)) font = QtGui.QFont() font.setPointSize(7) self.label_2.setFont(font) self.label_2.setWordWrap(True) self.label_2.setObjectName(_fromUtf8("label_2")) self.pushButton_6 = QtGui.QPushButton(self.groupBox) self.pushButton_6.setGeometry(QtCore.QRect(952, 20, 51, 25)) self.pushButton_6.setStyleSheet( _fromUtf8("background-color: rgb(192, 192, 0);")) self.pushButton_6.setObjectName(_fromUtf8("pushButton_6")) self.comboBox_2 = QtGui.QComboBox(self.groupBox) self.comboBox_2.setGeometry(QtCore.QRect(420, 60, 121, 20)) self.comboBox_2.setStyleSheet( _fromUtf8("background-color: rgb(192, 192, 255);")) self.comboBox_2.setEditable(True) self.comboBox_2.setObjectName(_fromUtf8("comboBox_2")) self.comboBox_2.addItem(_fromUtf8("")) self.comboBox_2.addItem(_fromUtf8("")) self.comboBox_2.addItem(_fromUtf8("")) self.comboBox_2.addItem(_fromUtf8("")) self.comboBox_2.addItem(_fromUtf8("")) self.comboBox_2.addItem(_fromUtf8("")) self.comboBox_2.addItem(_fromUtf8("")) self.comboBox_2.addItem(_fromUtf8("")) self.comboBox_2.addItem(_fromUtf8("")) self.comboBox_2.addItem(_fromUtf8("")) self.comboBox_2.addItem(_fromUtf8("")) self.comboBox_2.addItem(_fromUtf8("")) self.comboBox_2.addItem(_fromUtf8("")) self.comboBox_2.addItem(_fromUtf8("")) self.comboBox_2.addItem(_fromUtf8("")) self.comboBox_2.addItem(_fromUtf8("")) self.comboBox_2.addItem(_fromUtf8("")) self.pushButton_2 = QtGui.QPushButton(self.groupBox) self.pushButton_2.setGeometry(QtCore.QRect(320, 60, 91, 20)) self.pushButton_2.setStyleSheet( _fromUtf8("background-color: rgb(255, 220, 168);")) self.pushButton_2.setObjectName(_fromUtf8("pushButton_2")) self.groupBox_2 = QtGui.QGroupBox(Dialog) self.groupBox_2.setGeometry(QtCore.QRect(0, 100, 1021, 561)) self.groupBox_2.setStyleSheet(_fromUtf8("color: rgb(204, 255, 102);")) self.groupBox_2.setObjectName(_fromUtf8("groupBox_2")) self.textEdit_2 = QtGui.QTextEdit(self.groupBox_2) self.textEdit_2.setGeometry(QtCore.QRect(6, 20, 1009, 523)) font = QtGui.QFont() font.setFamily(_fromUtf8("Courier")) font.setPointSize(10) self.textEdit_2.setFont(font) self.textEdit_2.setStyleSheet( _fromUtf8("background-color: rgb(248, 255, 238);\n" "color: rgb(7, 7, 7);")) self.textEdit_2.setObjectName(_fromUtf8("textEdit_2")) self.label_4 = QtGui.QLabel(self.groupBox_2) self.label_4.setGeometry(QtCore.QRect(10, 546, 231, 12)) font = QtGui.QFont() font.setPointSize(10) self.label_4.setFont(font) self.label_4.setObjectName(_fromUtf8("label_4")) self.label = QtGui.QLabel(Dialog) self.label.setGeometry(QtCore.QRect(7, 675, 641, 16)) self.label.setStyleSheet(_fromUtf8("color: rgb(102, 204, 51);")) self.label.setObjectName(_fromUtf8("label")) self.label_3 = QtGui.QLabel(Dialog) self.label_3.setGeometry(QtCore.QRect(140, 90, 431, 16)) self.label_3.setStyleSheet(_fromUtf8("color: rgb(255, 255, 204);")) self.label_3.setObjectName(_fromUtf8("label_3")) self.pushButton_5 = QtGui.QPushButton(Dialog) self.pushButton_5.setGeometry(QtCore.QRect(830, 670, 83, 20)) self.pushButton_5.setStyleSheet( _fromUtf8("background-color: rgb(0, 128, 128);\n" "color: rgb(255, 255, 255);")) self.pushButton_5.setObjectName(_fromUtf8("pushButton_5")) self.pushButton_3 = QtGui.QPushButton(Dialog) self.pushButton_3.setGeometry(QtCore.QRect(930, 670, 83, 20)) self.pushButton_3.setStyleSheet( _fromUtf8("background-color: rgb(255, 46, 10);\n" "color: rgb(255, 255, 255);")) self.pushButton_3.setObjectName(_fromUtf8("pushButton_3")) self.retranslateUi(Dialog) QtCore.QObject.connect(self.pushButton_3, QtCore.SIGNAL(_fromUtf8("clicked()")), Dialog.close) QtCore.QMetaObject.connectSlotsByName(Dialog)
def setupUi(self, frmStorageVisionConfig): frmStorageVisionConfig.setObjectName("frmStorageVisionConfig") frmStorageVisionConfig.resize(622, 325) frmStorageVisionConfig.setFrameShape(QtGui.QFrame.StyledPanel) frmStorageVisionConfig.setFrameShadow(QtGui.QFrame.Raised) self.gridLayout_2 = QtGui.QGridLayout(frmStorageVisionConfig) self.gridLayout_2.setObjectName("gridLayout_2") self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.label = QtGui.QLabel(frmStorageVisionConfig) self.label.setObjectName("label") self.horizontalLayout.addWidget(self.label) self.lineEditFolder = QtGui.QLineEdit(frmStorageVisionConfig) self.lineEditFolder.setObjectName("lineEditFolder") self.horizontalLayout.addWidget(self.lineEditFolder) self.pushButtonBrowse = QtGui.QPushButton(frmStorageVisionConfig) self.pushButtonBrowse.setObjectName("pushButtonBrowse") self.horizontalLayout.addWidget(self.pushButtonBrowse) self.gridLayout_2.addLayout(self.horizontalLayout, 0, 0, 1, 1) self.checkBoxAutoFile = QtGui.QCheckBox(frmStorageVisionConfig) self.checkBoxAutoFile.setObjectName("checkBoxAutoFile") self.gridLayout_2.addWidget(self.checkBoxAutoFile, 2, 0, 1, 1) self.gridLayout = QtGui.QGridLayout() self.gridLayout.setObjectName("gridLayout") self.label_2 = QtGui.QLabel(frmStorageVisionConfig) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 0, 1, 1, 1) self.lineEditPrefix = QtGui.QLineEdit(frmStorageVisionConfig) self.lineEditPrefix.setObjectName("lineEditPrefix") self.gridLayout.addWidget(self.lineEditPrefix, 0, 2, 1, 1) self.label_3 = QtGui.QLabel(frmStorageVisionConfig) self.label_3.setObjectName("label_3") self.gridLayout.addWidget(self.label_3, 1, 1, 1, 1) self.lineEditCounterSize = QtGui.QLineEdit(frmStorageVisionConfig) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.lineEditCounterSize.sizePolicy().hasHeightForWidth()) self.lineEditCounterSize.setSizePolicy(sizePolicy) self.lineEditCounterSize.setMaximumSize(QtCore.QSize(50, 16777215)) self.lineEditCounterSize.setAlignment(QtCore.Qt.AlignCenter) self.lineEditCounterSize.setObjectName("lineEditCounterSize") self.gridLayout.addWidget(self.lineEditCounterSize, 1, 2, 1, 1) spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.gridLayout.addItem(spacerItem, 0, 3, 1, 1) spacerItem1 = QtGui.QSpacerItem(30, 20, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum) self.gridLayout.addItem(spacerItem1, 0, 0, 1, 1) self.label_4 = QtGui.QLabel(frmStorageVisionConfig) self.label_4.setObjectName("label_4") self.gridLayout.addWidget(self.label_4, 2, 1, 1, 1) self.labelExample = QtGui.QLabel(frmStorageVisionConfig) self.labelExample.setEnabled(False) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.labelExample.sizePolicy().hasHeightForWidth()) self.labelExample.setSizePolicy(sizePolicy) self.labelExample.setMinimumSize(QtCore.QSize(0, 23)) self.labelExample.setFrameShape(QtGui.QFrame.Panel) self.labelExample.setFrameShadow(QtGui.QFrame.Sunken) self.labelExample.setObjectName("labelExample") self.gridLayout.addWidget(self.labelExample, 2, 2, 1, 1) self.gridLayout_2.addLayout(self.gridLayout, 3, 0, 1, 1) spacerItem2 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.gridLayout_2.addItem(spacerItem2, 7, 0, 1, 1) self.horizontalLayout_2 = QtGui.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.label_5 = QtGui.QLabel(frmStorageVisionConfig) self.label_5.setObjectName("label_5") self.horizontalLayout_2.addWidget(self.label_5) self.lineEditSpace = QtGui.QLineEdit(frmStorageVisionConfig) self.lineEditSpace.setMaximumSize(QtCore.QSize(60, 16777215)) self.lineEditSpace.setAlignment(QtCore.Qt.AlignCenter) self.lineEditSpace.setObjectName("lineEditSpace") self.horizontalLayout_2.addWidget(self.lineEditSpace) self.label_6 = QtGui.QLabel(frmStorageVisionConfig) self.label_6.setObjectName("label_6") self.horizontalLayout_2.addWidget(self.label_6) spacerItem3 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_2.addItem(spacerItem3) self.gridLayout_2.addLayout(self.horizontalLayout_2, 5, 0, 1, 1) spacerItem4 = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) self.gridLayout_2.addItem(spacerItem4, 4, 0, 1, 1) spacerItem5 = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) self.gridLayout_2.addItem(spacerItem5, 1, 0, 1, 1) self.retranslateUi(frmStorageVisionConfig) QtCore.QMetaObject.connectSlotsByName(frmStorageVisionConfig)
def setupUi(self, Form): Form.setObjectName(_fromUtf8("Form")) Form.resize(938, 496) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(_fromUtf8("../style/img/scope.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) Form.setWindowIcon(icon) self.gridLayout_8 = QtGui.QGridLayout(Form) self.gridLayout_8.setSpacing(0) self.gridLayout_8.setContentsMargins(0, 0, 0, 2) self.gridLayout_8.setObjectName(_fromUtf8("gridLayout_8")) self.split_left = QtGui.QSplitter(Form) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.split_left.sizePolicy().hasHeightForWidth()) self.split_left.setSizePolicy(sizePolicy) self.split_left.setOrientation(QtCore.Qt.Horizontal) self.split_left.setObjectName(_fromUtf8("split_left")) self.fr_left = QtGui.QFrame(self.split_left) self.fr_left.setFrameShape(QtGui.QFrame.NoFrame) self.fr_left.setFrameShadow(QtGui.QFrame.Raised) self.fr_left.setObjectName(_fromUtf8("fr_left")) self.gridLayout_5 = QtGui.QGridLayout(self.fr_left) self.gridLayout_5.setSpacing(0) self.gridLayout_5.setContentsMargins(1, 1, 0, 0) self.gridLayout_5.setObjectName(_fromUtf8("gridLayout_5")) self.tab_left = QtGui.QTabWidget(self.fr_left) self.tab_left.setObjectName(_fromUtf8("tab_left")) self.gridLayout_5.addWidget(self.tab_left, 0, 0, 1, 1) self.fr_right = QtGui.QFrame(self.split_left) self.fr_right.setFrameShape(QtGui.QFrame.NoFrame) self.fr_right.setFrameShadow(QtGui.QFrame.Raised) self.fr_right.setObjectName(_fromUtf8("fr_right")) self.gridLayout_7 = QtGui.QGridLayout(self.fr_right) self.gridLayout_7.setSpacing(0) self.gridLayout_7.setContentsMargins(1, 0, 0, 4) self.gridLayout_7.setObjectName(_fromUtf8("gridLayout_7")) self.fr_bottom = QtGui.QFrame(self.fr_right) self.fr_bottom.setFrameShape(QtGui.QFrame.NoFrame) self.fr_bottom.setFrameShadow(QtGui.QFrame.Raised) self.fr_bottom.setObjectName(_fromUtf8("fr_bottom")) self.horizontalLayout_2 = QtGui.QHBoxLayout(self.fr_bottom) self.horizontalLayout_2.setSpacing(0) self.horizontalLayout_2.setMargin(0) self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2")) self.gridLayout_7.addWidget(self.fr_bottom, 1, 0, 1, 1) self.split_bottom = QtGui.QSplitter(self.fr_right) self.split_bottom.setOrientation(QtCore.Qt.Vertical) self.split_bottom.setObjectName(_fromUtf8("split_bottom")) self.split_right = QtGui.QSplitter(self.split_bottom) self.split_right.setOrientation(QtCore.Qt.Horizontal) self.split_right.setObjectName(_fromUtf8("split_right")) self.sw_main = QtGui.QStackedWidget(self.split_right) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.sw_main.sizePolicy().hasHeightForWidth()) self.sw_main.setSizePolicy(sizePolicy) self.sw_main.setObjectName(_fromUtf8("sw_main")) self.tab_right = QtGui.QTabWidget(self.split_right) self.tab_right.setObjectName(_fromUtf8("tab_right")) self.sw_bottom = QtGui.QStackedWidget(self.split_bottom) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.sw_bottom.sizePolicy().hasHeightForWidth()) self.sw_bottom.setSizePolicy(sizePolicy) self.sw_bottom.setStyleSheet( _fromUtf8("QStackedWidget#sw_bottom {\n" "border-top:1px solid rgb(80,80,80);\n" "}")) self.sw_bottom.setObjectName(_fromUtf8("sw_bottom")) self.page = QtGui.QWidget() self.page.setObjectName(_fromUtf8("page")) self.sw_bottom.addWidget(self.page) self.gridLayout_7.addWidget(self.split_bottom, 0, 0, 1, 1) self.l_statusbar = QtGui.QLabel(self.fr_right) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Ignored, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.l_statusbar.sizePolicy().hasHeightForWidth()) self.l_statusbar.setSizePolicy(sizePolicy) self.l_statusbar.setStyleSheet( _fromUtf8("QLabel {\n" "padding-left:2px;\n" "padding-top:2px;\n" "}")) self.l_statusbar.setText(_fromUtf8("")) self.l_statusbar.setObjectName(_fromUtf8("l_statusbar")) self.gridLayout_7.addWidget(self.l_statusbar, 2, 0, 1, 1) self.gridLayout_8.addWidget(self.split_left, 1, 1, 1, 1) self.fr_leftbar = QtGui.QFrame(Form) self.fr_leftbar.setMaximumSize(QtCore.QSize(44, 16777215)) self.fr_leftbar.setFrameShape(QtGui.QFrame.NoFrame) self.fr_leftbar.setFrameShadow(QtGui.QFrame.Raised) self.fr_leftbar.setObjectName(_fromUtf8("fr_leftbar")) self.verticalLayout = QtGui.QVBoxLayout(self.fr_leftbar) self.verticalLayout.setSpacing(0) self.verticalLayout.setMargin(0) self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.b_show_tabs = QtGui.QPushButton(self.fr_leftbar) self.b_show_tabs.setMinimumSize(QtCore.QSize(0, 50)) self.b_show_tabs.setText(_fromUtf8("")) icon1 = QtGui.QIcon() icon1.addPixmap( QtGui.QPixmap(_fromUtf8("../style/img/window_switcher.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.b_show_tabs.setIcon(icon1) self.b_show_tabs.setIconSize(QtCore.QSize(32, 32)) self.b_show_tabs.setCheckable(True) self.b_show_tabs.setProperty("class", _fromUtf8("")) self.b_show_tabs.setObjectName(_fromUtf8("b_show_tabs")) self.verticalLayout.addWidget(self.b_show_tabs) self.b_new = QtGui.QPushButton(self.fr_leftbar) self.b_new.setText(_fromUtf8("")) icon2 = QtGui.QIcon() icon2.addPixmap(QtGui.QPixmap(_fromUtf8("../style/img/new_file.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.b_new.setIcon(icon2) self.b_new.setIconSize(QtCore.QSize(32, 32)) self.b_new.setObjectName(_fromUtf8("b_new")) self.verticalLayout.addWidget(self.b_new) self.b_workspaces = QtGui.QPushButton(self.fr_leftbar) self.b_workspaces.setText(_fromUtf8("")) icon3 = QtGui.QIcon() icon3.addPixmap(QtGui.QPixmap(_fromUtf8("../style/img/workspace.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.b_workspaces.setIcon(icon3) self.b_workspaces.setIconSize(QtCore.QSize(32, 32)) self.b_workspaces.setObjectName(_fromUtf8("b_workspaces")) self.verticalLayout.addWidget(self.b_workspaces) self.b_home = QtGui.QPushButton(self.fr_leftbar) self.b_home.setText(_fromUtf8("")) icon4 = QtGui.QIcon() icon4.addPixmap(QtGui.QPixmap(_fromUtf8("../style/img/home.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.b_home.setIcon(icon4) self.b_home.setIconSize(QtCore.QSize(32, 32)) self.b_home.setObjectName(_fromUtf8("b_home")) self.verticalLayout.addWidget(self.b_home) self.b_settings = QtGui.QPushButton(self.fr_leftbar) self.b_settings.setText(_fromUtf8("")) icon5 = QtGui.QIcon() icon5.addPixmap(QtGui.QPixmap(_fromUtf8("../style/img/settings.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.b_settings.setIcon(icon5) self.b_settings.setIconSize(QtCore.QSize(32, 32)) self.b_settings.setObjectName(_fromUtf8("b_settings")) self.verticalLayout.addWidget(self.b_settings) spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout.addItem(spacerItem) self.gridLayout_8.addWidget(self.fr_leftbar, 1, 0, 1, 1) self.fr_topbar = QtGui.QFrame(Form) self.fr_topbar.setMinimumSize(QtCore.QSize(0, 34)) self.fr_topbar.setMaximumSize(QtCore.QSize(16777215, 34)) self.fr_topbar.setFrameShape(QtGui.QFrame.NoFrame) self.fr_topbar.setFrameShadow(QtGui.QFrame.Plain) self.fr_topbar.setObjectName(_fromUtf8("fr_topbar")) self.gridLayout_2 = QtGui.QGridLayout(self.fr_topbar) self.gridLayout_2.setMargin(0) self.gridLayout_2.setSpacing(0) self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2")) self.fr_topleft = QtGui.QFrame(self.fr_topbar) self.fr_topleft.setFrameShape(QtGui.QFrame.NoFrame) self.fr_topleft.setFrameShadow(QtGui.QFrame.Raised) self.fr_topleft.setObjectName(_fromUtf8("fr_topleft")) self.gridLayout_3 = QtGui.QGridLayout(self.fr_topleft) self.gridLayout_3.setContentsMargins(6, 0, 0, 0) self.gridLayout_3.setHorizontalSpacing(2) self.gridLayout_3.setVerticalSpacing(0) self.gridLayout_3.setObjectName(_fromUtf8("gridLayout_3")) self.fr_find = QtGui.QFrame(self.fr_topleft) self.fr_find.setMaximumSize(QtCore.QSize(250, 16777215)) self.fr_find.setStyleSheet(_fromUtf8("")) self.fr_find.setFrameShape(QtGui.QFrame.NoFrame) self.fr_find.setFrameShadow(QtGui.QFrame.Raised) self.fr_find.setObjectName(_fromUtf8("fr_find")) self.gridLayout_4 = QtGui.QGridLayout(self.fr_find) self.gridLayout_4.setMargin(0) self.gridLayout_4.setSpacing(0) self.gridLayout_4.setObjectName(_fromUtf8("gridLayout_4")) self.fr_find_2 = QtGui.QFrame(self.fr_find) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.fr_find_2.sizePolicy().hasHeightForWidth()) self.fr_find_2.setSizePolicy(sizePolicy) self.fr_find_2.setFrameShape(QtGui.QFrame.NoFrame) self.fr_find_2.setFrameShadow(QtGui.QFrame.Raised) self.fr_find_2.setObjectName(_fromUtf8("fr_find_2")) self.gridLayout_9 = QtGui.QGridLayout(self.fr_find_2) self.gridLayout_9.setMargin(0) self.gridLayout_9.setSpacing(0) self.gridLayout_9.setObjectName(_fromUtf8("gridLayout_9")) self.le_find = QtGui.QLineEdit(self.fr_find_2) self.le_find.setMinimumSize(QtCore.QSize(150, 24)) self.le_find.setStyleSheet( _fromUtf8("background:transparent;\n" "border:0px;\n" "padding-left:4px;")) self.le_find.setObjectName(_fromUtf8("le_find")) self.gridLayout_9.addWidget(self.le_find, 0, 0, 1, 1) self.b_find = QtGui.QPushButton(self.fr_find_2) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.b_find.sizePolicy().hasHeightForWidth()) self.b_find.setSizePolicy(sizePolicy) self.b_find.setMaximumSize(QtCore.QSize(28, 16777215)) self.b_find.setText(_fromUtf8("")) icon6 = QtGui.QIcon() icon6.addPixmap(QtGui.QPixmap(_fromUtf8("../style/img/search.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.b_find.setIcon(icon6) self.b_find.setObjectName(_fromUtf8("b_find")) self.gridLayout_9.addWidget(self.b_find, 0, 1, 1, 1) self.gridLayout_4.addWidget(self.fr_find_2, 0, 3, 1, 1) self.le_goto = QtGui.QLineEdit(self.fr_find) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.le_goto.sizePolicy().hasHeightForWidth()) self.le_goto.setSizePolicy(sizePolicy) self.le_goto.setMinimumSize(QtCore.QSize(40, 24)) self.le_goto.setMaximumSize(QtCore.QSize(50, 16777215)) self.le_goto.setStyleSheet(_fromUtf8("padding-left:4px;")) self.le_goto.setObjectName(_fromUtf8("le_goto")) self.gridLayout_4.addWidget(self.le_goto, 0, 1, 1, 1) spacerItem1 = QtGui.QSpacerItem(10, 10, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum) self.gridLayout_4.addItem(spacerItem1, 0, 2, 1, 1) self.gridLayout_3.addWidget(self.fr_find, 0, 4, 1, 1) self.gridLayout_2.addWidget(self.fr_topleft, 0, 8, 1, 1) self.fr_tab = QtGui.QFrame(self.fr_topbar) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.fr_tab.sizePolicy().hasHeightForWidth()) self.fr_tab.setSizePolicy(sizePolicy) self.fr_tab.setFrameShape(QtGui.QFrame.NoFrame) self.fr_tab.setFrameShadow(QtGui.QFrame.Raised) self.fr_tab.setObjectName(_fromUtf8("fr_tab")) self.gridLayout_6 = QtGui.QGridLayout(self.fr_tab) self.gridLayout_6.setContentsMargins(0, 0, 2, 0) self.gridLayout_6.setHorizontalSpacing(2) self.gridLayout_6.setVerticalSpacing(0) self.gridLayout_6.setObjectName(_fromUtf8("gridLayout_6")) self.l_filename = QtGui.QLabel(self.fr_tab) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.l_filename.sizePolicy().hasHeightForWidth()) self.l_filename.setSizePolicy(sizePolicy) font = QtGui.QFont() font.setPointSize(10) self.l_filename.setFont(font) self.l_filename.setText(_fromUtf8("")) self.l_filename.setObjectName(_fromUtf8("l_filename")) self.gridLayout_6.addWidget(self.l_filename, 0, 4, 1, 1) self.b_tabicon = QtGui.QPushButton(self.fr_tab) self.b_tabicon.setMaximumSize(QtCore.QSize(26, 16777215)) self.b_tabicon.setText(_fromUtf8("")) self.b_tabicon.setIconSize(QtCore.QSize(20, 20)) self.b_tabicon.setObjectName(_fromUtf8("b_tabicon")) self.gridLayout_6.addWidget(self.b_tabicon, 0, 3, 1, 1) self.l_title_prefix = QtGui.QLabel(self.fr_tab) font = QtGui.QFont() font.setPointSize(10) self.l_title_prefix.setFont(font) self.l_title_prefix.setText(_fromUtf8("")) self.l_title_prefix.setObjectName(_fromUtf8("l_title_prefix")) self.gridLayout_6.addWidget(self.l_title_prefix, 0, 2, 1, 1) self.b_closetab = QtGui.QPushButton(self.fr_tab) self.b_closetab.setMaximumSize(QtCore.QSize(26, 16777215)) self.b_closetab.setObjectName(_fromUtf8("b_closetab")) self.gridLayout_6.addWidget(self.b_closetab, 0, 5, 1, 1) self.gridLayout_2.addWidget(self.fr_tab, 0, 1, 1, 1) self.fr_mainbutton = QtGui.QFrame(self.fr_topbar) self.fr_mainbutton.setFrameShape(QtGui.QFrame.NoFrame) self.fr_mainbutton.setFrameShadow(QtGui.QFrame.Raised) self.fr_mainbutton.setObjectName(_fromUtf8("fr_mainbutton")) self.gridLayout_10 = QtGui.QGridLayout(self.fr_mainbutton) self.gridLayout_10.setMargin(0) self.gridLayout_10.setSpacing(0) self.gridLayout_10.setObjectName(_fromUtf8("gridLayout_10")) self.gridLayout_2.addWidget(self.fr_mainbutton, 0, 0, 1, 1) self.fr_toolbar = QtGui.QFrame(self.fr_topbar) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.fr_toolbar.sizePolicy().hasHeightForWidth()) self.fr_toolbar.setSizePolicy(sizePolicy) self.fr_toolbar.setFrameShape(QtGui.QFrame.NoFrame) self.fr_toolbar.setFrameShadow(QtGui.QFrame.Raised) self.fr_toolbar.setObjectName(_fromUtf8("fr_toolbar")) self.gridLayout = QtGui.QGridLayout(self.fr_toolbar) self.gridLayout.setMargin(0) self.gridLayout.setHorizontalSpacing(0) self.gridLayout.setVerticalSpacing(7) self.gridLayout.setObjectName(_fromUtf8("gridLayout")) self.b_menu = QtGui.QPushButton(self.fr_toolbar) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.b_menu.sizePolicy().hasHeightForWidth()) self.b_menu.setSizePolicy(sizePolicy) self.b_menu.setText(_fromUtf8("")) icon7 = QtGui.QIcon() icon7.addPixmap(QtGui.QPixmap(_fromUtf8("../style/img/menu.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.b_menu.setIcon(icon7) self.b_menu.setIconSize(QtCore.QSize(18, 18)) self.b_menu.setObjectName(_fromUtf8("b_menu")) self.gridLayout.addWidget(self.b_menu, 0, 2, 1, 1) self.b_save = QtGui.QPushButton(self.fr_toolbar) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.MinimumExpanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.b_save.sizePolicy().hasHeightForWidth()) self.b_save.setSizePolicy(sizePolicy) self.b_save.setText(_fromUtf8("")) icon8 = QtGui.QIcon() icon8.addPixmap(QtGui.QPixmap(_fromUtf8("../style/img/save.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.b_save.setIcon(icon8) self.b_save.setIconSize(QtCore.QSize(18, 18)) self.b_save.setObjectName(_fromUtf8("b_save")) self.gridLayout.addWidget(self.b_save, 0, 4, 1, 1) self.b_comment = QtGui.QPushButton(self.fr_toolbar) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.MinimumExpanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.b_comment.sizePolicy().hasHeightForWidth()) self.b_comment.setSizePolicy(sizePolicy) self.b_comment.setText(_fromUtf8("")) icon9 = QtGui.QIcon() icon9.addPixmap(QtGui.QPixmap(_fromUtf8("../style/img/comment.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.b_comment.setIcon(icon9) self.b_comment.setIconSize(QtCore.QSize(18, 18)) self.b_comment.setObjectName(_fromUtf8("b_comment")) self.gridLayout.addWidget(self.b_comment, 0, 7, 1, 1) self.b_unindent = QtGui.QPushButton(self.fr_toolbar) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.MinimumExpanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.b_unindent.sizePolicy().hasHeightForWidth()) self.b_unindent.setSizePolicy(sizePolicy) self.b_unindent.setText(_fromUtf8("")) icon10 = QtGui.QIcon() icon10.addPixmap(QtGui.QPixmap(_fromUtf8("../style/img/unindent.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.b_unindent.setIcon(icon10) self.b_unindent.setIconSize(QtCore.QSize(18, 18)) self.b_unindent.setObjectName(_fromUtf8("b_unindent")) self.gridLayout.addWidget(self.b_unindent, 0, 6, 1, 1) self.b_color_picker = QtGui.QPushButton(self.fr_toolbar) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.MinimumExpanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.b_color_picker.sizePolicy().hasHeightForWidth()) self.b_color_picker.setSizePolicy(sizePolicy) self.b_color_picker.setText(_fromUtf8("")) icon11 = QtGui.QIcon() icon11.addPixmap( QtGui.QPixmap(_fromUtf8("../style/img/color_swatch.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.b_color_picker.setIcon(icon11) self.b_color_picker.setObjectName(_fromUtf8("b_color_picker")) self.gridLayout.addWidget(self.b_color_picker, 0, 8, 1, 1) self.b_indent = QtGui.QPushButton(self.fr_toolbar) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.MinimumExpanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.b_indent.sizePolicy().hasHeightForWidth()) self.b_indent.setSizePolicy(sizePolicy) self.b_indent.setText(_fromUtf8("")) icon12 = QtGui.QIcon() icon12.addPixmap(QtGui.QPixmap(_fromUtf8("../style/img/indent.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.b_indent.setIcon(icon12) self.b_indent.setIconSize(QtCore.QSize(18, 18)) self.b_indent.setObjectName(_fromUtf8("b_indent")) self.gridLayout.addWidget(self.b_indent, 0, 5, 1, 1) spacerItem2 = QtGui.QSpacerItem(2, 2, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.gridLayout.addItem(spacerItem2, 0, 12, 1, 1) self.b_run = QtGui.QPushButton(self.fr_toolbar) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.MinimumExpanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.b_run.sizePolicy().hasHeightForWidth()) self.b_run.setSizePolicy(sizePolicy) self.b_run.setText(_fromUtf8("")) icon13 = QtGui.QIcon() icon13.addPixmap(QtGui.QPixmap(_fromUtf8("../style/img/run.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.b_run.setIcon(icon13) self.b_run.setIconSize(QtCore.QSize(18, 18)) self.b_run.setObjectName(_fromUtf8("b_run")) self.gridLayout.addWidget(self.b_run, 0, 10, 1, 1) self.b_compile = QtGui.QPushButton(self.fr_toolbar) self.b_compile.setEnabled(False) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.MinimumExpanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.b_compile.sizePolicy().hasHeightForWidth()) self.b_compile.setSizePolicy(sizePolicy) self.b_compile.setText(_fromUtf8("")) icon14 = QtGui.QIcon() icon14.addPixmap(QtGui.QPixmap(_fromUtf8("../style/img/compile.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.b_compile.setIcon(icon14) self.b_compile.setIconSize(QtCore.QSize(18, 18)) self.b_compile.setObjectName(_fromUtf8("b_compile")) self.gridLayout.addWidget(self.b_compile, 0, 9, 1, 1) self.gridLayout_2.addWidget(self.fr_toolbar, 0, 3, 1, 1) self.b_back = QtGui.QPushButton(self.fr_topbar) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.b_back.sizePolicy().hasHeightForWidth()) self.b_back.setSizePolicy(sizePolicy) self.b_back.setObjectName(_fromUtf8("b_back")) self.gridLayout_2.addWidget(self.b_back, 0, 9, 1, 1) self.gridLayout_8.addWidget(self.fr_topbar, 0, 0, 1, 2) self.retranslateUi(Form) self.sw_bottom.setCurrentIndex(0) QtCore.QObject.connect(self.le_find, QtCore.SIGNAL(_fromUtf8("returnPressed()")), self.b_find.click) QtCore.QMetaObject.connectSlotsByName(Form)
def setupUi(self, MainWindow): MainWindow.setObjectName(_fromUtf8("MainWindow")) MainWindow.resize(718, 650) self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setObjectName(_fromUtf8("centralwidget")) self.gridLayout = QtGui.QGridLayout(self.centralwidget) self.gridLayout.setObjectName(_fromUtf8("gridLayout")) self.tabWidget = QtGui.QTabWidget(self.centralwidget) self.tabWidget.setObjectName(_fromUtf8("tabWidget")) self.tab = QtGui.QWidget() self.tab.setObjectName(_fromUtf8("tab")) self.gridLayout_2 = QtGui.QGridLayout(self.tab) self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2")) self.pushButton_process = QtGui.QPushButton(self.tab) self.pushButton_process.setObjectName(_fromUtf8("pushButton_process")) self.gridLayout_2.addWidget(self.pushButton_process, 18, 0, 1, 2) self.lineEdit_InjDate = QtGui.QLineEdit(self.tab) self.lineEdit_InjDate.setObjectName(_fromUtf8("lineEdit_InjDate")) self.gridLayout_2.addWidget(self.lineEdit_InjDate, 16, 1, 1, 1) self.textBrowser = QtGui.QTextBrowser(self.tab) self.textBrowser.setEnabled(True) self.textBrowser.setMinimumSize(QtCore.QSize(350, 0)) self.textBrowser.setBaseSize(QtCore.QSize(0, 0)) self.textBrowser.setObjectName(_fromUtf8("textBrowser")) self.gridLayout_2.addWidget(self.textBrowser, 0, 2, 28, 1) self.label_weight = QtGui.QLabel(self.tab) self.label_weight.setObjectName(_fromUtf8("label_weight")) self.gridLayout_2.addWidget(self.label_weight, 14, 0, 1, 1) self.label_n_tomos = QtGui.QLabel(self.tab) self.label_n_tomos.setObjectName(_fromUtf8("label_n_tomos")) self.gridLayout_2.addWidget(self.label_n_tomos, 6, 0, 1, 2) self.lineEdit_height = QtGui.QLineEdit(self.tab) self.lineEdit_height.setObjectName(_fromUtf8("lineEdit_height")) self.gridLayout_2.addWidget(self.lineEdit_height, 13, 1, 1, 1) self.label_n_slices = QtGui.QLabel(self.tab) self.label_n_slices.setObjectName(_fromUtf8("label_n_slices")) self.gridLayout_2.addWidget(self.label_n_slices, 7, 0, 1, 2) self.label_StepDur = QtGui.QLabel(self.tab) self.label_StepDur.setObjectName(_fromUtf8("label_StepDur")) self.gridLayout_2.addWidget(self.label_StepDur, 9, 0, 1, 2) spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.gridLayout_2.addItem(spacerItem, 24, 0, 1, 1) self.lineEdit_weight = QtGui.QLineEdit(self.tab) self.lineEdit_weight.setObjectName(_fromUtf8("lineEdit_weight")) self.gridLayout_2.addWidget(self.lineEdit_weight, 14, 1, 1, 1) self.label_AcqTime = QtGui.QLabel(self.tab) self.label_AcqTime.setObjectName(_fromUtf8("label_AcqTime")) self.gridLayout_2.addWidget(self.label_AcqTime, 5, 0, 1, 2) self.label_InjTime = QtGui.QLabel(self.tab) self.label_InjTime.setObjectName(_fromUtf8("label_InjTime")) self.gridLayout_2.addWidget(self.label_InjTime, 17, 0, 1, 1) self.pushButton_clear = QtGui.QPushButton(self.tab) self.pushButton_clear.setObjectName(_fromUtf8("pushButton_clear")) self.gridLayout_2.addWidget(self.pushButton_clear, 25, 1, 1, 1) self.label_patient = QtGui.QLabel(self.tab) self.label_patient.setObjectName(_fromUtf8("label_patient")) self.gridLayout_2.addWidget(self.label_patient, 3, 0, 1, 2) self.label_height = QtGui.QLabel(self.tab) self.label_height.setObjectName(_fromUtf8("label_height")) self.gridLayout_2.addWidget(self.label_height, 13, 0, 1, 1) self.lineEdit_InjTime = QtGui.QLineEdit(self.tab) self.lineEdit_InjTime.setObjectName(_fromUtf8("lineEdit_InjTime")) self.gridLayout_2.addWidget(self.lineEdit_InjTime, 17, 1, 1, 1) self.label_TomoSteps = QtGui.QLabel(self.tab) self.label_TomoSteps.setObjectName(_fromUtf8("label_TomoSteps")) self.gridLayout_2.addWidget(self.label_TomoSteps, 8, 0, 1, 2) self.label_InjDate = QtGui.QLabel(self.tab) self.label_InjDate.setObjectName(_fromUtf8("label_InjDate")) self.gridLayout_2.addWidget(self.label_InjDate, 16, 0, 1, 1) self.label_AcqDate = QtGui.QLabel(self.tab) self.label_AcqDate.setObjectName(_fromUtf8("label_AcqDate")) self.gridLayout_2.addWidget(self.label_AcqDate, 4, 0, 1, 2) self.label_AcqDur = QtGui.QLabel(self.tab) self.label_AcqDur.setObjectName(_fromUtf8("label_AcqDur")) self.gridLayout_2.addWidget(self.label_AcqDur, 10, 0, 1, 2) self.pushButton_reload = QtGui.QPushButton(self.tab) self.pushButton_reload.setObjectName(_fromUtf8("pushButton_reload")) self.gridLayout_2.addWidget(self.pushButton_reload, 25, 0, 1, 1) self.label_camera = QtGui.QLabel(self.tab) self.label_camera.setObjectName(_fromUtf8("label_camera")) self.gridLayout_2.addWidget(self.label_camera, 11, 0, 1, 2) self.label_activity = QtGui.QLabel(self.tab) self.label_activity.setObjectName(_fromUtf8("label_activity")) self.gridLayout_2.addWidget(self.label_activity, 15, 0, 1, 1) self.lineEdit_activity = QtGui.QLineEdit(self.tab) self.lineEdit_activity.setObjectName(_fromUtf8("lineEdit_activity")) self.gridLayout_2.addWidget(self.lineEdit_activity, 15, 1, 1, 1) self.pushButton_confirm = QtGui.QPushButton(self.tab) self.pushButton_confirm.setObjectName(_fromUtf8("pushButton_confirm")) self.gridLayout_2.addWidget(self.pushButton_confirm, 23, 0, 1, 2) self.label_description = QtGui.QLabel(self.tab) self.label_description.setObjectName(_fromUtf8("label_description")) self.gridLayout_2.addWidget(self.label_description, 20, 0, 1, 1) self.lineEdit_description = QtGui.QLineEdit(self.tab) self.lineEdit_description.setObjectName( _fromUtf8("lineEdit_description")) self.gridLayout_2.addWidget(self.lineEdit_description, 20, 1, 1, 1) self.tabWidget.addTab(self.tab, _fromUtf8("")) self.tab_2 = QtGui.QWidget() self.tab_2.setObjectName(_fromUtf8("tab_2")) self.gridLayout_3 = QtGui.QGridLayout(self.tab_2) self.gridLayout_3.setObjectName(_fromUtf8("gridLayout_3")) self.pushButton_default_settings = QtGui.QPushButton(self.tab_2) self.pushButton_default_settings.setObjectName( _fromUtf8("pushButton_default_settings")) self.gridLayout_3.addWidget(self.pushButton_default_settings, 2, 1, 1, 1) spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.gridLayout_3.addItem(spacerItem1, 2, 2, 1, 1) self.groupBox = QtGui.QGroupBox(self.tab_2) self.groupBox.setFlat(False) self.groupBox.setCheckable(False) self.groupBox.setObjectName(_fromUtf8("groupBox")) self.gridLayout_4 = QtGui.QGridLayout(self.groupBox) self.gridLayout_4.setObjectName(_fromUtf8("gridLayout_4")) self.label_ip = QtGui.QLabel(self.groupBox) self.label_ip.setObjectName(_fromUtf8("label_ip")) self.gridLayout_4.addWidget(self.label_ip, 2, 0, 1, 1) self.lineEdit_to_ae = QtGui.QLineEdit(self.groupBox) self.lineEdit_to_ae.setObjectName(_fromUtf8("lineEdit_to_ae")) self.gridLayout_4.addWidget(self.lineEdit_to_ae, 1, 2, 1, 1) self.lineEdit_ip = QtGui.QLineEdit(self.groupBox) self.lineEdit_ip.setObjectName(_fromUtf8("lineEdit_ip")) self.gridLayout_4.addWidget(self.lineEdit_ip, 2, 2, 1, 1) self.label_to_ae = QtGui.QLabel(self.groupBox) self.label_to_ae.setObjectName(_fromUtf8("label_to_ae")) self.gridLayout_4.addWidget(self.label_to_ae, 1, 0, 1, 1) self.lineEdit_from_ae = QtGui.QLineEdit(self.groupBox) self.lineEdit_from_ae.setObjectName(_fromUtf8("lineEdit_from_ae")) self.gridLayout_4.addWidget(self.lineEdit_from_ae, 0, 2, 1, 1) self.label_from_ae = QtGui.QLabel(self.groupBox) self.label_from_ae.setObjectName(_fromUtf8("label_from_ae")) self.gridLayout_4.addWidget(self.label_from_ae, 0, 0, 1, 1) self.label_port = QtGui.QLabel(self.groupBox) self.label_port.setObjectName(_fromUtf8("label_port")) self.gridLayout_4.addWidget(self.label_port, 3, 0, 1, 1) self.lineEdit_port = QtGui.QLineEdit(self.groupBox) self.lineEdit_port.setObjectName(_fromUtf8("lineEdit_port")) self.gridLayout_4.addWidget(self.lineEdit_port, 3, 2, 1, 1) self.gridLayout_3.addWidget(self.groupBox, 0, 0, 1, 3) spacerItem2 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.gridLayout_3.addItem(spacerItem2, 3, 0, 1, 1) self.pushButton_save_settings = QtGui.QPushButton(self.tab_2) self.pushButton_save_settings.setObjectName( _fromUtf8("pushButton_save_settings")) self.gridLayout_3.addWidget(self.pushButton_save_settings, 2, 0, 1, 1) self.groupBox_2 = QtGui.QGroupBox(self.tab_2) self.groupBox_2.setObjectName(_fromUtf8("groupBox_2")) self.gridLayout_5 = QtGui.QGridLayout(self.groupBox_2) self.gridLayout_5.setObjectName(_fromUtf8("gridLayout_5")) self.checkBox_delete_in = QtGui.QCheckBox(self.groupBox_2) self.checkBox_delete_in.setObjectName(_fromUtf8("checkBox_delete_in")) self.gridLayout_5.addWidget(self.checkBox_delete_in, 1, 0, 1, 1) self.checkBox_delete_temp = QtGui.QCheckBox(self.groupBox_2) self.checkBox_delete_temp.setObjectName( _fromUtf8("checkBox_delete_temp")) self.gridLayout_5.addWidget(self.checkBox_delete_temp, 2, 0, 1, 1) self.checkBox_save_local = QtGui.QCheckBox(self.groupBox_2) self.checkBox_save_local.setObjectName( _fromUtf8("checkBox_save_local")) self.gridLayout_5.addWidget(self.checkBox_save_local, 3, 0, 1, 1) self.label_output_dir = QtGui.QLabel(self.groupBox_2) self.label_output_dir.setObjectName(_fromUtf8("label_output_dir")) self.gridLayout_5.addWidget(self.label_output_dir, 5, 0, 1, 1) self.lineEdit_output_dir = QtGui.QLineEdit(self.groupBox_2) self.lineEdit_output_dir.setObjectName( _fromUtf8("lineEdit_output_dir")) self.gridLayout_5.addWidget(self.lineEdit_output_dir, 5, 1, 1, 1) self.checkBox_transfer = QtGui.QCheckBox(self.groupBox_2) self.checkBox_transfer.setObjectName(_fromUtf8("checkBox_transfer")) self.gridLayout_5.addWidget(self.checkBox_transfer, 0, 0, 1, 1) self.label_input_dir = QtGui.QLabel(self.groupBox_2) self.label_input_dir.setObjectName(_fromUtf8("label_input_dir")) self.gridLayout_5.addWidget(self.label_input_dir, 4, 0, 1, 1) self.label_input_dir_path = QtGui.QLabel(self.groupBox_2) self.label_input_dir_path.setText(_fromUtf8("")) self.label_input_dir_path.setObjectName( _fromUtf8("label_input_dir_path")) self.gridLayout_5.addWidget(self.label_input_dir_path, 4, 1, 1, 1) self.gridLayout_3.addWidget(self.groupBox_2, 1, 0, 1, 3) self.tabWidget.addTab(self.tab_2, _fromUtf8("")) self.gridLayout.addWidget(self.tabWidget, 0, 0, 1, 1) MainWindow.setCentralWidget(self.centralwidget) self.statusbar = QtGui.QStatusBar(MainWindow) self.statusbar.setObjectName(_fromUtf8("statusbar")) MainWindow.setStatusBar(self.statusbar) self.actionSave_Config = QtGui.QAction(MainWindow) self.actionSave_Config.setObjectName(_fromUtf8("actionSave_Config")) self.actionLoad_Config = QtGui.QAction(MainWindow) self.actionLoad_Config.setObjectName(_fromUtf8("actionLoad_Config")) self.actionQuit = QtGui.QAction(MainWindow) self.actionQuit.setObjectName(_fromUtf8("actionQuit")) self.retranslateUi(MainWindow) self.tabWidget.setCurrentIndex(0) QtCore.QMetaObject.connectSlotsByName(MainWindow) MainWindow.setTabOrder(self.lineEdit_height, self.lineEdit_weight) MainWindow.setTabOrder(self.lineEdit_weight, self.lineEdit_activity) MainWindow.setTabOrder(self.lineEdit_activity, self.lineEdit_InjDate) MainWindow.setTabOrder(self.lineEdit_InjDate, self.lineEdit_InjTime) MainWindow.setTabOrder(self.lineEdit_InjTime, self.pushButton_process) MainWindow.setTabOrder(self.pushButton_process, self.lineEdit_description) MainWindow.setTabOrder(self.lineEdit_description, self.pushButton_confirm) MainWindow.setTabOrder(self.pushButton_confirm, self.pushButton_reload) MainWindow.setTabOrder(self.pushButton_reload, self.pushButton_clear) MainWindow.setTabOrder(self.pushButton_clear, self.textBrowser) MainWindow.setTabOrder(self.textBrowser, self.lineEdit_from_ae) MainWindow.setTabOrder(self.lineEdit_from_ae, self.lineEdit_to_ae) MainWindow.setTabOrder(self.lineEdit_to_ae, self.lineEdit_ip) MainWindow.setTabOrder(self.lineEdit_ip, self.lineEdit_port) MainWindow.setTabOrder(self.lineEdit_port, self.checkBox_transfer) MainWindow.setTabOrder(self.checkBox_transfer, self.checkBox_delete_in) MainWindow.setTabOrder(self.checkBox_delete_in, self.checkBox_delete_temp) MainWindow.setTabOrder(self.checkBox_delete_temp, self.checkBox_save_local) MainWindow.setTabOrder(self.checkBox_save_local, self.lineEdit_output_dir) MainWindow.setTabOrder(self.lineEdit_output_dir, self.pushButton_save_settings) MainWindow.setTabOrder(self.pushButton_save_settings, self.pushButton_default_settings) MainWindow.setTabOrder(self.pushButton_default_settings, self.tabWidget)
class SpatialDecisionDockWidget(QtGui.QDockWidget, FORM_CLASS): closingPlugin = QtCore.pyqtSignal() #custom signals updateAttribute = QtCore.pyqtSignal(str) def __init__(self, iface, parent=None): """Constructor.""" super(SpatialDecisionDockWidget, self).__init__(parent) # Set up the user interface from Designer. # After setupUI you can access any designer object by doing # self.<objectname>, and you can use autoconnect slots - see # http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html # #widgets-and-dialogs-with-auto-connect self.setupUi(self) # define globals self.iface = iface self.canvas = self.iface.mapCanvas() # set up GUI operation signals # data self.iface.projectRead.connect(self.updateLayers) self.iface.newProjectCreated.connect(self.updateLayers) self.iface.legendInterface().itemRemoved.connect(self.updateLayers) self.iface.legendInterface().itemAdded.connect(self.updateLayers) self.openScenarioButton.clicked.connect(self.openScenario) self.saveScenarioButton.clicked.connect(self.saveScenario) self.selectLayerCombo.activated.connect(self.setSelectedLayer) self.selectAttributeCombo.activated.connect(self.setSelectedAttribute) self.startCounterButton.clicked.connect(self.startCounter) self.cancelCounterButton.clicked.connect(self.cancelCounter) # analysis self.graph = QgsGraph() self.tied_points = [] # put both acctions into one button (shortest route) #self.setNetworkButton.clicked.connect(self.buildNetwork) self.shortestRouteButton.clicked.connect(self.buildNetwork) self.shortestRouteButton.clicked.connect(self.calculateRoute) self.clearRouteButton.clicked.connect(self.deleteRoutes) self.serviceAreaButton.clicked.connect(self.calculateServiceArea) self.bufferButton.clicked.connect(self.calculateBuffer) self.selectBufferButton.clicked.connect(self.selectFeaturesBuffer) self.makeIntersectionButton.clicked.connect(self.calculateIntersection) self.selectRangeButton.clicked.connect(self.selectFeaturesRange) self.expressionSelectButton.clicked.connect( self.selectFeaturesExpression) self.expressionFilterButton.clicked.connect( self.filterFeaturesExpression) # visualisation self.displayStyleButton.clicked.connect(self.displayBenchmarkStyle) self.displayRangeButton.clicked.connect(self.displayContinuousStyle) self.updateAttribute.connect(self.plotChart) # reporting self.featureCounterUpdateButton.clicked.connect( self.updateNumberFeatures) self.saveMapButton.clicked.connect(self.saveMap) self.saveMapPathButton.clicked.connect(self.selectFile) self.updateAttribute.connect(self.extractAttributeSummary) self.saveStatisticsButton.clicked.connect(self.saveTable) self.emitPoint = QgsMapToolEmitPoint(self.canvas) self.featureCounterUpdateButton.clicked.connect(self.enterPoi) self.emitPoint.canvasClicked.connect(self.getPoint) # insert obstacles button action self.insertObstacleButton.clicked.connect(self.insertObstacle) # set current UI values self.counterProgressBar.setValue(0) # add button icons self.medicButton.setIcon(QtGui.QIcon(':icons/medic_box.png')) self.ambulanceButton.setIcon(QtGui.QIcon(':icons/ambulance.png')) self.logoLabel.setPixmap(QtGui.QPixmap(':icons/ambulance.png')) movie = QtGui.QMovie(':icons/loading2.gif') self.logoLabel.setMovie(movie) movie.start() # add matplotlib Figure to chartFrame self.chart_figure = Figure() self.chart_subplot_hist = self.chart_figure.add_subplot(221) self.chart_subplot_line = self.chart_figure.add_subplot(222) self.chart_subplot_bar = self.chart_figure.add_subplot(223) self.chart_subplot_pie = self.chart_figure.add_subplot(224) self.chart_figure.tight_layout() self.chart_canvas = FigureCanvas(self.chart_figure) self.chartLayout.addWidget(self.chart_canvas) # initialisation self.updateLayers() #run simple tests def closeEvent(self, event): # disconnect interface signals try: self.iface.projectRead.disconnect(self.updateLayers) self.iface.newProjectCreated.disconnect(self.updateLayers) self.iface.legendInterface().itemRemoved.disconnect( self.updateLayers) self.iface.legendInterface().itemAdded.disconnect( self.updateLayers) except: pass self.closingPlugin.emit() event.accept() ####### # Data functions ####### def openScenario(self, filename=""): scenario_open = False scenario_file = os.path.join(u'/Users/jorge/github/GEO1005', 'sample_data', 'time_test.qgs') # check if file exists if os.path.isfile(scenario_file): self.iface.addProject(scenario_file) scenario_open = True else: last_dir = uf.getLastDir("SDSS") new_file = QtGui.QFileDialog.getOpenFileName( self, "", last_dir, "(*.qgs)") if new_file: self.iface.addProject(unicode(new_file)) scenario_open = True if scenario_open: self.updateLayers() def saveScenario(self): self.iface.actionSaveProject() def updateLayers(self): layers = uf.getLegendLayers(self.iface, 'all', 'all') self.selectLayerCombo.clear() if layers: layer_names = uf.getLayersListNames(layers) self.selectLayerCombo.addItems(layer_names) self.setSelectedLayer() else: self.selectAttributeCombo.clear() self.clearChart() def setSelectedLayer(self): layer_name = self.selectLayerCombo.currentText() layer = uf.getLegendLayerByName(self.iface, layer_name) self.updateAttributes(layer) def getSelectedLayer(self): layer_name = self.selectLayerCombo.currentText() layer = uf.getLegendLayerByName(self.iface, layer_name) return layer def updateAttributes(self, layer): self.selectAttributeCombo.clear() if layer: self.clearReport() self.clearChart() fields = uf.getFieldNames(layer) if fields: self.selectAttributeCombo.addItems(fields) self.setSelectedAttribute() # send list to the report list window self.updateReport(fields) def setSelectedAttribute(self): field_name = self.selectAttributeCombo.currentText() self.updateAttribute.emit(field_name) def getSelectedAttribute(self): field_name = self.selectAttributeCombo.currentText() return field_name def startCounter(self): # prepare the thread of the timed even or long loop self.timerThread = TimedEvent(self.iface.mainWindow(), self, 'default') self.timerThread.timerFinished.connect(self.concludeCounter) self.timerThread.timerProgress.connect(self.updateCounter) self.timerThread.timerError.connect(self.cancelCounter) self.timerThread.start() # from here the timer is running in the background on a separate thread. user can continue working on QGIS. self.counterProgressBar.setValue(0) self.startCounterButton.setDisabled(True) self.cancelCounterButton.setDisabled(False) def cancelCounter(self): # triggered if the user clicks the cancel button self.timerThread.stop() self.counterProgressBar.setValue(0) self.counterProgressBar.setRange(0, 100) try: self.timerThread.timerFinished.disconnect(self.concludeCounter) self.timerThread.timerProgress.disconnect(self.updateCounter) self.timerThread.timerError.disconnect(self.cancelCounter) except: pass self.timerThread = None self.startCounterButton.setDisabled(False) self.cancelCounterButton.setDisabled(True) def updateCounter(self, value): self.counterProgressBar.setValue(value) def concludeCounter(self, result): # clean up timer thread stuff self.timerThread.stop() self.counterProgressBar.setValue(100) try: self.timerThread.timerFinished.disconnect(self.concludeCounter) self.timerThread.timerProgress.disconnect(self.updateCounter) self.timerThread.timerError.disconnect(self.cancelCounter) except: pass self.timerThread = None self.startCounterButton.setDisabled(False) self.cancelCounterButton.setDisabled(True) # do something with the results self.iface.messageBar().pushMessage("Infor", "The counter results: %s" % result, level=0, duration=5) # insert obstacle function def insertObstacle(self): print('this function will insert an obstacle') layer = self.getSelectedLayer() obstacles_layer = uf.getLegendLayerByName(self.iface, "Obstacles") if not obstacles_layer: print('no obstacles layer') attribs = ['id', 'distance'] types = [QtCore.QVariant.String, QtCore.QVariant.Double] obstacles_layer = uf.createTempLayer('Obstacles', 'LINE', layer.crs().postgisSrid(), attribs, types) uf.loadTempLayer(obstacles_layer) obstacles_layer.setLayerName('Obstacles') # how to access nearest feature plugin here, or at least functions of plugin? nfmt.canvasReleaseEvent(self, mouseEvent) #self.iface.mapCanvas().setMapTool(self.nearestFeatureMapTool) #uf.insertTempFeatures(obstacles_layer) self.refreshCanvas(obstacles_layer) ####### # Analysis functions ####### # route functions def getNetwork(self): roads_layer = self.getSelectedLayer() if roads_layer: # see if there is an obstacles layer to subtract roads from the network obstacles_layer = uf.getLegendLayerByName(self.iface, "Obstacles") if obstacles_layer: print('yes there is an obstacle') # retrieve roads outside obstacles (inside = False) features = uf.getFeaturesByIntersection( roads_layer, obstacles_layer, False) # add these roads to a new temporary layer road_network = uf.createTempLayer( 'Temp_Network', 'LINESTRING', roads_layer.crs().postgisSrid(), [], []) road_network.dataProvider().addFeatures(features) else: road_network = roads_layer return road_network else: return def buildNetwork(self): self.network_layer = self.getNetwork() if self.network_layer: # get the points to be used as origin and destination # in this case gets the centroid of the selected features selected_sources = self.getSelectedLayer().selectedFeatures() source_points = [ feature.geometry().centroid().asPoint() for feature in selected_sources ] # build the graph including these points if len(source_points) > 1: self.graph, self.tied_points = uf.makeUndirectedGraph( self.network_layer, source_points) # the tied points are the new source_points on the graph if self.graph and self.tied_points: text = "network is built for %s points" % len( self.tied_points) self.insertReport(text) return def calculateRoute(self): # origin and destination must be in the set of tied_points options = len(self.tied_points) if options > 1: # origin and destination are given as an index in the tied_points list origin = 0 destination = random.randint(1, options - 1) # calculate the shortest path for the given origin and destination path = uf.calculateRouteDijkstra(self.graph, self.tied_points, origin, destination) # store the route results in temporary layer called "Routes" routes_layer = uf.getLegendLayerByName(self.iface, "Routes") # create one if it doesn't exist if not routes_layer: attribs = ['id'] types = [QtCore.QVariant.String] routes_layer = uf.createTempLayer( 'Routes', 'LINESTRING', self.network_layer.crs().postgisSrid(), attribs, types) uf.loadTempLayer(routes_layer) # insert route line for route in routes_layer.getFeatures(): print route.id() uf.insertTempFeatures(routes_layer, [path], [['testing', 100.00]]) buffer = processing.runandload('qgis:fixeddistancebuffer', routes_layer, 10.0, 5, False, None) #self.refreshCanvas(routes_layer) def deleteRoutes(self): routes_layer = uf.getLegendLayerByName(self.iface, "Routes") if routes_layer: ids = uf.getAllFeatureIds(routes_layer) routes_layer.startEditing() for id in ids: routes_layer.deleteFeature(id) routes_layer.commitChanges() def getServiceAreaCutoff(self): cutoff = self.serviceAreaCutoffEdit.text() if uf.isNumeric(cutoff): return uf.convertNumeric(cutoff) else: return 0 def calculateServiceArea(self): options = len(self.tied_points) if options > 0: # origin is given as an index in the tied_points list origin = random.randint(1, options - 1) cutoff_distance = self.getServiceAreaCutoff() if cutoff_distance == 0: return service_area = uf.calculateServiceArea(self.graph, self.tied_points, origin, cutoff_distance) # store the service area results in temporary layer called "Service_Area" area_layer = uf.getLegendLayerByName(self.iface, "Service_Area") # create one if it doesn't exist if not area_layer: attribs = ['cost'] types = [QtCore.QVariant.Double] area_layer = uf.createTempLayer( 'Service_Area', 'POINT', self.network_layer.crs().postgisSrid(), attribs, types) uf.loadTempLayer(area_layer) area_layer.setLayerName('Service_Area') # insert service area points geoms = [] values = [] for point in service_area.itervalues(): # each point is a tuple with geometry and cost geoms.append(point[0]) # in the case of values, it expects a list of multiple values in each item - list of lists values.append([cutoff_distance]) uf.insertTempFeatures(area_layer, geoms, values) self.refreshCanvas(area_layer) # buffer functions def getBufferCutoff(self): cutoff = self.bufferCutoffEdit.text() if uf.isNumeric(cutoff): return uf.convertNumeric(cutoff) else: return 0 def calculateBuffer(self): origins = self.getSelectedLayer().selectedFeatures() layer = self.getSelectedLayer() print('buffer') if origins > 0: cutoff_distance = self.getBufferCutoff() buffers = {} for point in origins: geom = point.geometry() buffers[point.id()] = geom.buffer(cutoff_distance, 12).asPolygon() # store the buffer results in temporary layer called "Buffers" buffer_layer = uf.getLegendLayerByName(self.iface, "Buffers") # create one if it doesn't exist if not buffer_layer: attribs = ['id', 'distance'] types = [QtCore.QVariant.String, QtCore.QVariant.Double] buffer_layer = uf.createTempLayer('Buffers', 'POLYGON', layer.crs().postgisSrid(), attribs, types) uf.loadTempLayer(buffer_layer) buffer_layer.setLayerName('Buffers') # insert buffer polygons geoms = [] values = [] for buffer in buffers.iteritems(): # each buffer has an id and a geometry geoms.append(buffer[1]) # in the case of values, it expects a list of multiple values in each item - list of lists values.append([buffer[0], cutoff_distance]) uf.insertTempFeatures(buffer_layer, geoms, values) self.refreshCanvas(buffer_layer) def calculateIntersection(self): # use the buffer to cut from another layer cutter = uf.getLegendLayerByName(self.iface, "Buffers") # use the selected layer for cutting layer = self.getSelectedLayer() if cutter.featureCount() > 0: # get the intersections between the two layers intersection = processing.runandload('qgis:intersection', layer, cutter, None) intersection_layer = uf.getLegendLayerByName( self.iface, "Intersection") # prepare results layer save_path = "%s/dissolve_results.shp" % QgsProject.instance( ).homePath() # dissolve grouping by origin id dissolve = processing.runandload('qgis:dissolve', intersection_layer, False, 'id', save_path) dissolved_layer = uf.getLegendLayerByName(self.iface, "Dissolved") dissolved_layer.setLayerName('Buffer Intersection') # close intersections intermediary layer QgsMapLayerRegistry.instance().removeMapLayers( [intersection_layer.id()]) # add an 'area' field and calculate # functiona can add more than one filed, therefore names and types are lists uf.addFields(dissolved_layer, ["area"], [QtCore.QVariant.Double]) uf.updateField(dissolved_layer, "area", "$area") # after adding features to layers needs a refresh (sometimes) def refreshCanvas(self, layer): if self.canvas.isCachingEnabled(): layer.setCacheImage(None) else: self.canvas.refresh() # feature selection def selectFeaturesBuffer(self): layer = self.getSelectedLayer() buffer_layer = uf.getLegendLayerByName(self.iface, "Buffers") if buffer_layer and layer: uf.selectFeaturesByIntersection(layer, buffer_layer, True) def selectFeaturesRange(self): layer = self.getSelectedLayer() # for the range takes values from the service area (max) and buffer (min) text edits max = self.getServiceAreaCutoff() min = self.getBufferCutoff() if layer and max and min: # gets list of numeric fields in layer fields = uf.getNumericFields(layer) if fields: # selects features with values in the range uf.selectFeaturesByRangeValues(layer, fields[0].name(), min, max) def selectFeaturesExpression(self): layer = self.getSelectedLayer() uf.selectFeaturesByExpression(layer, self.expressionEdit.text()) def filterFeaturesExpression(self): layer = self.getSelectedLayer() uf.filterFeaturesByExpression(layer, self.expressionEdit.text()) ####### # Visualisation functions ####### def displayBenchmarkStyle(self): # loads a predefined style on a layer. # Best for simple, rule based styles, and categorical variables # attributes and values classes are hard coded in the style layer = uf.getLegendLayerByName(self.iface, "Obstacles") path = "%s/styles/" % QgsProject.instance().homePath() # load a categorical style layer.loadNamedStyle("%sobstacle_danger.qml" % path) layer.triggerRepaint() self.iface.legendInterface().refreshLayerSymbology(layer) # load a simple style layer = uf.getLegendLayerByName(self.iface, "Buffers") layer.loadNamedStyle("%sbuffer.qml" % path) layer.triggerRepaint() self.iface.legendInterface().refreshLayerSymbology(layer) self.canvas.refresh() def displayContinuousStyle(self): # produces a new symbology renderer for graduated style layer = self.getSelectedLayer() attribute = self.getSelectedAttribute() # define several display parameters display_settings = {} # define the interval type and number of intervals # EqualInterval = 0; Quantile = 1; Jenks = 2; StdDev = 3; Pretty = 4; display_settings['interval_type'] = 1 display_settings['intervals'] = 10 # define the line width display_settings['line_width'] = 0.5 # define the colour ramp # the ramp's bottom and top colour. These are RGB tuples that can be edited ramp = QgsVectorGradientColorRampV2(QtGui.QColor(0, 0, 255, 255), QtGui.QColor(255, 0, 0, 255), False) # any other stops for intermediate colours for greater control. can be edited or skipped ramp.setStops([ QgsGradientStop(0.25, QtGui.QColor(0, 255, 255, 255)), QgsGradientStop(0.5, QtGui.QColor(0, 255, 0, 255)), QgsGradientStop(0.75, QtGui.QColor(255, 255, 0, 255)) ]) display_settings['ramp'] = ramp # call the update renderer function renderer = uf.updateRenderer(layer, attribute, display_settings) # update the canvas if renderer: layer.setRendererV2(renderer) layer.triggerRepaint() self.iface.legendInterface().refreshLayerSymbology(layer) self.canvas.refresh() def plotChart(self): plot_layer = self.getSelectedLayer() if plot_layer: attribute = self.getSelectedAttribute() if attribute: numeric_fields = uf.getNumericFieldNames(plot_layer) # draw a histogram from numeric values if attribute in numeric_fields: values = uf.getAllFeatureValues(plot_layer, attribute) n, bins, patches = self.chart_subplot_hist.hist( values, 50, normed=False) else: self.chart_subplot_hist.cla() # draw a simple line plot self.chart_subplot_line.cla() x1 = range(20) y1 = random.sample(range(1, 100), 20) self.chart_subplot_line.plot(x1, y1, 'r.-') # draw a simple bar plot labels = ('Critical', 'Risk', 'Safe') self.chart_subplot_bar.cla() self.chart_subplot_bar.bar(1.2, y1[0], width=0.7, alpha=1, color='red', label=labels[0]) self.chart_subplot_bar.bar(2.2, y1[5], width=0.7, alpha=1, color='yellow', label=labels[1]) self.chart_subplot_bar.bar(3.2, y1[10], width=0.7, alpha=1, color='green', label=labels[2]) self.chart_subplot_bar.set_xticks((1.5, 2.5, 3.5)) self.chart_subplot_bar.set_xticklabels(labels) # draw a simple pie chart self.chart_subplot_pie.cla() total = float(y1[0] + y1[5] + y1[10]) sizes = [ (y1[0] / total) * 100.0, (y1[5] / total) * 100.0, (y1[10] / total) * 100.0, ] colours = ('lightcoral', 'gold', 'yellowgreen') self.chart_subplot_pie.pie(sizes, labels=labels, colors=colours, autopct='%1.1f%%', shadow=True, startangle=90) self.chart_subplot_pie.axis('equal') # draw all the plots self.chart_canvas.draw() else: self.clearChart() def clearChart(self): self.chart_subplot_hist.cla() self.chart_subplot_line.cla() self.chart_subplot_bar.cla() self.chart_subplot_pie.cla() self.chart_canvas.draw() ####### # Reporting functions ####### # update a text edit field def updateNumberFeatures(self): layer = self.getSelectedLayer() if layer: count = layer.featureCount() self.featureCounterEdit.setText(str(count)) # get the point when the user clicks on the canvas def enterPoi(self): # remember currently selected tool self.userTool = self.canvas.mapTool() # activate coordinate capture tool self.canvas.setMapTool(self.emitPoint) def getPoint(self, mapPoint, mouseButton): # change tool so you don't get more than one POI self.canvas.unsetMapTool(self.emitPoint) self.canvas.setMapTool(self.userTool) #Get the click if mapPoint: print(mapPoint) # here do something with the point # selecting a file for saving def selectFile(self): last_dir = uf.getLastDir("SDSS") path = QtGui.QFileDialog.getSaveFileName(self, "Save map file", last_dir, "PNG (*.png)") if path.strip() != "": path = unicode(path) uf.setLastDir(path, "SDSS") self.saveMapPathEdit.setText(path) # saving the current screen def saveMap(self): filename = self.saveMapPathEdit.text() if filename != '': self.canvas.saveAsImage(filename, None, "PNG") def extractAttributeSummary(self, attribute): # get summary of the attribute layer = self.getSelectedLayer() summary = [] # only use the first attribute in the list for feature in layer.getFeatures(): summary.append((feature.id(), feature.attribute(attribute))) # send this to the table self.clearTable() self.updateTable(summary) # report window functions def updateReport(self, report): self.reportList.clear() self.reportList.addItems(report) def insertReport(self, item): self.reportList.insertItem(0, item) def clearReport(self): self.reportList.clear() # table window functions def updateTable(self, values): # takes a list of label / value pairs, can be tuples or lists. not dictionaries to control order self.statisticsTable.setColumnCount(2) self.statisticsTable.setHorizontalHeaderLabels(["Item", "Value"]) self.statisticsTable.setRowCount(len(values)) for i, item in enumerate(values): # i is the table row, items mus tbe added as QTableWidgetItems self.statisticsTable.setItem(i, 0, QtGui.QTableWidgetItem(str(item[0]))) self.statisticsTable.setItem(i, 1, QtGui.QTableWidgetItem(str(item[1]))) self.statisticsTable.horizontalHeader().setResizeMode( 0, QtGui.QHeaderView.ResizeToContents) self.statisticsTable.horizontalHeader().setResizeMode( 1, QtGui.QHeaderView.Stretch) self.statisticsTable.resizeRowsToContents() def clearTable(self): self.statisticsTable.clear() def saveTable(self): path = QtGui.QFileDialog.getSaveFileName(self, 'Save File', '', 'CSV(*.csv)') if path: with open(unicode(path), 'wb') as stream: # open csv file for writing writer = csv.writer(stream) # write header header = [] for column in range(self.statisticsTable.columnCount()): item = self.statisticsTable.horizontalHeaderItem(column) header.append(unicode(item.text()).encode('utf8')) writer.writerow(header) # write data for row in range(self.statisticsTable.rowCount()): rowdata = [] for column in range(self.statisticsTable.columnCount()): item = self.statisticsTable.item(row, column) if item is not None: rowdata.append(unicode(item.text()).encode('utf8')) else: rowdata.append('') writer.writerow(rowdata)
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.setWindowTitle('Send to Amazon Settings') gridLayout = QtGui.QGridLayout() self.setLayout(gridLayout) self.emailLabel = QtGui.QLabel('Notification Email') gridLayout.addWidget(self.emailLabel, 0, 0) self.emailEdit = QtGui.QLineEdit() gridLayout.addWidget(self.emailEdit, 0, 1) """ self.ncpusLabel = QtGui.QLabel('Number of CPUs') gridLayout.addWidget(self.ncpusLabel, 1, 0) self.ncpusEdit = QtGui.QLineEdit() self.ncpusEdit.setText("32") gridLayout.addWidget(self.ncpusEdit, 1, 1) """ self.prefLabel = QtGui.QLabel('Preference') gridLayout.addWidget(self.prefLabel, 2, 0) self.prefCombo = QtGui.QComboBox() self.prefCombo.addItem("Performance", "performance") self.prefCombo.addItem("Cost", "cost") self.prefCombo.addItem("Manual", "manual") gridLayout.addWidget(self.prefCombo, 2, 1) self.connect(self.prefCombo, QtCore.SIGNAL('currentIndexChanged(QString)'), self.changeNodeInputs) """ self.nodeLabel = QtGui.QLabel('Node Type') gridLayout.addWidget(self.nodeLabel, 3, 0) self.nodeCombo = QtGui.QComboBox() self.nodeCombo.addItem("Sandy Bridge", "san") self.nodeCombo.addItem("Westmere", "wes") self.nodeCombo.addItem("Nehalem", "neh") self.nodeCombo.addItem("Harpertown", "har") gridLayout.addWidget(self.nodeCombo, 3, 1) self.selectLabel = QtGui.QLabel('Number of Nodes') gridLayout.addWidget(self.selectLabel, 4, 0) self.selectEdit = QtGui.QLineEdit() self.selectEdit.setText("2") gridLayout.addWidget(self.selectEdit, 4, 1) """ # Sandy bridge input self.sanLabel = QtGui.QLabel('Sandy Bridge') gridLayout.addWidget(self.sanLabel, 3, 0) self.sanEdit = QtGui.QLineEdit() self.sanEdit.setText("4") gridLayout.addWidget(self.sanEdit, 3, 1) # Sandy bridge input self.wesLabel = QtGui.QLabel('Westmere') gridLayout.addWidget(self.wesLabel, 4, 0) self.wesEdit = QtGui.QLineEdit() self.wesEdit.setText("2") gridLayout.addWidget(self.wesEdit, 4, 1) # Sandy bridge input self.nehLabel = QtGui.QLabel('Nehalem') gridLayout.addWidget(self.nehLabel, 5, 0) self.nehEdit = QtGui.QLineEdit() self.nehEdit.setText("1") gridLayout.addWidget(self.nehEdit, 5, 1) # Sandy bridge input self.harLabel = QtGui.QLabel('Harpertown') gridLayout.addWidget(self.harLabel, 6, 0) self.harEdit = QtGui.QLineEdit() self.harEdit.setText("1") gridLayout.addWidget(self.harEdit, 6, 1) self.sendButton = QtGui.QPushButton('Send to Amazon') gridLayout.addWidget(self.sendButton, 8, 1) self.connect(self.sendButton, QtCore.SIGNAL('clicked()'), self.send)
def __init__(self, parent, surfaceType): QtGui.QWidget.__init__(self, parent) while not isinstance(parent, QtGui.QDialog): parent = parent.parent() self.setObjectName("ProtectionAreaPanel" + str(len(parent.findChildren(ProtectionAreaPanel)))) self.resize(328, 45) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) self.setSizePolicy(sizePolicy) self.horizontalLayout = QtGui.QHBoxLayout(self) self.horizontalLayout.setContentsMargins(0, 0, 0, 0) self.horizontalLayout.setObjectName("horizontalLayout") self.basicFrame = Frame(self, "HL") self.horizontalLayout.addWidget(self.basicFrame) self.captionLabel = QtGui.QLabel(self.basicFrame) self.captionLabel.setMinimumSize(QtCore.QSize(150, 25)) self.captionLabel.setMaximumSize(QtCore.QSize(150, 16777215)) self.captionLabel.setObjectName("captionLabel") self.basicFrame.Add = self.captionLabel self.tableBox = QtGui.QFrame(self.basicFrame) self.tableBox.setFrameShape(QtGui.QFrame.StyledPanel) self.tableBox.setFrameShadow(QtGui.QFrame.Raised) self.tableBox.setObjectName("tableBox") self.horizontalLayout_tableBox = QtGui.QHBoxLayout(self.tableBox) self.horizontalLayout_tableBox.setObjectName("horizontalLayout_tableBox") self.comboBox = QtGui.QComboBox(self.tableBox) self.comboBox.setMinimumSize(QtCore.QSize(100, 23)) self.comboBox.setObjectName("comboBox") self.comboBox.setMinimumWidth(70) # self.comboBox.setMaximumWidth(200) self.horizontalLayout_tableBox.addWidget(self.comboBox) self.btnPickScreen = QtGui.QPushButton(self.tableBox) self.btnPickScreen.setMinimumSize(QtCore.QSize(25, 25)) self.btnPickScreen.setMaximumSize(QtCore.QSize(25, 25)) self.btnPickScreen.setText("") self.btnPickScreen.setIconSize(QtCore.QSize(25, 16)) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap("Resource/coordinate_capture.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.btnPickScreen.setIcon(icon) self.btnPickScreen.setObjectName("btnPickScreen") self.horizontalLayout_tableBox.addWidget(self.btnPickScreen) self.btnPreview = QtGui.QPushButton(self.tableBox) self.btnPreview.setMinimumSize(QtCore.QSize(25, 25)) self.btnPreview.setMaximumSize(QtCore.QSize(25, 25)) self.btnPreview.setText("") self.btnPreview.setIconSize(QtCore.QSize(25, 25)) self.btnPreview.setObjectName("btnPreview") icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap("Resource/Preview_32x32.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.btnPreview.setIcon(icon) self.horizontalLayout_tableBox.addWidget(self.btnPreview) self.btnSelectionArea = QtGui.QPushButton(self.tableBox) self.btnSelectionArea.setMinimumSize(QtCore.QSize(25, 25)) self.btnSelectionArea.setMaximumSize(QtCore.QSize(25, 25)) self.btnSelectionArea.setText("") self.btnSelectionArea.setIconSize(QtCore.QSize(25, 25)) self.btnSelectionArea.setObjectName("btnSelectionArea") self.horizontalLayout_tableBox.addWidget(self.btnSelectionArea) self.imgStatus = QtGui.QToolButton(self.tableBox) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.imgStatus.sizePolicy().hasHeightForWidth()) self.imgStatus.setSizePolicy(sizePolicy) self.imgStatus.setMinimumSize(QtCore.QSize(25, 25)) self.imgStatus.setMaximumSize(QtCore.QSize(25, 25)) self.imgStatus.setContextMenuPolicy(QtCore.Qt.DefaultContextMenu) self.imgStatus.setAcceptDrops(False) self.imgStatus.setText("") icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap("Resource/Warning.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.imgStatus.setIcon(icon) self.imgStatus.setIconSize(QtCore.QSize(25, 25)) self.imgStatus.setCheckable(False) self.imgStatus.setObjectName("imgStatus") self.horizontalLayout_tableBox.addWidget(self.imgStatus) self.basicFrame.Add = self.tableBox # spacerItem = QtGui.QSpacerItem(10,10,QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) # self.horizontalLayout.addItem(spacerItem) self.retranslateUi() self.comboBox.addItems(["Primary", "Secondary", "Primary & Secondary", "Complex"]) self.comboBox.currentIndexChanged.connect(self.comboBoxCurrentIndexChanged) self.imgStatus.clicked.connect(self.btnDropDown_Click) self.btnPickScreen.clicked.connect(self.btnPickScreen_Click) self.btnPreview.clicked.connect(self.btnPreview_Click) QtCore.QMetaObject.connectSlotsByName(self) self.updating = True; self.comboBox.setCurrentIndex(0); self.updating = False; self.rubberBand = None self.area = None self.complexDlg = None self.surfaceType = surfaceType self.method_2() self.btnSelectionArea.setVisible(False) self.forcedSelectionAreaOverwrite = False self.priviewClickFlag = False self.resultLayerList = []
def setupUi(self, MainWindow): MainWindow.setObjectName(_fromUtf8("MainWindow")) MainWindow.setEnabled(True) MainWindow.resize(886, 600) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth()) MainWindow.setSizePolicy(sizePolicy) font = QtGui.QFont() font.setFamily(_fromUtf8("Dyuthi")) font.setItalic(False) MainWindow.setFont(font) MainWindow.setMouseTracking(True) MainWindow.setFocusPolicy(QtCore.Qt.NoFocus) # define layouts for the window self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setObjectName(_fromUtf8("centralwidget")) self.gridLayout_2 = QtGui.QGridLayout(self.centralwidget) self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2")) self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setSpacing(6) self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.line_7 = QtGui.QFrame(self.centralwidget) self.line_7.setFrameShape(QtGui.QFrame.HLine) self.line_7.setFrameShadow(QtGui.QFrame.Sunken) self.line_7.setObjectName(_fromUtf8("line_7")) self.verticalLayout.addWidget(self.line_7) # define image display area self.imageDisplayLabel = QtGui.QLabel(self.centralwidget) self.imageDisplayLabel.setAlignment(QtCore.Qt.AlignHCenter |QtCore.Qt.AlignVCenter) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.MinimumExpanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.imageDisplayLabel.sizePolicy(). hasHeightForWidth()) self.imageDisplayLabel.setSizePolicy(sizePolicy) self.imageDisplayLabel.setAutoFillBackground(False) self.imageDisplayLabel.setStyleSheet(_fromUtf8("background-color: " "rgb(255, 255, 255);")) self.imageDisplayLabel.setText(_fromUtf8("")) self.imageDisplayLabel.setObjectName(_fromUtf8("imageDisplayLabel")) self.verticalLayout.addWidget(self.imageDisplayLabel) self.gridLayout_2.addLayout(self.verticalLayout, 1, 3, 2, 1) self.verticalLayout_3 = QtGui.QVBoxLayout() self.verticalLayout_3.setSizeConstraint(QtGui.QLayout.SetFixedSize) self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3")) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) # define Open button self.openImageButton = QtGui.QPushButton(self.centralwidget) self.openImageButton.setObjectName(_fromUtf8("openImageButton")) self.horizontalLayout.addWidget(self.openImageButton) # define Save button self.saveImageButton = QtGui.QPushButton(self.centralwidget) self.saveImageButton.setObjectName(_fromUtf8("saveImageButton")) self.saveImageButton.setEnabled(False) self.horizontalLayout.addWidget(self.saveImageButton) self.verticalLayout_3.addLayout(self.horizontalLayout) self.line_6 = QtGui.QFrame(self.centralwidget) self.line_6.setFrameShape(QtGui.QFrame.HLine) self.line_6.setFrameShadow(QtGui.QFrame.Sunken) self.line_6.setObjectName(_fromUtf8("line_6")) self.verticalLayout_3.addWidget(self.line_6) # define Histogram Equalization button self.histogramEqualizationButton = QtGui.QPushButton(self.centralwidget) self.histogramEqualizationButton.setEnabled(False) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui. QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.histogramEqualizationButton. sizePolicy().hasHeightForWidth()) self.histogramEqualizationButton.setSizePolicy(sizePolicy) self.histogramEqualizationButton.setObjectName( _fromUtf8("histogramEqualizationButton")) self.verticalLayout_3.addWidget(self.histogramEqualizationButton) # define View Histogram button self.viewHistogramButton = QtGui.QPushButton(self.centralwidget) self.viewHistogramButton.setObjectName(_fromUtf8("viewHistogramButton")) self.verticalLayout_3.addWidget(self.viewHistogramButton) self.line_10 = QtGui.QFrame(self.centralwidget) self.line_10.setFrameShape(QtGui.QFrame.HLine) self.line_10.setFrameShadow(QtGui.QFrame.Sunken) self.line_10.setObjectName(_fromUtf8("line_10")) self.verticalLayout_3.addWidget(self.line_10) # define Gamma Correction button self.gammaCorrectionButton = QtGui.QPushButton(self.centralwidget) self.gammaCorrectionButton.setObjectName(_fromUtf8("gammaCorrectionButton")) self.gammaCorrectionButton.setEnabled(False) self.verticalLayout_3.addWidget(self.gammaCorrectionButton) # define Log Transform button self.logTransformButton = QtGui.QPushButton(self.centralwidget) self.logTransformButton.setObjectName(_fromUtf8("logTransformButton")) self.logTransformButton.setEnabled(False) self.verticalLayout_3.addWidget(self.logTransformButton) # define Image Negative button self.negativeButton = QtGui.QPushButton(self.centralwidget) self.negativeButton.setObjectName(_fromUtf8("negativeButton")) self.negativeButton.setEnabled(False) self.verticalLayout_3.addWidget(self.negativeButton) self.line_2 = QtGui.QFrame(self.centralwidget) self.line_2.setFrameShape(QtGui.QFrame.HLine) self.line_2.setFrameShadow(QtGui.QFrame.Sunken) self.line_2.setObjectName(_fromUtf8("line_2")) self.verticalLayout_3.addWidget(self.line_2) self.horizontalLayout_9 = QtGui.QHBoxLayout() self.horizontalLayout_9.setObjectName(_fromUtf8("horizontalLayout_9")) # define Blur Slider Name label self.blurLabel = QtGui.QLabel(self.centralwidget) self.blurLabel.setObjectName(_fromUtf8("blurLabel")) self.horizontalLayout_9.addWidget(self.blurLabel) self.blurValueLabel = QtGui.QLabel(self.centralwidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.blurValueLabel.sizePolicy() .hasHeightForWidth()) # define Blur Slider Value label self.blurValueLabel.setSizePolicy(sizePolicy) self.blurValueLabel.setAlignment(QtCore.Qt.AlignRight|QtCore .Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.blurValueLabel.setObjectName(_fromUtf8("blurValueLabel")) self.horizontalLayout_9.addWidget(self.blurValueLabel) self.verticalLayout_3.addLayout(self.horizontalLayout_9) # define blur slider self.blurExtendInputSlider = QtGui.QSlider(self.centralwidget) self.blurExtendInputSlider.setOrientation(QtCore.Qt.Horizontal) self.blurExtendInputSlider.setObjectName(_fromUtf8("blurExtendInputSlider")) self.blurExtendInputSlider.setRange(0,10) self.blurExtendInputSlider.setEnabled(False) self.verticalLayout_3.addWidget(self.blurExtendInputSlider) self.line_3 = QtGui.QFrame(self.centralwidget) self.line_3.setFrameShape(QtGui.QFrame.HLine) self.line_3.setFrameShadow(QtGui.QFrame.Sunken) self.line_3.setObjectName(_fromUtf8("line_3")) self.verticalLayout_3.addWidget(self.line_3) self.horizontalLayout_10 = QtGui.QHBoxLayout() self.horizontalLayout_10.setObjectName(_fromUtf8("horizontalLayout_10")) # define Sharpen Slider Name label self.sharpenLabel = QtGui.QLabel(self.centralwidget) self.sharpenLabel.setObjectName(_fromUtf8("sharpenLabel")) self.horizontalLayout_10.addWidget(self.sharpenLabel) self.sharpenValueLabel = QtGui.QLabel(self.centralwidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.sharpenValueLabel.sizePolicy() .hasHeightForWidth()) # define Sharpen Slider Value label self.sharpenValueLabel.setSizePolicy(sizePolicy) self.sharpenValueLabel.setAlignment(QtCore.Qt.AlignRight|QtCore .Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.sharpenValueLabel.setObjectName(_fromUtf8("sharpenValueLabel")) self.horizontalLayout_10.addWidget(self.sharpenValueLabel) self.verticalLayout_3.addLayout(self.horizontalLayout_10) # define Sharpen Slider self.sharpenExtendInputSlider = QtGui.QSlider(self.centralwidget) self.sharpenExtendInputSlider.setOrientation(QtCore.Qt.Horizontal) self.sharpenExtendInputSlider.setObjectName( _fromUtf8("sharpenExtendInputSlider")) self.sharpenExtendInputSlider.setRange(0, 10) self.sharpenExtendInputSlider.setEnabled(False) self.verticalLayout_3.addWidget(self.sharpenExtendInputSlider) self.line_4 = QtGui.QFrame(self.centralwidget) self.line_4.setFrameShape(QtGui.QFrame.HLine) self.line_4.setFrameShadow(QtGui.QFrame.Sunken) self.line_4.setObjectName(_fromUtf8("line_4")) self.verticalLayout_3.addWidget(self.line_4) self.horizontalLayout_4 = QtGui.QHBoxLayout() self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4")) # define Undo button self.undoButton = QtGui.QPushButton(self.centralwidget) self.undoButton.setObjectName(_fromUtf8("undoButton")) self.undoButton.setEnabled(False) self.horizontalLayout_4.addWidget(self.undoButton) # define Undo All button self.undoAllButton = QtGui.QPushButton(self.centralwidget) self.undoAllButton.setObjectName(_fromUtf8("undoAllButton")) self.undoAllButton.setEnabled(False) self.horizontalLayout_4.addWidget(self.undoAllButton) self.verticalLayout_3.addLayout(self.horizontalLayout_4) self.line = QtGui.QFrame(self.centralwidget) self.line.setFrameShape(QtGui.QFrame.HLine) self.line.setFrameShadow(QtGui.QFrame.Sunken) self.line.setObjectName(_fromUtf8("line")) self.verticalLayout_3.addWidget(self.line) # define Edge Detection button self.detectEdgeButton = QtGui.QPushButton(self.centralwidget) self.detectEdgeButton.setObjectName(_fromUtf8("detectEdgeButton")) self.verticalLayout_3.addWidget(self.detectEdgeButton) self.line_9 = QtGui.QFrame(self.centralwidget) self.line_9.setFrameShape(QtGui.QFrame.HLine) self.line_9.setFrameShadow(QtGui.QFrame.Sunken) self.line_9.setObjectName(_fromUtf8("line_9")) self.verticalLayout_3.addWidget(self.line_9) self.detectEdgeButton.setEnabled(False) self.viewHistogramButton.setEnabled(False) # progress label is not used self.progressLabel = QtGui.QLabel(self.centralwidget) self.progressLabel.setText(_fromUtf8("")) self.progressLabel.setObjectName(_fromUtf8("progressLabel")) self.verticalLayout_3.addWidget(self.progressLabel) spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout_3.addItem(spacerItem) self.gridLayout_2.addLayout(self.verticalLayout_3, 2, 0, 1, 2) self.line_5 = QtGui.QFrame(self.centralwidget) self.line_5.setFrameShape(QtGui.QFrame.VLine) self.line_5.setFrameShadow(QtGui.QFrame.Sunken) self.line_5.setObjectName(_fromUtf8("line_5")) self.gridLayout_2.addWidget(self.line_5, 2, 2, 1, 1) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtGui.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 886, 25)) self.menubar.setObjectName(_fromUtf8("menubar")) MainWindow.setMenuBar(self.menubar) self.statusbar = QtGui.QStatusBar(MainWindow) self.statusbar.setObjectName(_fromUtf8("statusbar")) MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def comboBoxCurrentIndexChanged(self): self.method_2() self.method_3() self.emit(QtCore.SIGNAL("Event0"), self)
def qCleanupResources(): QtCore.qUnregisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
def setupUi(self, MainWindow): MainWindow.setObjectName(_fromUtf8("MainWindow")) MainWindow.resize(1230, 900) self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setObjectName(_fromUtf8("centralwidget")) self.kinectFrame = QtGui.QFrame(self.centralwidget) self.kinectFrame.setGeometry(QtCore.QRect(240, 40, 640, 480)) self.kinectFrame.setFrameShape(QtGui.QFrame.StyledPanel) self.kinectFrame.setFrameShadow(QtGui.QFrame.Raised) self.kinectFrame.setObjectName(_fromUtf8("kinectFrame")) self.videoDisplay = QtGui.QLabel(self.kinectFrame) self.videoDisplay.setGeometry(QtCore.QRect(0, 0, 640, 480)) self.videoDisplay.setObjectName(_fromUtf8("videoDisplay")) self.OutputFrame = QtGui.QFrame(self.centralwidget) self.OutputFrame.setGeometry(QtCore.QRect(10, 40, 221, 311)) self.OutputFrame.setFrameShape(QtGui.QFrame.StyledPanel) self.OutputFrame.setFrameShadow(QtGui.QFrame.Raised) self.OutputFrame.setObjectName(_fromUtf8("OutputFrame")) self.JointCoordLabel = QtGui.QLabel(self.OutputFrame) self.JointCoordLabel.setGeometry(QtCore.QRect(40, 10, 141, 17)) font = QtGui.QFont() font.setBold(True) font.setWeight(75) self.JointCoordLabel.setFont(font) self.JointCoordLabel.setObjectName(_fromUtf8("JointCoordLabel")) self.WorldCoordLabel = QtGui.QLabel(self.OutputFrame) self.WorldCoordLabel.setGeometry(QtCore.QRect(30, 160, 161, 17)) #(30, 160, 161, 17) font = QtGui.QFont() font.setBold(True) font.setWeight(75) self.WorldCoordLabel.setFont(font) self.WorldCoordLabel.setObjectName(_fromUtf8("WorldCoordLabel")) self.layoutWidget_2 = QtGui.QWidget(self.OutputFrame) self.layoutWidget_2.setGeometry(QtCore.QRect(80, 30, 131, 130)) #(80, 30, 131, 120) self.layoutWidget_2.setObjectName(_fromUtf8("layoutWidget_2")) self.verticalLayout_8 = QtGui.QVBoxLayout(self.layoutWidget_2) self.verticalLayout_8.setObjectName(_fromUtf8("verticalLayout_8")) self.rdoutBaseJC = QtGui.QLabel(self.layoutWidget_2) font = QtGui.QFont() font.setFamily(_fromUtf8("Ubuntu Mono")) font.setPointSize(14) self.rdoutBaseJC.setFont(font) self.rdoutBaseJC.setObjectName(_fromUtf8("rdoutBaseJC")) self.verticalLayout_8.addWidget(self.rdoutBaseJC, QtCore.Qt.AlignLeft) self.rdoutShoulderJC = QtGui.QLabel(self.layoutWidget_2) font = QtGui.QFont() font.setFamily(_fromUtf8("Ubuntu Mono")) font.setPointSize(14) self.rdoutShoulderJC.setFont(font) self.rdoutShoulderJC.setObjectName(_fromUtf8("rdoutShoulderJC")) self.verticalLayout_8.addWidget(self.rdoutShoulderJC, QtCore.Qt.AlignLeft) self.rdoutElbowJC = QtGui.QLabel(self.layoutWidget_2) font = QtGui.QFont() font.setFamily(_fromUtf8("Ubuntu Mono")) font.setPointSize(14) self.rdoutElbowJC.setFont(font) self.rdoutElbowJC.setObjectName(_fromUtf8("rdoutElbowJC")) self.verticalLayout_8.addWidget(self.rdoutElbowJC, QtCore.Qt.AlignLeft) self.rdoutWristJC = QtGui.QLabel(self.layoutWidget_2) font = QtGui.QFont() font.setFamily(_fromUtf8("Ubuntu Mono")) font.setPointSize(14) self.rdoutWristJC.setFont(font) self.rdoutWristJC.setObjectName(_fromUtf8("rdoutWristJC")) self.verticalLayout_8.addWidget(self.rdoutWristJC, QtCore.Qt.AlignLeft) self.rdoutWrist2JC = QtGui.QLabel(self.layoutWidget_2) font = QtGui.QFont() font.setFamily(_fromUtf8("Ubuntu Mono")) font.setPointSize(14) self.rdoutWrist2JC.setFont(font) self.rdoutWrist2JC.setObjectName(_fromUtf8("rdoutWrist2JC")) self.verticalLayout_8.addWidget(self.rdoutWrist2JC, QtCore.Qt.AlignLeft) self.rdoutWrist3JC = QtGui.QLabel(self.layoutWidget_2) font = QtGui.QFont() font.setFamily(_fromUtf8("Ubuntu Mono")) font.setPointSize(14) self.rdoutWrist3JC.setFont(font) self.rdoutWrist3JC.setObjectName(_fromUtf8("rdoutWrist3JC")) self.verticalLayout_8.addWidget(self.rdoutWrist3JC, QtCore.Qt.AlignLeft) self.layoutWidget_3 = QtGui.QWidget(self.OutputFrame) self.layoutWidget_3.setGeometry(QtCore.QRect(10, 30, 66, 130)) #(10, 30, 66, 120) self.layoutWidget_3.setObjectName(_fromUtf8("layoutWidget_3")) self.verticalLayout_9 = QtGui.QVBoxLayout(self.layoutWidget_3) self.verticalLayout_9.setObjectName(_fromUtf8("verticalLayout_9")) self.BLabel = QtGui.QLabel(self.layoutWidget_3) font = QtGui.QFont() font.setFamily(_fromUtf8("Ubuntu Mono")) font.setPointSize(14) self.BLabel.setFont(font) self.BLabel.setObjectName(_fromUtf8("BLabel")) self.verticalLayout_9.addWidget(self.BLabel, QtCore.Qt.AlignRight) self.SLabel = QtGui.QLabel(self.layoutWidget_3) font = QtGui.QFont() font.setFamily(_fromUtf8("Ubuntu Mono")) font.setPointSize(14) self.SLabel.setFont(font) self.SLabel.setObjectName(_fromUtf8("SLabel")) self.verticalLayout_9.addWidget(self.SLabel, QtCore.Qt.AlignRight) self.ELabel = QtGui.QLabel(self.layoutWidget_3) font = QtGui.QFont() font.setFamily(_fromUtf8("Ubuntu Mono")) font.setPointSize(14) self.ELabel.setFont(font) self.ELabel.setObjectName(_fromUtf8("ELabel")) self.verticalLayout_9.addWidget(self.ELabel, QtCore.Qt.AlignRight) self.WLabel = QtGui.QLabel(self.layoutWidget_3) font = QtGui.QFont() font.setFamily(_fromUtf8("Ubuntu Mono")) font.setPointSize(14) self.WLabel.setFont(font) self.WLabel.setObjectName(_fromUtf8("WLabel")) self.verticalLayout_9.addWidget(self.WLabel, QtCore.Qt.AlignRight) self.W2Label = QtGui.QLabel(self.layoutWidget_3) font = QtGui.QFont() font.setFamily(_fromUtf8("Ubuntu Mono")) font.setPointSize(14) self.W2Label.setFont(font) self.W2Label.setObjectName(_fromUtf8("W2Label")) self.verticalLayout_9.addWidget(self.W2Label, QtCore.Qt.AlignRight) self.W3Label = QtGui.QLabel(self.layoutWidget_3) font = QtGui.QFont() font.setFamily(_fromUtf8("Ubuntu Mono")) font.setPointSize(14) self.W3Label.setFont(font) self.W3Label.setObjectName(_fromUtf8("W3Label")) self.verticalLayout_9.addWidget(self.W3Label, QtCore.Qt.AlignRight) self.layoutWidget_4 = QtGui.QWidget(self.OutputFrame) self.layoutWidget_4.setGeometry(QtCore.QRect(80, 179, 131, 121)) self.layoutWidget_4.setObjectName(_fromUtf8("layoutWidget_4")) self.verticalLayout_12 = QtGui.QVBoxLayout(self.layoutWidget_4) self.verticalLayout_12.setObjectName(_fromUtf8("verticalLayout_12")) self.rdoutX = QtGui.QLabel(self.layoutWidget_4) font = QtGui.QFont() font.setFamily(_fromUtf8("Ubuntu Mono")) font.setPointSize(14) self.rdoutX.setFont(font) self.rdoutX.setObjectName(_fromUtf8("rdoutX")) self.verticalLayout_12.addWidget(self.rdoutX, QtCore.Qt.AlignLeft) self.rdoutY = QtGui.QLabel(self.layoutWidget_4) font = QtGui.QFont() font.setFamily(_fromUtf8("Ubuntu Mono")) font.setPointSize(14) self.rdoutY.setFont(font) self.rdoutY.setObjectName(_fromUtf8("rdoutY")) self.verticalLayout_12.addWidget(self.rdoutY, QtCore.Qt.AlignLeft) self.rdoutZ = QtGui.QLabel(self.layoutWidget_4) font = QtGui.QFont() font.setFamily(_fromUtf8("Ubuntu Mono")) font.setPointSize(14) self.rdoutZ.setFont(font) self.rdoutZ.setObjectName(_fromUtf8("rdoutZ")) self.verticalLayout_12.addWidget(self.rdoutZ, QtCore.Qt.AlignLeft) self.rdoutT = QtGui.QLabel(self.layoutWidget_4) font = QtGui.QFont() font.setFamily(_fromUtf8("Ubuntu Mono")) font.setPointSize(14) self.rdoutT.setFont(font) self.rdoutT.setObjectName(_fromUtf8("rdoutT")) self.verticalLayout_12.addWidget(self.rdoutT, QtCore.Qt.AlignLeft) # self.rdoutG = QtGui.QLabel(self.layoutWidget_4) font = QtGui.QFont() font.setFamily(_fromUtf8("Ubuntu Mono")) font.setPointSize(14) # self.rdoutG.setFont(font) # self.rdoutG.setObjectName(_fromUtf8("rdoutG")) # self.verticalLayout_12.addWidget(self.rdoutG, QtCore.Qt.AlignLeft) # self.rdoutP = QtGui.QLabel(self.layoutWidget_4) font = QtGui.QFont() font.setFamily(_fromUtf8("Ubuntu Mono")) font.setPointSize(14) # self.rdoutP.setFont(font) # self.rdoutP.setObjectName(_fromUtf8("rdoutP")) # self.verticalLayout_12.addWidget(self.rdoutP, QtCore.Qt.AlignLeft) self.layoutWidget_5 = QtGui.QWidget(self.OutputFrame) self.layoutWidget_5.setGeometry(QtCore.QRect(11, 180, 66, 121)) self.layoutWidget_5.setObjectName(_fromUtf8("layoutWidget_5")) self.verticalLayout_13 = QtGui.QVBoxLayout(self.layoutWidget_5) self.verticalLayout_13.setObjectName(_fromUtf8("verticalLayout_13")) self.XLabel = QtGui.QLabel(self.layoutWidget_5) font = QtGui.QFont() font.setFamily(_fromUtf8("Ubuntu Mono")) font.setPointSize(14) self.XLabel.setFont(font) self.XLabel.setObjectName(_fromUtf8("XLabel")) self.verticalLayout_13.addWidget(self.XLabel, QtCore.Qt.AlignRight) self.YLabel = QtGui.QLabel(self.layoutWidget_5) font = QtGui.QFont() font.setFamily(_fromUtf8("Ubuntu Mono")) font.setPointSize(14) self.YLabel.setFont(font) self.YLabel.setObjectName(_fromUtf8("YLabel")) self.verticalLayout_13.addWidget(self.YLabel, QtCore.Qt.AlignRight) self.ZLabel = QtGui.QLabel(self.layoutWidget_5) font = QtGui.QFont() font.setFamily(_fromUtf8("Ubuntu Mono")) font.setPointSize(14) self.ZLabel.setFont(font) self.ZLabel.setObjectName(_fromUtf8("ZLabel")) self.verticalLayout_13.addWidget(self.ZLabel, QtCore.Qt.AlignRight) self.TLabel = QtGui.QLabel(self.layoutWidget_5) self.TLabel.setEnabled(True) font = QtGui.QFont() font.setFamily(_fromUtf8("Ubuntu Mono")) font.setPointSize(14) self.TLabel.setFont(font) self.TLabel.setObjectName(_fromUtf8("TLabel")) self.verticalLayout_13.addWidget(self.TLabel, QtCore.Qt.AlignRight) # self.GLabel = QtGui.QLabel(self.layoutWidget_5) font = QtGui.QFont() font.setFamily(_fromUtf8("Ubuntu Mono")) font.setPointSize(14) # self.GLabel.setFont(font) # self.GLabel.setObjectName(_fromUtf8("GLabel")) # self.verticalLayout_13.addWidget(self.GLabel, QtCore.Qt.AlignRight) # self.PLabel = QtGui.QLabel(self.layoutWidget_5) font = QtGui.QFont() font.setFamily(_fromUtf8("Ubuntu Mono")) font.setPointSize(14) # self.PLabel.setFont(font) # self.PLabel.setObjectName(_fromUtf8("PLabel")) # self.verticalLayout_13.addWidget(self.PLabel, QtCore.Qt.AlignRight) self.btn_estop = QtGui.QPushButton(self.centralwidget) self.btn_estop.setGeometry(QtCore.QRect(900, 40, 311, 71)) font = QtGui.QFont() font.setPointSize(20) font.setBold(True) font.setWeight(75) self.btn_estop.setFont(font) self.btn_estop.setObjectName(_fromUtf8("btn_estop")) self.btn_exec = QtGui.QPushButton(self.centralwidget) self.btn_exec.setGeometry(QtCore.QRect(900, 120, 311, 71)) font = QtGui.QFont() font.setPointSize(20) font.setBold(True) font.setWeight(75) self.btn_exec.setFont(font) self.btn_exec.setObjectName(_fromUtf8("btn_exec")) self.radioVideo = QtGui.QRadioButton(self.centralwidget) self.radioVideo.setGeometry(QtCore.QRect(240, 10, 117, 22)) self.radioVideo.setChecked(True) self.radioVideo.setAutoExclusive(True) self.radioVideo.setObjectName(_fromUtf8("radioVideo")) self.radioUsr2 = QtGui.QRadioButton(self.centralwidget) self.radioUsr2.setGeometry(QtCore.QRect(610, 10, 117, 22)) self.radioUsr2.setObjectName(_fromUtf8("radioUsr2")) self.radioApril = QtGui.QRadioButton(self.centralwidget) self.radioApril.setGeometry(QtCore.QRect(360, 10, 117, 22)) self.radioApril.setObjectName(_fromUtf8("radioApril")) self.radioUsr1 = QtGui.QRadioButton(self.centralwidget) self.radioUsr1.setGeometry(QtCore.QRect(480, 10, 117, 22)) self.radioUsr1.setObjectName(_fromUtf8("radioUsr1")) self.SliderFrame = QtGui.QGroupBox(self.centralwidget) self.SliderFrame.setGeometry(QtCore.QRect(240, 590, 641, 191)) self.SliderFrame.setObjectName(_fromUtf8("SliderFrame")) self.layoutWidget = QtGui.QWidget(self.SliderFrame) self.layoutWidget.setGeometry(QtCore.QRect(0, 20, 65, 150)) #136 self.layoutWidget.setObjectName(_fromUtf8("layoutWidget")) self.verticalLayout = QtGui.QVBoxLayout(self.layoutWidget) self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.BLabelS = QtGui.QLabel(self.layoutWidget) self.BLabelS.setObjectName(_fromUtf8("BLabelS")) self.verticalLayout.addWidget(self.BLabelS, QtCore.Qt.AlignRight) self.SLabelS = QtGui.QLabel(self.layoutWidget) self.SLabelS.setObjectName(_fromUtf8("SLabelS")) self.verticalLayout.addWidget(self.SLabelS, QtCore.Qt.AlignRight) self.ELabelS = QtGui.QLabel(self.layoutWidget) self.ELabelS.setObjectName(_fromUtf8("ELabelS")) self.verticalLayout.addWidget(self.ELabelS, QtCore.Qt.AlignRight) self.WLabelS = QtGui.QLabel(self.layoutWidget) self.WLabelS.setObjectName(_fromUtf8("WLabelS")) self.verticalLayout.addWidget(self.WLabelS, QtCore.Qt.AlignRight) self.W2LabelS = QtGui.QLabel(self.layoutWidget) self.W2LabelS.setObjectName(_fromUtf8("W2LabelS")) self.verticalLayout.addWidget(self.W2LabelS, QtCore.Qt.AlignRight) self.W3LabelS = QtGui.QLabel(self.layoutWidget) self.W3LabelS.setObjectName(_fromUtf8("W3LabelS")) self.verticalLayout.addWidget(self.W3LabelS, QtCore.Qt.AlignRight) self.layoutWidget_6 = QtGui.QWidget(self.SliderFrame) self.layoutWidget_6.setGeometry(QtCore.QRect(70, 20, 371, 150)) #70, 20, 371, 136 self.layoutWidget_6.setObjectName(_fromUtf8("layoutWidget_6")) self.verticalLayout_2 = QtGui.QVBoxLayout(self.layoutWidget_6) self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2")) self.sldrBase = QtGui.QSlider(self.layoutWidget_6) self.sldrBase.setMinimum(-179) self.sldrBase.setMaximum(180) self.sldrBase.setOrientation(QtCore.Qt.Horizontal) self.sldrBase.setObjectName(_fromUtf8("sldrBase")) self.verticalLayout_2.addWidget(self.sldrBase) self.sldrShoulder = QtGui.QSlider(self.layoutWidget_6) self.sldrShoulder.setMinimum(-179) self.sldrShoulder.setMaximum(180) self.sldrShoulder.setOrientation(QtCore.Qt.Horizontal) self.sldrShoulder.setObjectName(_fromUtf8("sldrShoulder")) self.verticalLayout_2.addWidget(self.sldrShoulder) self.sldrElbow = QtGui.QSlider(self.layoutWidget_6) self.sldrElbow.setMinimum(-179) self.sldrElbow.setMaximum(180) self.sldrElbow.setOrientation(QtCore.Qt.Horizontal) self.sldrElbow.setObjectName(_fromUtf8("sldrElbow")) self.verticalLayout_2.addWidget(self.sldrElbow) self.sldrWrist = QtGui.QSlider(self.layoutWidget_6) self.sldrWrist.setMinimum(-179) self.sldrWrist.setMaximum(180) self.sldrWrist.setOrientation(QtCore.Qt.Horizontal) self.sldrWrist.setObjectName(_fromUtf8("sldrWrist")) self.verticalLayout_2.addWidget(self.sldrWrist) self.sldrWrist2 = QtGui.QSlider(self.layoutWidget_6) self.sldrWrist2.setMinimum(-179) self.sldrWrist2.setMaximum(180) self.sldrWrist2.setOrientation(QtCore.Qt.Horizontal) self.sldrWrist2.setObjectName(_fromUtf8("sldrWrist2")) self.verticalLayout_2.addWidget(self.sldrWrist2) self.sldrWrist3 = QtGui.QSlider(self.layoutWidget_6) self.sldrWrist3.setMinimum(-179) self.sldrWrist3.setMaximum(180) self.sldrWrist3.setOrientation(QtCore.Qt.Horizontal) self.sldrWrist3.setObjectName(_fromUtf8("sldrWrist3")) self.verticalLayout_2.addWidget(self.sldrWrist3) self.layoutWidget_7 = QtGui.QWidget(self.SliderFrame) self.layoutWidget_7.setGeometry(QtCore.QRect(462, 20, 51, 147)) #(462, 20, 51, 137) self.layoutWidget_7.setObjectName(_fromUtf8("layoutWidget_7")) self.verticalLayout_6 = QtGui.QVBoxLayout(self.layoutWidget_7) self.verticalLayout_6.setObjectName(_fromUtf8("verticalLayout_6")) self.rdoutBase = QtGui.QLabel(self.layoutWidget_7) self.rdoutBase.setObjectName(_fromUtf8("rdoutBase")) self.verticalLayout_6.addWidget(self.rdoutBase) self.rdoutShoulder = QtGui.QLabel(self.layoutWidget_7) self.rdoutShoulder.setObjectName(_fromUtf8("rdoutShoulder")) self.verticalLayout_6.addWidget(self.rdoutShoulder) self.rdoutElbow = QtGui.QLabel(self.layoutWidget_7) self.rdoutElbow.setObjectName(_fromUtf8("rdoutElbow")) self.verticalLayout_6.addWidget(self.rdoutElbow) self.rdoutWrist = QtGui.QLabel(self.layoutWidget_7) self.rdoutWrist.setObjectName(_fromUtf8("rdoutWrist")) self.verticalLayout_6.addWidget(self.rdoutWrist) self.rdoutWrist2 = QtGui.QLabel(self.layoutWidget_7) self.rdoutWrist2.setObjectName(_fromUtf8("rdoutWrist2")) self.verticalLayout_6.addWidget(self.rdoutWrist2) self.rdoutWrist3 = QtGui.QLabel(self.layoutWidget_7) self.rdoutWrist3.setObjectName(_fromUtf8("rdoutWrist3")) self.verticalLayout_6.addWidget(self.rdoutWrist3) self.sldrGrip1 = QtGui.QSlider(self.SliderFrame) self.sldrGrip1.setGeometry(QtCore.QRect(77, 166, 133, 29)) #77 self.sldrGrip1.setMinimum(-179) self.sldrGrip1.setMaximum(180) self.sldrGrip1.setOrientation(QtCore.Qt.Horizontal) self.sldrGrip1.setObjectName(_fromUtf8("sldrGrip1")) self.G1LableS = QtGui.QLabel(self.SliderFrame) self.G1LableS.setGeometry(QtCore.QRect(7, 171, 50, 17)) #24, 171, 41, 17 self.G1LableS.setObjectName(_fromUtf8("G1LableS")) self.rdoutGrip1 = QtGui.QLabel(self.SliderFrame) self.rdoutGrip1.setGeometry(QtCore.QRect(215, 166, 49, 28)) self.rdoutGrip1.setObjectName(_fromUtf8("rdoutGrip1")) self.sldrMaxTorque = QtGui.QSlider(self.SliderFrame) self.sldrMaxTorque.setGeometry(QtCore.QRect(530, 40, 30, 115)) self.sldrMaxTorque.setMaximum(100) self.sldrMaxTorque.setProperty("value", 25) self.sldrMaxTorque.setOrientation(QtCore.Qt.Vertical) self.sldrMaxTorque.setObjectName(_fromUtf8("sldrMaxTorque")) self.rdoutTorq = QtGui.QLabel(self.SliderFrame) self.rdoutTorq.setGeometry(QtCore.QRect(534, 162, 50, 28)) self.rdoutTorq.setObjectName(_fromUtf8("rdoutTorq")) self.sldrSpeed = QtGui.QSlider(self.SliderFrame) self.sldrSpeed.setGeometry(QtCore.QRect(600, 40, 29, 115)) self.sldrSpeed.setMaximum(100) self.sldrSpeed.setProperty("value", 25) self.sldrSpeed.setSliderPosition(25) self.sldrSpeed.setOrientation(QtCore.Qt.Vertical) self.sldrSpeed.setObjectName(_fromUtf8("sldrSpeed")) self.TqLabel = QtGui.QLabel(self.SliderFrame) self.TqLabel.setGeometry(QtCore.QRect(520, 10, 52, 20)) self.TqLabel.setObjectName(_fromUtf8("TqLabel")) self.rdoutSpeed = QtGui.QLabel(self.SliderFrame) self.rdoutSpeed.setGeometry(QtCore.QRect(604, 162, 49, 28)) self.rdoutSpeed.setObjectName(_fromUtf8("rdoutSpeed")) self.SpLabel = QtGui.QLabel(self.SliderFrame) self.SpLabel.setGeometry(QtCore.QRect(590, 10, 41, 21)) self.SpLabel.setObjectName(_fromUtf8("SpLabel")) self.chk_directcontrol = QtGui.QCheckBox(self.centralwidget) self.chk_directcontrol.setGeometry(QtCore.QRect(750, 570, 131, 22)) self.chk_directcontrol.setChecked(False) self.chk_directcontrol.setObjectName(_fromUtf8("chk_directcontrol")) self.rdoutMousePixels = QtGui.QLabel(self.centralwidget) self.rdoutMousePixels.setGeometry(QtCore.QRect(429, 530, 131, 20)) font = QtGui.QFont() font.setFamily(_fromUtf8("Ubuntu Mono")) font.setPointSize(12) font.setBold(True) font.setWeight(75) self.rdoutMousePixels.setFont(font) self.rdoutMousePixels.setTextFormat(QtCore.Qt.AutoText) self.rdoutMousePixels.setObjectName(_fromUtf8("rdoutMousePixels")) self.rdoutRGB = QtGui.QLabel(self.centralwidget) self.rdoutRGB.setGeometry(QtCore.QRect(757, 530, 121, 20)) font = QtGui.QFont() font.setFamily(_fromUtf8("Ubuntu Mono")) font.setPointSize(12) font.setBold(True) font.setWeight(75) self.rdoutRGB.setFont(font) self.rdoutRGB.setTextFormat(QtCore.Qt.AutoText) self.rdoutRGB.setObjectName(_fromUtf8("rdoutRGB")) self.RGBValueLabel = QtGui.QLabel(self.centralwidget) self.RGBValueLabel.setGeometry(QtCore.QRect(570, 530, 180, 17)) font = QtGui.QFont() font.setBold(True) font.setWeight(75) self.RGBValueLabel.setFont(font) self.RGBValueLabel.setObjectName(_fromUtf8("RGBValueLabel")) self.PixelCoordLabel = QtGui.QLabel(self.centralwidget) self.PixelCoordLabel.setGeometry(QtCore.QRect(268, 530, 144, 17)) font = QtGui.QFont() font.setBold(True) font.setWeight(75) self.PixelCoordLabel.setFont(font) self.PixelCoordLabel.setObjectName(_fromUtf8("PixelCoordLabel")) self.btn_task1 = QtGui.QPushButton(self.centralwidget) self.btn_task1.setGeometry(QtCore.QRect(900, 200, 311, 71)) font = QtGui.QFont() font.setPointSize(20) font.setBold(True) font.setWeight(75) self.btn_task1.setFont(font) self.btn_task1.setObjectName(_fromUtf8("btn_task1")) self.btn_task2 = QtGui.QPushButton(self.centralwidget) self.btn_task2.setGeometry(QtCore.QRect(900, 280, 311, 71)) font = QtGui.QFont() font.setPointSize(20) font.setBold(True) font.setWeight(75) self.btn_task2.setFont(font) self.btn_task2.setObjectName(_fromUtf8("btn_task2")) self.btn_task3 = QtGui.QPushButton(self.centralwidget) self.btn_task3.setGeometry(QtCore.QRect(900, 360, 311, 71)) font = QtGui.QFont() font.setPointSize(20) font.setBold(True) font.setWeight(75) self.btn_task3.setFont(font) self.btn_task3.setObjectName(_fromUtf8("btn_task3")) self.btn_task4 = QtGui.QPushButton(self.centralwidget) self.btn_task4.setGeometry(QtCore.QRect(900, 440, 311, 71)) font = QtGui.QFont() font.setPointSize(20) font.setBold(True) font.setWeight(75) self.btn_task4.setFont(font) self.btn_task4.setObjectName(_fromUtf8("btn_task4")) self.btn_exec_6 = QtGui.QPushButton(self.centralwidget) self.btn_exec_6.setGeometry(QtCore.QRect(900, 520, 311, 71)) font = QtGui.QFont() font.setPointSize(20) font.setBold(True) font.setWeight(75) self.btn_exec_6.setFont(font) self.btn_exec_6.setObjectName(_fromUtf8("btn_exec_6")) self.layoutWidget_8 = QtGui.QWidget(self.centralwidget) self.layoutWidget_8.setGeometry(QtCore.QRect(10, 360, 221, 410)) self.layoutWidget_8.setObjectName(_fromUtf8("layoutWidget_8")) self.Group2 = QtGui.QVBoxLayout(self.layoutWidget_8) self.Group2.setMargin(10) self.Group2.setObjectName(_fromUtf8("Group2")) self.btnUser1 = QtGui.QPushButton(self.layoutWidget_8) self.btnUser1.setObjectName(_fromUtf8("btnUser1")) self.Group2.addWidget(self.btnUser1) self.btnUser2 = QtGui.QPushButton(self.layoutWidget_8) self.btnUser2.setObjectName(_fromUtf8("btnUser2")) self.Group2.addWidget(self.btnUser2) self.btnUser3 = QtGui.QPushButton(self.layoutWidget_8) self.btnUser3.setObjectName(_fromUtf8("btnUser3")) self.Group2.addWidget(self.btnUser3) self.btnUser4 = QtGui.QPushButton(self.layoutWidget_8) self.btnUser4.setObjectName(_fromUtf8("btnUser4")) self.Group2.addWidget(self.btnUser4) self.btnUser5 = QtGui.QPushButton(self.layoutWidget_8) self.btnUser5.setObjectName(_fromUtf8("btnUser5")) self.Group2.addWidget(self.btnUser5) self.btnUser6 = QtGui.QPushButton(self.layoutWidget_8) self.btnUser6.setObjectName(_fromUtf8("btnUser6")) self.Group2.addWidget(self.btnUser6) self.btnUser7 = QtGui.QPushButton(self.layoutWidget_8) self.btnUser7.setObjectName(_fromUtf8("btnUser7")) self.Group2.addWidget(self.btnUser7) self.btnUser8 = QtGui.QPushButton(self.layoutWidget_8) self.btnUser8.setObjectName(_fromUtf8("btnUser8")) self.Group2.addWidget(self.btnUser8) self.btnUser9 = QtGui.QPushButton(self.layoutWidget_8) self.btnUser9.setObjectName(_fromUtf8("btnUser9")) self.Group2.addWidget(self.btnUser9) self.btnUser10 = QtGui.QPushButton(self.layoutWidget_8) self.btnUser10.setAutoRepeatDelay(300) self.btnUser10.setObjectName(_fromUtf8("btnUser10")) self.Group2.addWidget(self.btnUser10) self.btnUser11 = QtGui.QPushButton(self.layoutWidget_8) self.btnUser11.setAutoRepeatDelay(300) self.btnUser11.setObjectName(_fromUtf8("btnUser11")) self.Group2.addWidget(self.btnUser11) self.btnUser12 = QtGui.QPushButton(self.layoutWidget_8) self.btnUser12.setAutoRepeatDelay(300) self.btnUser12.setObjectName(_fromUtf8("btnUser12")) self.Group2.addWidget(self.btnUser12) self.groupBox = QtGui.QGroupBox(self.centralwidget) self.groupBox.setGeometry(QtCore.QRect(10, 820, 1211, 51)) self.groupBox.setObjectName(_fromUtf8("groupBox")) self.rdoutStatus = QtGui.QLabel(self.groupBox) self.rdoutStatus.setGeometry(QtCore.QRect(70, 0, 905, 51)) font = QtGui.QFont() font.setPointSize(12) self.rdoutStatus.setFont(font) self.rdoutStatus.setTextFormat(QtCore.Qt.AutoText) self.rdoutStatus.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) self.rdoutStatus.setObjectName(_fromUtf8("rdoutStatus")) MainWindow.setCentralWidget(self.centralwidget) self.statusbar = QtGui.QStatusBar(MainWindow) self.statusbar.setObjectName(_fromUtf8("statusbar")) MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def doAlarmOff(self): if (self.isAlarmActive): self.isSnoozeActive = False self.isAlarmActive = False self.emit(QtCore.SIGNAL('stopAllAudio'))
def setupUi(self, Settings): Settings.setObjectName(_fromUtf8("Settings")) Settings.resize(938, 402) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/images/Settings.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) Settings.setWindowIcon(icon) Settings.setLayoutDirection(QtCore.Qt.RightToLeft) Settings.setStyleSheet(_fromUtf8("")) Settings.setLocale( QtCore.QLocale(QtCore.QLocale.Arabic, QtCore.QLocale.SaudiArabia)) self.groupBox = QtGui.QGroupBox(Settings) self.groupBox.setGeometry(QtCore.QRect(479, 20, 451, 181)) self.groupBox.setObjectName(_fromUtf8("groupBox")) self.textHostDB = QtGui.QLineEdit(self.groupBox) self.textHostDB.setGeometry(QtCore.QRect(12, 19, 291, 31)) self.textHostDB.setObjectName(_fromUtf8("textHostDB")) self.textUserDB = QtGui.QLineEdit(self.groupBox) self.textUserDB.setGeometry(QtCore.QRect(12, 59, 291, 31)) self.textUserDB.setObjectName(_fromUtf8("textUserDB")) self.label = QtGui.QLabel(self.groupBox) self.label.setGeometry(QtCore.QRect(313, 19, 71, 31)) self.label.setObjectName(_fromUtf8("label")) self.label_2 = QtGui.QLabel(self.groupBox) self.label_2.setGeometry(QtCore.QRect(310, 59, 111, 31)) self.label_2.setObjectName(_fromUtf8("label_2")) self.label_3 = QtGui.QLabel(self.groupBox) self.label_3.setGeometry(QtCore.QRect(313, 99, 91, 31)) self.label_3.setObjectName(_fromUtf8("label_3")) self.label_4 = QtGui.QLabel(self.groupBox) self.label_4.setGeometry(QtCore.QRect(313, 139, 101, 31)) self.label_4.setObjectName(_fromUtf8("label_4")) self.textNameDB = QtGui.QLineEdit(self.groupBox) self.textNameDB.setGeometry(QtCore.QRect(10, 140, 291, 31)) self.textNameDB.setObjectName(_fromUtf8("textNameDB")) self.textPassDB = QtGui.QLineEdit(self.groupBox) self.textPassDB.setGeometry(QtCore.QRect(10, 100, 291, 31)) self.textPassDB.setObjectName(_fromUtf8("textPassDB")) self.groupBox_2 = QtGui.QGroupBox(Settings) self.groupBox_2.setGeometry(QtCore.QRect(10, 20, 451, 141)) self.groupBox_2.setObjectName(_fromUtf8("groupBox_2")) self.label_5 = QtGui.QLabel(self.groupBox_2) self.label_5.setGeometry(QtCore.QRect(311, 18, 71, 31)) self.label_5.setObjectName(_fromUtf8("label_5")) self.textHostFTP = QtGui.QLineEdit(self.groupBox_2) self.textHostFTP.setGeometry(QtCore.QRect(10, 18, 291, 31)) self.textHostFTP.setObjectName(_fromUtf8("textHostFTP")) self.label_6 = QtGui.QLabel(self.groupBox_2) self.label_6.setGeometry(QtCore.QRect(310, 58, 111, 31)) self.label_6.setObjectName(_fromUtf8("label_6")) self.textUserFTP = QtGui.QLineEdit(self.groupBox_2) self.textUserFTP.setGeometry(QtCore.QRect(9, 58, 291, 31)) self.textUserFTP.setObjectName(_fromUtf8("textUserFTP")) self.label_7 = QtGui.QLabel(self.groupBox_2) self.label_7.setGeometry(QtCore.QRect(310, 98, 91, 31)) self.label_7.setObjectName(_fromUtf8("label_7")) self.textPassFTP = QtGui.QLineEdit(self.groupBox_2) self.textPassFTP.setGeometry(QtCore.QRect(10, 98, 291, 31)) self.textPassFTP.setObjectName(_fromUtf8("textPassFTP")) self.labCheckDB = QtGui.QLabel(Settings) self.labCheckDB.setGeometry(QtCore.QRect(336, 270, 61, 41)) self.labCheckDB.setCursor(QtGui.QCursor(QtCore.Qt.OpenHandCursor)) self.labCheckDB.setText(_fromUtf8("")) self.labCheckDB.setPixmap( QtGui.QPixmap(_fromUtf8(":/images/database.png"))) self.labCheckDB.setScaledContents(True) self.labCheckDB.setObjectName(_fromUtf8("labCheckDB")) self.labCheckFTP = QtGui.QLabel(Settings) self.labCheckFTP.setGeometry(QtCore.QRect(270, 270, 51, 41)) self.labCheckFTP.setCursor(QtGui.QCursor(QtCore.Qt.OpenHandCursor)) self.labCheckFTP.setText(_fromUtf8("")) self.labCheckFTP.setPixmap(QtGui.QPixmap( _fromUtf8(":/images/ftp.png"))) self.labCheckFTP.setScaledContents(True) self.labCheckFTP.setObjectName(_fromUtf8("labCheckFTP")) self.groupBox_3 = QtGui.QGroupBox(Settings) self.groupBox_3.setGeometry(QtCore.QRect(480, 204, 451, 91)) self.groupBox_3.setTitle(_fromUtf8("")) self.groupBox_3.setObjectName(_fromUtf8("groupBox_3")) self.textEmail = QtGui.QLineEdit(self.groupBox_3) self.textEmail.setGeometry(QtCore.QRect(12, 9, 291, 31)) self.textEmail.setObjectName(_fromUtf8("textEmail")) self.label_12 = QtGui.QLabel(self.groupBox_3) self.label_12.setGeometry(QtCore.QRect(310, 9, 121, 31)) self.label_12.setObjectName(_fromUtf8("label_12")) self.label_13 = QtGui.QLabel(self.groupBox_3) self.label_13.setGeometry(QtCore.QRect(313, 49, 91, 31)) self.label_13.setObjectName(_fromUtf8("label_13")) self.textPassEmail = QtGui.QLineEdit(self.groupBox_3) self.textPassEmail.setGeometry(QtCore.QRect(11, 50, 291, 31)) self.textPassEmail.setObjectName(_fromUtf8("textPassEmail")) self.groupBox_4 = QtGui.QGroupBox(Settings) self.groupBox_4.setGeometry(QtCore.QRect(10, 170, 451, 91)) self.groupBox_4.setTitle(_fromUtf8("")) self.groupBox_4.setObjectName(_fromUtf8("groupBox_4")) self.label_14 = QtGui.QLabel(self.groupBox_4) self.label_14.setGeometry(QtCore.QRect(360, 9, 71, 31)) self.label_14.setObjectName(_fromUtf8("label_14")) self.label_15 = QtGui.QLabel(self.groupBox_4) self.label_15.setGeometry(QtCore.QRect(360, 49, 61, 31)) self.label_15.setObjectName(_fromUtf8("label_15")) self.comBoxCategory = QtGui.QComboBox(self.groupBox_4) self.comBoxCategory.setGeometry(QtCore.QRect(10, 10, 341, 31)) self.comBoxCategory.setObjectName(_fromUtf8("comBoxCategory")) self.ComBoxTheme = QtGui.QComboBox(self.groupBox_4) self.ComBoxTheme.setGeometry(QtCore.QRect(10, 50, 341, 31)) self.ComBoxTheme.setObjectName(_fromUtf8("ComBoxTheme")) self.ComBoxTheme.addItem(_fromUtf8("")) self.ComBoxTheme.addItem(_fromUtf8("")) self.btnSave = QtGui.QPushButton(Settings) self.btnSave.setGeometry(QtCore.QRect(130, 270, 121, 41)) self.btnSave.setObjectName(_fromUtf8("btnSave")) self.labRunServer = QtGui.QLabel(Settings) self.labRunServer.setGeometry(QtCore.QRect(400, 270, 61, 41)) self.labRunServer.setCursor(QtGui.QCursor(QtCore.Qt.OpenHandCursor)) self.labRunServer.setText(_fromUtf8("")) self.labRunServer.setPixmap( QtGui.QPixmap(_fromUtf8(":/images/runServer.png"))) self.labRunServer.setScaledContents(True) self.labRunServer.setObjectName(_fromUtf8("labRunServer")) self.groupBox_5 = QtGui.QGroupBox(Settings) self.groupBox_5.setGeometry(QtCore.QRect(480, 301, 451, 91)) self.groupBox_5.setTitle(_fromUtf8("")) self.groupBox_5.setObjectName(_fromUtf8("groupBox_5")) self.textUsername = QtGui.QLineEdit(self.groupBox_5) self.textUsername.setGeometry(QtCore.QRect(12, 9, 291, 31)) self.textUsername.setPlaceholderText(_fromUtf8("")) self.textUsername.setObjectName(_fromUtf8("textUsername")) self.label_16 = QtGui.QLabel(self.groupBox_5) self.label_16.setGeometry(QtCore.QRect(310, 9, 121, 31)) self.label_16.setObjectName(_fromUtf8("label_16")) self.label_17 = QtGui.QLabel(self.groupBox_5) self.label_17.setGeometry(QtCore.QRect(313, 49, 91, 31)) self.label_17.setObjectName(_fromUtf8("label_17")) self.textPassword = QtGui.QLineEdit(self.groupBox_5) self.textPassword.setGeometry(QtCore.QRect(11, 50, 291, 31)) self.textPassword.setObjectName(_fromUtf8("textPassword")) self.retranslateUi(Settings) QtCore.QMetaObject.connectSlotsByName(Settings)
def selectTimeMinuteCallback(self): self.currentPopupType = AlarmPopupType.MINUTE self.emit(QtCore.SIGNAL('showPopup'), self, "Select Minute", "numberSelect", 2)
def selectTimeHourCallback(self): self.currentPopupType = AlarmPopupType.HOUR self.emit(QtCore.SIGNAL('showPopup'), self, "Select Hour", "numberSelect", 2)
def demo_queries(self): ''' return a list of queries to populate a demo database ''' ## practitioner 1 self.record.setValue('title', "Dr.") self.record.setValue('last_name', "McCavity") self.record.setValue('first_name', "Phil") self.record.setValue('full_name', "Dr. McCavity") self.record.setValue('abbrv_name', "PM") self.record.setValue('sex', "M") self.record.setValue('role', "dentist") self.record.setValue('dob', QtCore.QDate(1969, 12, 9)) self.record.setValue('qualifications', "BDS, LDS") self.record.setValue('status', "active") self.record.setValue('modified_by', "demo_installer") self.record.setValue('avatar_id', 1) yield self.record.insert_query self.record.clearValues() ## practitioner 2 self.record.setValue('title', "Mr.") self.record.setValue('last_name', "AllOut") self.record.setValue('first_name', "Rippem") self.record.setValue('full_name', "Mr Rippem AllOut") self.record.setValue('abbrv_name', "RA") self.record.setValue('sex', "M") self.record.setValue('role', "dentist") self.record.setValue('dob', QtCore.QDate(1988, 11, 10)) self.record.setValue('qualifications', "BDS") self.record.setValue('status', "active") self.record.setValue('modified_by', "demo_installer") self.record.setValue('avatar_id', 2) yield self.record.insert_query self.record.clearValues() ## practitioner 3 self.record.setValue('title', "Miss") self.record.setValue('last_name', "Straight") self.record.setValue('first_name', "Muzby") self.record.setValue('full_name', "Miss Muzby Straight") self.record.setValue('abbrv_name', "MS") self.record.setValue('role', "dentist") self.record.setValue('sex', "F") self.record.setValue('dob', QtCore.QDate(1990, 3, 10)) self.record.setValue('qualifications', "BDS, DipOrth") self.record.setValue('status', "active") self.record.setValue('modified_by', "demo_installer") self.record.setValue('avatar_id', 3) yield self.record.insert_query self.record.clearValues() ## practitioner 4 self.record.setValue('title', "Miss") self.record.setValue('last_name', "Clean") self.record.setValue('first_name', "Crystal") self.record.setValue('full_name', "Miss Clean") self.record.setValue('abbrv_name', "CC") self.record.setValue('sex', "F") self.record.setValue('role', "hygienist") self.record.setValue('dob', QtCore.QDate(1992, 12, 9)) self.record.setValue('qualifications', "MRCH") self.record.setValue('status', "active") self.record.setValue('modified_by', "demo_installer") self.record.setValue('avatar_id', 4) yield self.record.insert_query ## practitioner 1 self.record.clearValues() self.record.setValue('title', "Miss") self.record.setValue('last_name', "Smith") self.record.setValue('first_name', "Jane") self.record.setValue('abbrv_name', "JS") self.record.setValue('sex', "F") self.record.setValue('dob', QtCore.QDate(1969, 12, 9)) self.record.setValue('qualifications', "") self.record.setValue('role', "receptionist") self.record.setValue('status', "active") self.record.setValue('modified_by', "demo_installer") self.record.setValue('avatar_id', 6) yield self.record.insert_query self.record.clearValues() self.record.setValue('title', "Miss") self.record.setValue('last_name', "Jones") self.record.setValue('first_name', "Emma") self.record.setValue('abbrv_name', "EJ") self.record.setValue('sex', "F") self.record.setValue('dob', QtCore.QDate(1969, 12, 9)) self.record.setValue('qualifications', "") self.record.setValue('role', "nurse") self.record.setValue('status', "active") self.record.setValue('modified_by', "demo_installer") self.record.setValue('avatar_id', 8) yield self.record.insert_query self.record.clearValues() self.record.setValue('title', "Mr") self.record.setValue('last_name', "Baipusi") self.record.setValue('first_name', "Mawimba") self.record.setValue('abbrv_name', "MB") self.record.setValue('sex', "M") self.record.setValue('dob', QtCore.QDate(1969, 12, 9)) self.record.setValue('qualifications', "") self.record.setValue('role', "nurse") self.record.setValue('status', "active") self.record.setValue('modified_by', "demo_installer") self.record.setValue('avatar_id', 5) yield self.record.insert_query self.record.clearValues() self.record.setValue('title', "Mr") self.record.setValue('last_name', "Andrews") self.record.setValue('first_name', "Jim") self.record.setValue('abbrv_name', "JA") self.record.setValue('sex', "M") self.record.setValue('dob', QtCore.QDate(1969, 12, 9)) self.record.setValue('qualifications', "") self.record.setValue('role', "nurse") self.record.setValue('status', "active") self.record.setValue('modified_by', "demo_installer") self.record.setValue('avatar_id', 9) yield self.record.insert_query self.record.clearValues() self.record.setValue('title', "Mrs") self.record.setValue('last_name', "Smart") self.record.setValue('first_name', "Julie") self.record.setValue('abbrv_name', "Jules") self.record.setValue('sex', "F") self.record.setValue('dob', QtCore.QDate(1969, 12, 9)) self.record.setValue('qualifications', "") self.record.setValue('role', "nurse") self.record.setValue('status', "active") self.record.setValue('modified_by', "demo_installer") self.record.setValue('avatar_id', 7) yield self.record.insert_query
def setupUi(self, Dialog): Dialog.setObjectName(_fromUtf8("Dialog")) Dialog.resize(1355, 696) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(Dialog.sizePolicy().hasHeightForWidth()) Dialog.setSizePolicy(sizePolicy) Dialog.setFocusPolicy(QtCore.Qt.StrongFocus) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/icon/Project/HeadlineMining Gitlab/images/icon.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) Dialog.setWindowIcon(icon) Dialog.setAutoFillBackground(False) Dialog.setStyleSheet(_fromUtf8("background-image: url(:/bavkground/images/woodback.jpg);")) # Graph pg.setConfigOption('background', 'w') pg.setConfigOption('foreground', 'k') pg.setConfigOption('leftButtonPan', False) self.Graph = PlotWidget(Dialog) self.Graph.setGeometry(QtCore.QRect(670, 30, 651, 321)) self.Graph.setObjectName(_fromUtf8("Graph")) makeGraph(self.Graph) # Graph Label self.GraphLabel = QtGui.QLabel(Dialog) self.GraphLabel.setGeometry(QtCore.QRect(670, 1, 651, 28)) self.GraphLabel.setAutoFillBackground(False) self.GraphLabel.setStyleSheet(_fromUtf8("background:transparent;")) self.GraphLabel.setFrameShadow(QtGui.QFrame.Plain) self.GraphLabel.setText(_fromUtf8( "<html><head/><body><p align=\"center\"><span style=\" font-size:12pt; font-weight:600; color:#fff2af;\"><u>Opinion Graph Of Headlines</u></span></p></body></html>")) self.GraphLabel.setTextFormat(QtCore.Qt.RichText) self.GraphLabel.setAlignment(QtCore.Qt.AlignCenter) self.GraphLabel.setWordWrap(True) self.GraphLabel.setTextInteractionFlags(QtCore.Qt.NoTextInteraction) self.GraphLabel.setObjectName(_fromUtf8("GraphLabel")) # wordCloud self.wordCloud = pic = QtGui.QLabel(Dialog) self.wordCloud.setGeometry(QtCore.QRect(40, 30, 560, 321)) self.wordCloud.setObjectName(_fromUtf8("wordCloud")) drawWordCloud() self.wordCloud.setPixmap(QtGui.QPixmap("./data/wc.png")) # self.wordCloud.setPixmap(QtGui.QPixmap("../data/wc.png")) #testing # WordCloud Label self.WordCloudLabel = QtGui.QLabel(Dialog) self.WordCloudLabel.setGeometry(QtCore.QRect(40, 1, 560, 28)) self.WordCloudLabel.setAutoFillBackground(False) self.WordCloudLabel.setStyleSheet(_fromUtf8("background:transparent;")) self.WordCloudLabel.setFrameShadow(QtGui.QFrame.Plain) self.WordCloudLabel.setText(_fromUtf8( "<html><head/><body><p align=\"center\"><span style=\" font-size:12pt; font-weight:600; color:#fff2af;\">\ <u>Hot Topics Based On Usage Frequency In Headlines</u></span></p></body></html>")) self.WordCloudLabel.setTextFormat(QtCore.Qt.RichText) self.WordCloudLabel.setAlignment(QtCore.Qt.AlignCenter) self.WordCloudLabel.setWordWrap(True) self.WordCloudLabel.setTextInteractionFlags(QtCore.Qt.NoTextInteraction) self.WordCloudLabel.setObjectName(_fromUtf8("WordCloudLabel")) # Calender self.calendarWidget = QtGui.QCalendarWidget(Dialog) self.calendarWidget.setGeometry(QtCore.QRect(830, 430, 361, 251)) self.calendarWidget.setMinimumDate(QtCore.QDate(2017, 1, 2)) self.calendarWidget.setMaximumDate(QtCore.QDate(2017, 12, 31)) self.calendarWidget.setObjectName(_fromUtf8("calendarWidget")) self.calendarWidget.clicked.connect(self.dateSelected) # Calender Label self.CalenderLabel = QtGui.QLabel(Dialog) self.CalenderLabel.setGeometry(QtCore.QRect(760, 370, 491, 51)) self.CalenderLabel.setAutoFillBackground(False) self.CalenderLabel.setStyleSheet(_fromUtf8("background:transparent;")) self.CalenderLabel.setFrameShadow(QtGui.QFrame.Plain) self.CalenderLabel.setText(_fromUtf8( "<html><head/><body><p align=\"center\"><span style=\" font-size:12pt; font-weight:600; color:#fff2af;\"><u>Select a date from calender below to change day</u></span></p></body></html>")) self.CalenderLabel.setTextFormat(QtCore.Qt.RichText) self.CalenderLabel.setAlignment(QtCore.Qt.AlignCenter) self.CalenderLabel.setWordWrap(True) self.CalenderLabel.setTextInteractionFlags(QtCore.Qt.NoTextInteraction) self.CalenderLabel.setObjectName(_fromUtf8("CalenderLabel")) # Nextbutton self.pushButton = QtGui.QPushButton(Dialog) self.pushButton.setGeometry(QtCore.QRect(670, 490, 81, 81)) self.pushButton.setStyleSheet(_fromUtf8("background-image: url(:/labelBackground/images/nextButton.png);\n" "border:none;")) self.pushButton.setAutoDefault(True) self.pushButton.isCheckable() self.pushButton.setDefault(False) self.pushButton.setFlat(False) self.pushButton.setObjectName(_fromUtf8("pushButton")) self.pushButton.clicked.connect(self.nextFourHeadlines) # WeeklyButton self.weekButton = QtGui.QPushButton(Dialog) self.weekButton.setGeometry(QtCore.QRect(1210, 490, 130, 81)) self.weekButton.setStyleSheet(_fromUtf8("color:white; font-size:14pt; font-weight:600; background:grey; \ font-family:'Lucida Calligraphy';border-style: outset;\ border-width: 2px;border-radius: 15px;border-color: black;\ padding: 4px;")) self.weekButton.setAutoDefault(True) self.weekButton.isCheckable() self.weekButton.setText("One Week \nAnalysis") self.weekButton.setObjectName(_fromUtf8("weekButton")) self.weekButton.clicked.connect(self.oneWeekAnalysis) # Calculate accuracy button self.accuracyButton = QtGui.QPushButton(Dialog) self.accuracyButton.setGeometry(QtCore.QRect(1210, 591, 130, 81)) self.accuracyButton.setStyleSheet(_fromUtf8("color:white; font-size:14pt; font-weight:600; background:grey; \ font-family:'Lucida Calligraphy';border-style: outset;\ border-width: 2px;border-radius: 15px;border-color: black;\ padding: 4px;")) self.accuracyButton.setAutoDefault(True) self.accuracyButton.isCheckable() self.accuracyButton.setText("Calculate \n Accuracy ") self.accuracyButton.setObjectName(_fromUtf8("accuracyButton")) self.accuracyButton.clicked.connect(self.calcuateAccuracy) # Accuracy instruction label self.accuracyLabel = QtGui.QLabel(Dialog) self.accuracyLabel.setGeometry(QtCore.QRect(30, 370, 521, 28)) self.accuracyLabel.setAutoFillBackground(False) self.accuracyLabel.setStyleSheet(_fromUtf8("background:transparent;")) self.accuracyLabel.setFrameShadow(QtGui.QFrame.Plain) self.accuracyLabel.setText(_fromUtf8( "<html><head/><body><p align=\"center\"><span style=\" font-size:12pt; font-weight:600; color: #20ee94;\">\ <u>Cycle through all headlines and select incorrect scores</u></span></p></body></html>")) self.accuracyLabel.setTextFormat(QtCore.Qt.RichText) self.accuracyLabel.setAlignment(QtCore.Qt.AlignCenter) self.accuracyLabel.setWordWrap(True) self.accuracyLabel.setTextInteractionFlags(QtCore.Qt.NoTextInteraction) self.accuracyLabel.setObjectName(_fromUtf8("accuracyLabel")) self.accuracyLabel.hide() # AccuracyResult Label self.accuracyResultLabel = QtGui.QLabel(Dialog) self.accuracyResultLabel.setGeometry(QtCore.QRect(645, 591, 150, 100)) # 670, 490, 81, 81 self.accuracyResultLabel.setAutoFillBackground(False) self.accuracyResultLabel.setStyleSheet(_fromUtf8("background:transparent;")) self.accuracyResultLabel.setFrameShadow(QtGui.QFrame.Plain) self.accuracyResultLabel.setTextFormat(QtCore.Qt.RichText) self.accuracyResultLabel.setAlignment(QtCore.Qt.AlignCenter) self.accuracyResultLabel.setWordWrap(True) self.accuracyResultLabel.setTextInteractionFlags(QtCore.Qt.NoTextInteraction) self.accuracyResultLabel.setObjectName(_fromUtf8("accuracyResultLabel")) self.accuracyResultLabel.hide() # checkboxes self.checkBox1 = QtGui.QCheckBox(Dialog) self.checkBox1.setGeometry(QtCore.QRect(15, 408, 16, 17)) self.checkBox1.setText(_fromUtf8("")) self.checkBox1.setObjectName(_fromUtf8("checkBox1")) self.checkBox1.hide() self.checkBox2 = QtGui.QCheckBox(Dialog) self.checkBox2.setGeometry(QtCore.QRect(15, 488, 16, 17)) self.checkBox2.setText(_fromUtf8("")) self.checkBox2.setObjectName(_fromUtf8("checkBox2")) self.checkBox2.hide() self.checkBox3 = QtGui.QCheckBox(Dialog) self.checkBox3.setGeometry(QtCore.QRect(15, 568, 16, 17)) self.checkBox3.setText(_fromUtf8("")) self.checkBox3.setObjectName(_fromUtf8("checkBox3")) self.checkBox3.hide() self.checkBox4 = QtGui.QCheckBox(Dialog) self.checkBox4.setGeometry(QtCore.QRect(15, 648, 16, 17)) self.checkBox4.setText(_fromUtf8("")) self.checkBox4.setObjectName(_fromUtf8("checkBox4")) self.checkBox4.hide() # Headline labels self.Headline1 = QtGui.QLabel(Dialog) self.Headline1.setGeometry(QtCore.QRect(40, 392, 521, 51)) self.Headline1.setStyleSheet(_fromUtf8("background:transparent;")) self.Headline1.setTextFormat(QtCore.Qt.RichText) self.Headline1.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignCenter | QtCore.Qt.AlignHCenter) self.Headline1.setWordWrap(True) self.Headline1.setTextInteractionFlags(QtCore.Qt.NoTextInteraction) self.Headline1.setObjectName(_fromUtf8("Headline1")) self.Headline2 = QtGui.QLabel(Dialog) self.Headline2.setGeometry(QtCore.QRect(40, 472, 521, 51)) self.Headline2.setStyleSheet(_fromUtf8("background:transparent;")) self.Headline2.setTextFormat(QtCore.Qt.RichText) self.Headline2.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignCenter | QtCore.Qt.AlignHCenter) self.Headline2.setWordWrap(True) self.Headline2.setTextInteractionFlags(QtCore.Qt.NoTextInteraction) self.Headline2.setObjectName(_fromUtf8("Headline2")) self.Headline3 = QtGui.QLabel(Dialog) self.Headline3.setGeometry(QtCore.QRect(40, 552, 521, 51)) self.Headline3.setStyleSheet(_fromUtf8("background:transparent;")) self.Headline3.setTextFormat(QtCore.Qt.RichText) self.Headline3.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignCenter | QtCore.Qt.AlignHCenter) self.Headline3.setWordWrap(True) self.Headline3.setTextInteractionFlags(QtCore.Qt.NoTextInteraction) self.Headline3.setObjectName(_fromUtf8("Headline3")) self.Headline4 = QtGui.QLabel(Dialog) self.Headline4.setGeometry(QtCore.QRect(40, 632, 521, 51)) self.Headline4.setStyleSheet(_fromUtf8("background:transparent;")) self.Headline4.setTextFormat(QtCore.Qt.RichText) self.Headline4.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignCenter | QtCore.Qt.AlignHCenter) self.Headline4.setWordWrap(True) self.Headline4.setTextInteractionFlags(QtCore.Qt.NoTextInteraction) self.Headline4.setObjectName(_fromUtf8("Headline4")) # Score Labels self.Value4 = QtGui.QLabel(Dialog) self.Value4.setGeometry(QtCore.QRect(580, 632, 71, 51)) self.Value4.setStyleSheet(_fromUtf8("background:transparent;")) self.Value4.setTextFormat(QtCore.Qt.RichText) self.Value4.setAlignment(QtCore.Qt.AlignCenter | QtCore.Qt.AlignLeft) self.Value4.setTextInteractionFlags(QtCore.Qt.NoTextInteraction) self.Value4.setObjectName(_fromUtf8("Value4")) self.Value3 = QtGui.QLabel(Dialog) self.Value3.setGeometry(QtCore.QRect(580, 552, 71, 51)) self.Value3.setStyleSheet(_fromUtf8("background:transparent;")) self.Value3.setTextFormat(QtCore.Qt.RichText) self.Value3.setAlignment(QtCore.Qt.AlignCenter | QtCore.Qt.AlignLeft) self.Value3.setTextInteractionFlags(QtCore.Qt.NoTextInteraction) self.Value3.setObjectName(_fromUtf8("Value3")) self.Value2 = QtGui.QLabel(Dialog) self.Value2.setGeometry(QtCore.QRect(580, 472, 71, 51)) self.Value2.setStyleSheet(_fromUtf8("background:transparent;")) self.Value2.setTextFormat(QtCore.Qt.RichText) self.Value2.setAlignment(QtCore.Qt.AlignCenter | QtCore.Qt.AlignLeft) self.Value2.setTextInteractionFlags(QtCore.Qt.NoTextInteraction) self.Value2.setObjectName(_fromUtf8("Value2")) self.Value1 = QtGui.QLabel(Dialog) self.Value1.setGeometry(QtCore.QRect(580, 392, 71, 51)) self.Value1.setStyleSheet(_fromUtf8("background:transparent;")) self.Value1.setTextFormat(QtCore.Qt.RichText) self.Value1.setAlignment(QtCore.Qt.AlignCenter | QtCore.Qt.AlignLeft) self.Value1.setTextInteractionFlags(QtCore.Qt.NoTextInteraction) self.Value1.setObjectName(_fromUtf8("Value1")) self.retranslateUi(Dialog) QtCore.QMetaObject.connectSlotsByName(Dialog)
def qInitResources(): QtCore.qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
class Manager(QtCore.QObject): ''' classdocs ''' proxyUpdated = QtCore.pyqtSignal(object) clientUpdated = QtCore.pyqtSignal(object, object) engineNotFound = QtCore.pyqtSignal(object) newEngine = QtCore.pyqtSignal(object) dropEngine = QtCore.pyqtSignal(object) initEngine = QtCore.pyqtSignal(object) aboutToStart = QtCore.pyqtSignal(object) started = QtCore.pyqtSignal() stopped = QtCore.pyqtSignal() suspended = QtCore.pyqtSignal() resumed = QtCore.pyqtSignal() _singleton = None @staticmethod def get(): return Manager._singleton def __init__(self, options): ''' Constructor ''' if Manager._singleton is not None: raise Exception("Only one instance of Manager can be create") Manager._singleton = self super(Manager, self).__init__() # Let's bypass HTTPS verification unless --consider-ssl-errors is passed # since many servers unfortunately have invalid certificates. # See https://www.python.org/dev/peps/pep-0476/ # and https://jira.nuxeo.com/browse/NXDRIVE-506 if not options.consider_ssl_errors: log.warn("--consider-ssl-errors option is False, won't verify HTTPS certificates") import ssl try: _create_unverified_https_context = ssl._create_unverified_context except AttributeError: log.info("Legacy Python that doesn't verify HTTPS certificates by default") else: log.info("Handle target environment that doesn't support HTTPS verification:" " globally disable verification by monkeypatching the ssl module though highly discouraged") ssl._create_default_https_context = _create_unverified_https_context else: log.info("--consider-ssl-errors option is True, will verify HTTPS certificates") self._autolock_service = None self.nxdrive_home = os.path.expanduser(options.nxdrive_home) self.nxdrive_home = os.path.realpath(self.nxdrive_home) if not os.path.exists(self.nxdrive_home): os.mkdir(self.nxdrive_home) self.remote_watcher_delay = options.delay self._nofscheck = options.nofscheck self._debug = options.debug self._engine_definitions = None self._engine_types = dict() from nxdrive.engine.next.engine_next import EngineNext from nxdrive.engine.engine import Engine self._engine_types["NXDRIVE"] = Engine self._engine_types["NXDRIVENEXT"] = EngineNext self._engines = None self.proxies = None self.proxy_exceptions = None self._app_updater = None self._dao = None self._create_dao() if options.proxy_server is not None: proxy = ProxySettings() proxy.from_url(options.proxy_server) proxy.save(self._dao) # Now we can update the logger if needed if options.log_level_file is not None: # Set the log_level_file option handler = self._get_file_log_handler() if handler is not None: handler.setLevel(options.log_level_file) # Store it in the database self._dao.update_config("log_level_file", str(handler.level)) else: # No log_level provide, use the one from db default is INFO self._update_logger(int(self._dao.get_config("log_level_file", "20"))) # Add auto lock on edit res = self._dao.get_config("direct_edit_auto_lock") if res is None: self._dao.update_config("direct_edit_auto_lock", "1") # Persist update URL infos self._dao.update_config("update_url", options.update_site_url) self._dao.update_config("beta_update_url", options.beta_update_site_url) self.refresh_proxies() self._os = AbstractOSIntegration.get(self) # Create DirectEdit self._create_autolock_service() self._create_direct_edit(options.protocol_url) # Create notification service self._script_engine = None self._script_object = None self._create_notification_service() self._started = False # Pause if in debug self._pause = self.is_debug() self.device_id = self._dao.get_config("device_id") self.updated = False # self.update_version() if self.device_id is None: self.generate_device_id() self.load() # Create the application update verification thread self._create_updater(options.update_check_delay) # Force language if options.force_locale is not None: self.set_config("locale", options.force_locale) # Setup analytics tracker self._tracker = None if self.get_tracking(): self._create_tracker() def _get_file_log_handler(self): # Might store it in global static return FILE_HANDLER def get_metrics(self): result = dict() result["version"] = self.get_version() result["auto_start"] = self.get_auto_start() result["auto_update"] = self.get_auto_update() result["beta_channel"] = self.get_beta_channel() result["device_id"] = self.get_device_id() result["tracker_id"] = self.get_tracker_id() result["tracking"] = self.get_tracking() result["qt_version"] = QtCore.QT_VERSION_STR result["pyqt_version"] = QtCore.PYQT_VERSION_STR result["python_version"] = platform.python_version() result["platform"] = platform.system() result["appname"] = self.get_appname() return result def open_help(self): self.open_local_file("http://doc.nuxeo.com/display/USERDOC/Nuxeo+Drive") def get_log_level(self): handler = self._get_file_log_handler() if handler: return handler.level return logging.getLogger().getEffectiveLevel() def set_log_level(self, log_level): self._dao.update_config("log_level_file", str(log_level)) self._update_logger(log_level) def _update_logger(self, log_level): logging.getLogger().setLevel( min(log_level, logging.getLogger().getEffectiveLevel())) handler = self._get_file_log_handler() if handler: handler.setLevel(log_level) def get_osi(self): return self._os def _handle_os(self): # Be sure to register os self._os.register_contextual_menu() self._os.register_protocol_handlers() if self.get_auto_start(): self._os.register_startup() def get_appname(self): return "Nuxeo Drive" def is_debug(self): return self._debug def is_checkfs(self): return not self._nofscheck def get_device_id(self): return self.device_id def get_notification_service(self): return self._notification_service def _create_notification_service(self): # Dont use it for now from nxdrive.notification import DefaultNotificationService self._notification_service = DefaultNotificationService(self) return self._notification_service def get_autolock_service(self): return self._autolock_service def _create_autolock_service(self): from nxdrive.autolocker import ProcessAutoLockerWorker self._autolock_service = ProcessAutoLockerWorker(30, self) self.started.connect(self._autolock_service._thread.start) return self._autolock_service def _create_tracker(self): from nxdrive.engine.tracker import Tracker self._tracker = Tracker(self) # Start the tracker when we launch self.started.connect(self._tracker._thread.start) return self._tracker def get_tracker_id(self): if self.get_tracking() and self._tracker is not None: return self._tracker.uid return "" def get_tracker(self): return self._tracker def _get_db(self): return os.path.join(normalized_path(self.nxdrive_home), "manager.db") def get_dao(self): return self._dao def _migrate(self): from nxdrive.engine.dao.sqlite import ManagerDAO self._dao = ManagerDAO(self._get_db()) old_db = os.path.join(normalized_path(self.nxdrive_home), "nxdrive.db") if os.path.exists(old_db): import sqlite3 from nxdrive.engine.dao.sqlite import CustomRow conn = sqlite3.connect(old_db) conn.row_factory = CustomRow c = conn.cursor() cfg = c.execute("SELECT * FROM device_config LIMIT 1").fetchone() if cfg is not None: self.device_id = cfg.device_id self._dao.update_config("device_id", cfg.device_id) self._dao.update_config("proxy_config", cfg.proxy_config) self._dao.update_config("proxy_type", cfg.proxy_type) self._dao.update_config("proxy_server", cfg.proxy_server) self._dao.update_config("proxy_port", cfg.proxy_port) self._dao.update_config("proxy_authenticated", cfg.proxy_authenticated) self._dao.update_config("proxy_username", cfg.proxy_username) self._dao.update_config("auto_update", cfg.auto_update) # Copy first server binding rows = c.execute("SELECT * FROM server_bindings").fetchall() if not rows: return first_row = True for row in rows: row.url = row.server_url log.debug("Binding server from Nuxeo Drive V1: [%s, %s]", row.url, row.remote_user) row.username = row.remote_user row.password = None row.token = row.remote_token row.no_fscheck = True engine = self.bind_engine(self._get_default_server_type(), row["local_folder"], self._get_engine_name(row.url), row, starts=False) log.trace("Resulting server binding remote_token %r", row.remote_token) if first_row: first_engine_def = row first_engine = engine first_row = False else: engine.dispose_db() # Copy filters for first engine as V1 only supports filtering for the first server binding filters = c.execute("SELECT * FROM filters") for filter_obj in filters: if first_engine_def.local_folder != filter_obj.local_folder: continue log.trace("Filter Row from DS1 %r", filter_obj) first_engine.add_filter(filter_obj["path"]) first_engine.dispose_db() def _create_dao(self): from nxdrive.engine.dao.sqlite import ManagerDAO if not os.path.exists(self._get_db()): try: self._migrate() return except Exception as e: log.error(e, exc_info=True) self._dao = ManagerDAO(self._get_db()) def _create_updater(self, update_check_delay): if (update_check_delay == 0): log.info("Update check delay is 0, disabling autoupdate") self._app_updater = FakeUpdater() return self._app_updater # Enable the capacity to extend the AppUpdater self._app_updater = AppUpdater(self, version_finder=self.get_version_finder(), check_interval=update_check_delay) self.started.connect(self._app_updater._thread.start) return self._app_updater def get_version_finder(self, refresh_engines=False): # Used by extended application to inject version finder if self.get_beta_channel(): log.debug('Update beta channel activated') update_site_url = self._get_beta_update_url(refresh_engines) else: update_site_url = self._get_update_url(refresh_engines) if update_site_url is None: update_site_url = DEFAULT_UPDATE_SITE_URL if not update_site_url.endswith('/'): update_site_url += '/' return update_site_url def _get_update_url(self, refresh_engines): update_url = self._dao.get_config("update_url", DEFAULT_UPDATE_SITE_URL) # If update site URL is not overridden in config.ini nor through the command line, refresh engine update infos # and use first engine configuration if update_url == DEFAULT_UPDATE_SITE_URL: try: if refresh_engines: self._refresh_engine_update_infos() engines = self.get_engines() if engines: first_engine = engines.itervalues().next() update_url = first_engine.get_update_url() log.debug('Update site URL has not been overridden in config.ini nor through the command line,' ' using configuration from first engine [%s]: %s', first_engine._name, update_url) except URLError as e: log.error('Cannot refresh engine update infos, using default update site URL', exc_info=True) return update_url def _get_beta_update_url(self, refresh_engines): beta_update_url = self._dao.get_config("beta_update_url") if beta_update_url is None: try: if refresh_engines: self._refresh_engine_update_infos() engines = self.get_engines() if engines: for engine in engines.itervalues(): beta_update_url = engine.get_beta_update_url() if beta_update_url is not None: log.debug('Beta update site URL has not been defined in config.ini nor through the command' ' line, using configuration from engine [%s]: %s', engine._name, beta_update_url) return beta_update_url except URLError: log.exception('Cannot refresh engine update infos, not using beta update site URL') return beta_update_url def is_beta_channel_available(self): return self._get_beta_update_url(False) is not None def get_updater(self): return self._app_updater def refresh_update_status(self): if self.get_updater() is not None: self.get_updater().refresh_status() def _refresh_engine_update_infos(self): log.debug('Refreshing engine infos') engines = self.get_engines() if engines: for engine in engines.itervalues(): engine.get_update_infos() def _create_direct_edit(self, url): from nxdrive.direct_edit import DirectEdit self._direct_edit = DirectEdit(self, os.path.join(normalized_path(self.nxdrive_home), "edit"), url) self.started.connect(self._direct_edit._thread.start) return self._direct_edit def get_direct_edit(self): return self._direct_edit def is_paused(self): return self._pause def resume(self, euid=None): if not self._pause: return self._pause = False for uid, engine in self._engines.items(): if euid is not None and euid != uid: continue log.debug("Resume engine %s", uid) engine.resume() self.resumed.emit() def suspend(self, euid=None): if self._pause: return self._pause = True for uid, engine in self._engines.items(): if euid is not None and euid != uid: continue log.debug("Suspend engine %s", uid) engine.suspend() self.suspended.emit() def stop(self, euid=None): for uid, engine in self._engines.items(): if euid is not None and euid != uid: continue if engine.is_started(): log.debug("Stop engine %s", uid) engine.stop() self.stopped.emit() def start(self, euid=None): self._started = True for uid, engine in self._engines.items(): if euid is not None and euid != uid: continue if not self._pause: self.aboutToStart.emit(engine) log.debug("Launch engine %s", uid) try: engine.start() except Exception as e: log.debug("Could not start the engine: %s [%r]", uid, e) log.debug("Emitting started") # Check only if manager is started self._handle_os() self.started.emit() def load(self): if self._engine_definitions is None: self._engine_definitions = self._dao.get_engines() in_error = dict() self._engines = dict() for engine in self._engine_definitions: if not engine.engine in self._engine_types: log.warn("Can't find engine %s anymore", engine.engine) if not engine.engine in in_error: in_error[engine.engine] = True self.engineNotFound.emit(engine) self._engines[engine.uid] = self._engine_types[engine.engine](self, engine, remote_watcher_delay=self.remote_watcher_delay) self._engines[engine.uid].online.connect(self._force_autoupdate) self.initEngine.emit(self._engines[engine.uid]) def _get_default_nuxeo_drive_name(self): return 'Nuxeo Drive' def _force_autoupdate(self): if (self._app_updater.get_next_poll() > 60 and self._app_updater.get_last_poll() > 1800): self._app_updater.force_poll() def get_default_nuxeo_drive_folder(self): # TODO: Factorize with utils.default_nuxeo_drive_folder """Find a reasonable location for the root Nuxeo Drive folder This folder is user specific, typically under the home folder. Under Windows, try to locate My Documents as a home folder, using the win32com shell API if allowed, else falling back on a manual detection. Note that we need to decode the path returned by os.path.expanduser with the local encoding because the value of the HOME environment variable is read as a byte string. Using os.path.expanduser(u'~') fails if the home path contains non ASCII characters since Unicode coercion attempts to decode the byte string as an ASCII string. """ if sys.platform == "win32": from win32com.shell import shell, shellcon try: my_documents = shell.SHGetFolderPath(0, shellcon.CSIDL_PERSONAL, None, 0) except: # In some cases (not really sure how this happens) the current user # is not allowed to access its 'My Documents' folder path through # the win32com shell API, which raises the following error: # com_error: (-2147024891, 'Access is denied.', None, None) # We noticed that in this case the 'Location' tab is missing in the # Properties window of 'My Documents' accessed through the # Explorer. # So let's fall back on a manual (and poor) detection. # WARNING: it's important to check 'Documents' first as under # Windows 7 there also exists a 'My Documents' folder invisible in # the Explorer and cmd / powershell but visible from Python. # First try regular location for documents under Windows 7 and up log.debug("Access denied to win32com shell API: SHGetFolderPath," " falling back on manual detection of My Documents") my_documents = os.path.expanduser(r'~\Documents') my_documents = unicode(my_documents.decode(ENCODING)) if not os.path.exists(my_documents): # Compatibility for Windows XP my_documents = os.path.expanduser(r'~\My Documents') my_documents = unicode(my_documents.decode(ENCODING)) if os.path.exists(my_documents): nuxeo_drive_folder = self._increment_local_folder(my_documents, self._get_default_nuxeo_drive_name()) log.debug("Will use '%s' as default Nuxeo Drive folder location under Windows", nuxeo_drive_folder) return nuxeo_drive_folder # Fall back on home folder otherwise user_home = os.path.expanduser('~') user_home = unicode(user_home.decode(ENCODING)) nuxeo_drive_folder = self._increment_local_folder(user_home, self._get_default_nuxeo_drive_name()) log.debug("Will use '%s' as default Nuxeo Drive folder location", nuxeo_drive_folder) return nuxeo_drive_folder def _increment_local_folder(self, basefolder, name): nuxeo_drive_folder = os.path.join(basefolder, name) num = 2 while (not self.check_local_folder_available(nuxeo_drive_folder)): nuxeo_drive_folder = os.path.join(basefolder, name + " " + str(num)) num = num + 1 if num > 10: return "" return nuxeo_drive_folder def get_configuration_folder(self): return self.nxdrive_home def open_local_file(self, file_path): """Launch the local OS program on the given file / folder.""" log.debug('Launching editor on %s', file_path) if sys.platform == 'win32': os.startfile(file_path) elif sys.platform == 'darwin': subprocess.Popen(['open', file_path]) else: try: subprocess.Popen(['xdg-open', file_path]) except OSError: # xdg-open should be supported by recent Gnome, KDE, Xfce log.error("Failed to find and editor for: '%s'", file_path) def check_version_updated(self): last_version = self._dao.get_config("client_version") if last_version != self.get_version(): self.clientUpdated.emit(last_version, self.get_version()) def generate_device_id(self): self.device_id = uuid.uuid1().hex self._dao.update_config("device_id", self.device_id) def get_proxy_settings(self, device_config=None): """Fetch proxy settings from database""" return ProxySettings(dao=self._dao) def list_server_bindings(self): if self._engines is None: self.load() result = [] for definition in self._engine_definitions: row = definition row.server_version = None row.update_url = "" self._engines[row.uid].complete_binder(row) result.append(row) return result def get_config(self, value, default=None): return self._dao.get_config(value, default) def set_config(self, key, value): return self._dao.update_config(key, value) def get_direct_edit_auto_lock(self): return self._dao.get_config("direct_edit_auto_lock", "1") == "1" def set_direct_edit_auto_lock(self, value): self._dao.update_config("direct_edit_auto_lock", value) def get_auto_update(self): # By default auto update return self._dao.get_config("auto_update", "1") == "1" def set_auto_update(self, value): self._dao.update_config("auto_update", value) def get_auto_start(self): return self._dao.get_config("auto_start", "1") == "1" def _get_binary_name(self): return 'ndrive' def generate_report(self, path=None): from nxdrive.report import Report report = Report(self, path) report.generate() return report.get_path() def find_exe_path(self): """Introspect the Python runtime to find the frozen Windows exe""" import nxdrive nxdrive_path = os.path.realpath(os.path.dirname(nxdrive.__file__)) log.trace("nxdrive_path: %s", nxdrive_path) # Detect frozen win32 executable under Windows executable = sys.executable if "appdata" in executable: executable = os.path.join(os.path.dirname(executable), "..","..",os.path.basename( sys.executable)) exe_path = os.path.abspath(executable) if os.path.exists(exe_path): log.trace("Returning exe path: %s", exe_path) return exe_path # Detect OSX frozen app if nxdrive_path.endswith(OSX_SUFFIX): log.trace("Detected OS X frozen app") exe_path = nxdrive_path.replace(OSX_SUFFIX, "Contents/MacOS/" + self._get_binary_name()) if os.path.exists(exe_path): log.trace("Returning exe path: %s", exe_path) return exe_path # Fall-back to the regular method that should work both the ndrive script exe_path = sys.argv[0] log.trace("Returning default exe path: %s", exe_path) return exe_path def set_auto_start(self, value): self._dao.update_config("auto_start", value) if value: self._os.register_startup() else: self._os.unregister_startup() def get_beta_channel(self): return self._dao.get_config("beta_channel", "0") == "1" def set_beta_channel(self, value): self._dao.update_config("beta_channel", value) # Trigger update status refresh self.refresh_update_status() def get_tracking(self): return self._dao.get_config("tracking", "1") == "1" and not self.get_version().endswith("-dev") def set_tracking(self, value): self._dao.update_config("tracking", value) if value: self._create_tracker() elif self._tracker is not None: self._tracker._thread.quit() self._tracker = None def validate_proxy_settings(self, proxy_settings): try: import urllib2 proxies, _ = get_proxies_for_handler(proxy_settings) # Try google website url = "http://www.google.com" opener = urllib2.build_opener(urllib2.ProxyHandler(proxies), urllib2.HTTPBasicAuthHandler(), urllib2.HTTPHandler) urllib2.install_opener(opener) conn = urllib2.urlopen(url) conn.read() except Exception as e: log.error("Exception setting proxy : %s", e) return False return True def set_proxy_settings(self, proxy_settings, force=False): if force or self.validate_proxy_settings(proxy_settings): proxy_settings.save(self._dao) self.refresh_proxies(proxy_settings) log.info("Proxy settings successfully updated: %r", proxy_settings) return "" else: return "PROXY_INVALID" def refresh_proxies(self, proxy_settings=None, device_config=None): """Refresh current proxies with the given settings""" # If no proxy settings passed fetch them from database proxy_settings = (proxy_settings if proxy_settings is not None else self.get_proxy_settings()) self.proxies, self.proxy_exceptions = get_proxies_for_handler( proxy_settings) self.proxyUpdated.emit(proxy_settings) def get_proxies(self): return self.proxies def get_engine(self, local_folder): if self._engines is None: self.load() for engine_def in self._engine_definitions: if local_folder.startswith(engine_def.local_folder): return self._engines[engine_def.uid] return None def edit(self, engine, remote_ref): """Find the local file if any and start OS editor on it.""" doc_pair = engine.get_dao().get_normal_state_from_remote(remote_ref) if doc_pair is None: log.warning('Could not find local file for engine %s and remote_ref %s', engine.get_uid(), remote_ref) return # TODO: check synchronization of this state first # Find the best editor for the file according to the OS configuration local_client = engine.get_local_client() self.open_local_file(local_client._abspath(doc_pair.local_path)) def _get_default_server_type(self): return "NXDRIVE" def bind_server(self, local_folder, url, username, password, token=None, name=None, start_engine=True, check_credentials=True): from collections import namedtuple if name is None: name = self._get_engine_name(url) binder = namedtuple('binder', ['username', 'password', 'token', 'url', 'no_check', 'no_fscheck']) binder.username = username binder.password = password binder.token = token binder.no_check = not check_credentials binder.no_fscheck = False binder.url = url return self.bind_engine(self._get_default_server_type(), local_folder, name, binder, starts=start_engine) def _get_engine_name(self, server_url): import urlparse urlp = urlparse.urlparse(server_url) return urlp.hostname def check_local_folder_available(self, local_folder): if self._engine_definitions is None: return True if not local_folder.endswith('/'): local_folder = local_folder + '/' for engine in self._engine_definitions: other = engine.local_folder if not other.endswith('/'): other = other + '/' if (other.startswith(local_folder) or local_folder.startswith(other)): return False return True def update_engine_path(self, uid, local_folder): # Dont update the engine by itself, should be only used by engine.update_engine_path if uid in self._engine_definitions: self._engine_definitions[uid].local_folder = local_folder self._dao.update_engine_path(uid, local_folder) def bind_engine(self, engine_type, local_folder, name, binder, starts=True): """Bind a local folder to a remote nuxeo server""" if name is None and hasattr(binder, 'url'): name = self._get_engine_name(binder.url) if hasattr(binder, 'url'): url = binder.url if '#' in url: # Last part of the url is the engine type engine_type = url.split('#')[1] binder.url = url.split('#')[0] log.debug("Engine type has been specified in the url: %s will be used", engine_type) if not self.check_local_folder_available(local_folder): raise FolderAlreadyUsed() if not engine_type in self._engine_types: raise EngineTypeMissing() if self._engines is None: self.load() local_folder = normalized_path(local_folder) if local_folder == self.get_configuration_folder(): # Prevent from binding in the configuration folder raise FolderAlreadyUsed() uid = uuid.uuid1().hex # TODO Check that engine is not inside another or same position engine_def = self._dao.add_engine(engine_type, local_folder, uid, name) try: self._engines[uid] = self._engine_types[engine_type](self, engine_def, binder=binder, remote_watcher_delay=self.remote_watcher_delay) self._engine_definitions.append(engine_def) except Exception as e: log.exception(e) if uid in self._engines: del self._engines[uid] self._dao.delete_engine(uid) # TODO Remove the db ? raise e # As new engine was just bound, refresh application update status self.refresh_update_status() if starts: self._engines[uid].start() self.newEngine.emit(self._engines[uid]) return self._engines[uid] #server_url, username, password # check the connection to the server by issuing an authentication # request def unbind_engine(self, uid): if self._engines is None: self.load() self._engines[uid].suspend() self._engines[uid].unbind() self._dao.delete_engine(uid) # Refresh the engines definition del self._engines[uid] self.dropEngine.emit(uid) self._engine_definitions = self._dao.get_engines() def unbind_all(self): if self._engines is None: self.load() for engine in self._engine_definitions: self.unbind_engine(engine.uid) def dispose_db(self): if self._dao is not None: self._dao.dispose() def dispose_all(self): for engine in self.get_engines().values(): engine.dispose_db() self.dispose_db() def get_engines(self): return self._engines def get_engines_type(self): return self._engine_types def get_version(self): return __version__ def update_version(self, device_config): if self.version != device_config.client_version: log.info("Detected version upgrade: current version = %s," " new version = %s => upgrading current version," " yet DB upgrade might be needed.", device_config.client_version, self.version) device_config.client_version = self.version self.get_session().commit() return True return False def is_started(self): return self._started def is_updated(self): return self.updated def is_syncing(self): syncing_engines = [] for uid, engine in self._engines.items(): if engine.is_syncing(): syncing_engines.append(uid) if syncing_engines: log.debug("Some engines are currently synchronizing: %s", syncing_engines) return True else: log.debug("No engine currently synchronizing") return False def get_root_id(self, file_path): from nxdrive.client import LocalClient ref = LocalClient.get_path_remote_id(file_path, 'ndriveroot') if ref is None: parent = os.path.dirname(file_path) # We can't find in any parent if parent == file_path or parent is None: return None return self.get_root_id(parent) return ref def get_cf_bundle_identifier(self): return "org.nuxeo.drive" def get_metadata_infos(self, file_path): from nxdrive.client import LocalClient remote_ref = LocalClient.get_path_remote_id(file_path) if remote_ref is None: raise ValueError('Could not find file %s as Nuxeo Drive managed' % file_path) root_id = self.get_root_id(file_path) # TODO Add a class to handle root info root_values = root_id.split("|") try: engine = self.get_engines()[root_values[3]] except: raise ValueError('Unknown engine %s for %s' % (root_values[3], file_path)) metadata_url = engine.get_metadata_url(remote_ref) return (metadata_url, engine.get_remote_token(), engine, remote_ref) def set_script_object(self, obj): # Used to enhance scripting with UI self._script_object = obj def _create_script_engine(self): from nxdrive.scripting import DriveScript self._script_engine = QScriptEngine() if self._script_object is None: self._script_object = DriveScript(self) self._script_engine.globalObject().setProperty("drive", self._script_engine.newQObject(self._script_object)) def execute_script(self, script, engine_uid=None): if self._script_engine is None: self._create_script_engine() if self._script_engine is None: return self._script_object.set_engine_uid(engine_uid) log.debug("Will execute '%s'", script) result = self._script_engine.evaluate(script) if self._script_engine.hasUncaughtException(): log.debug("Execution exception: %r", result.toString())
def setupUi(self, ImportDialog): ImportDialog.setObjectName(_fromUtf8("ImportDialog")) ImportDialog.resize(307, 135) self.gridLayout = QtGui.QGridLayout(ImportDialog) self.gridLayout.setObjectName(_fromUtf8("gridLayout")) self.keylengthLabel = QtGui.QLabel(ImportDialog) self.keylengthLabel.setObjectName(_fromUtf8("keylengthLabel")) self.gridLayout.addWidget(self.keylengthLabel, 3, 0, 1, 1) self.filenameLabel = QtGui.QLabel(ImportDialog) self.filenameLabel.setObjectName(_fromUtf8("filenameLabel")) self.gridLayout.addWidget(self.filenameLabel, 2, 0, 1, 1) self.importfileLabel = QtGui.QLabel(ImportDialog) self.importfileLabel.setObjectName(_fromUtf8("importfileLabel")) self.gridLayout.addWidget(self.importfileLabel, 0, 0, 1, 1) self.buttonBox = QtGui.QDialogButtonBox(ImportDialog) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Ok) self.buttonBox.setObjectName(_fromUtf8("buttonBox")) self.gridLayout.addWidget(self.buttonBox, 5, 0, 1, 4) self.colectionLabel = QtGui.QLabel(ImportDialog) self.colectionLabel.setObjectName(_fromUtf8("colectionLabel")) self.gridLayout.addWidget(self.colectionLabel, 1, 0, 1, 1) self.importfileLineedit = QtGui.QLineEdit(ImportDialog) self.importfileLineedit.setObjectName(_fromUtf8("importfileLineedit")) self.gridLayout.addWidget(self.importfileLineedit, 0, 2, 1, 1) self.colectionCombobox = QtGui.QComboBox(ImportDialog) self.colectionCombobox.setObjectName(_fromUtf8("colectionCombobox")) self.gridLayout.addWidget(self.colectionCombobox, 1, 2, 1, 2) self.importfileToolbutton = QtGui.QToolButton(ImportDialog) self.importfileToolbutton.setObjectName( _fromUtf8("importfileToolbutton")) self.gridLayout.addWidget(self.importfileToolbutton, 0, 3, 1, 1) self.filenameLineedit = QtGui.QLineEdit(ImportDialog) self.filenameLineedit.setObjectName(_fromUtf8("filenameLineedit")) self.gridLayout.addWidget(self.filenameLineedit, 2, 2, 1, 2) self.securityProgressbar = QtGui.QProgressBar(ImportDialog) self.securityProgressbar.setMinimum(16) self.securityProgressbar.setMaximum(32) self.securityProgressbar.setProperty("value", 32) self.securityProgressbar.setFormat(_fromUtf8("")) self.securityProgressbar.setObjectName( _fromUtf8("securityProgressbar")) self.gridLayout.addWidget(self.securityProgressbar, 4, 2, 1, 2) self.label = QtGui.QLabel(ImportDialog) self.label.setObjectName(_fromUtf8("label")) self.gridLayout.addWidget(self.label, 4, 0, 1, 1) self.keylengthSpinbox = QtGui.QSpinBox(ImportDialog) self.keylengthSpinbox.setMinimum(16) self.keylengthSpinbox.setMaximum(32) self.keylengthSpinbox.setSingleStep(8) self.keylengthSpinbox.setProperty("value", 32) self.keylengthSpinbox.setObjectName(_fromUtf8("keylengthSpinbox")) self.gridLayout.addWidget(self.keylengthSpinbox, 3, 2, 1, 2) self.retranslateUi(ImportDialog) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), ImportDialog.accept) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), ImportDialog.reject) QtCore.QObject.connect(self.keylengthSpinbox, QtCore.SIGNAL(_fromUtf8("valueChanged(int)")), self.securityProgressbar.setValue) QtCore.QMetaObject.connectSlotsByName(ImportDialog)
def build(self, params): rows = [ (u'Образование', u'01', u'М80'), (u'Здравоохранение', u'02', u'N85.1-N85.14'), (u'Предоставление социальных услуг', u'03', u'N85.3'), (u'Деятельность по организации отдыха, развлечений, культуры и спорта', u'04', u'О92'), (u'Научно-исследовательские учреждения', u'05', u'К73'), (u'ВСЕГО', u'06', u'X'), ] def dispatch(okved): result = [len(rows) - 1] if okved[:3] == u'M80': result.append(0) if okved[:5] >= u'N85.1' and okved[:6] <= u'N85.14': result.append(1) if okved[:5] == u'N85.3': result.append(2) if okved[:3] == u'O92': result.append(3) if okved[:3] == u'K73': result.append(4) return result begDate = getVal(params, 'begDate', QtCore.QDate()) endDate = getVal(params, 'endDate', QtCore.QDate()) eventTypeId = getVal(params, 'eventTypeId', None) onlyPermanentAttach = getVal(params, 'onlyPermanentAttach', False) onlyPayedEvents = getVal(params, 'onlyPayedEvents', False) begPayDate = getVal(params, 'begPayDate', QtCore.QDate()) endPayDate = getVal(params, 'endPayDate', QtCore.QDate()) reportRowSize = 12 reportData = [[0] * reportRowSize for row in rows] query = selectData(begDate, endDate, eventTypeId, onlyPermanentAttach, onlyPayedEvents, begPayDate, endPayDate) while query.next(): record = query.record() okved = forceString(record.value('OKVED')) dispanser = forceBool(record.value('dispanser')) stage = forceString(record.value('stage')) group = forceString(record.value('group')) cnt = forceInt(record.value('cnt')) columns = [0] if dispanser: columns.append(4) if stage == '1': columns.append(5) elif stage == '2': columns.append(6) if group == '1': columns.append(7) elif group == '2': columns.append(8) elif group == '3': columns.append(9) elif group == '4': columns.append(10) elif group == '5': columns.append(11) for row in dispatch(okved): for column in columns: reportData[row][column] += cnt # now text doc = QtGui.QTextDocument() cursor = QtGui.QTextCursor(doc) cursor.setCharFormat(CReportBase.ReportTitle) cursor.insertText(u'Итоги дополнительной диспансеризации граждан') cursor.insertBlock() self.dumpParams(cursor, params) cursor.insertText(u'(2000)') cursor.insertBlock() tableColumns = [ ('30%', [ u'Наименование вида экономической деятельности гражданина, прошедшего диспансеризацию', u'', u'', u'1' ], CReportBase.AlignLeft), ('5%', [u'№ строки', u'', u'', u'2'], CReportBase.AlignCenter), ('5%', [ u'Численность работающих граждан, прошедших дополнительную диспансеризацию (законченные случаи), чел.', u'Всего', u'', u'3' ], CReportBase.AlignRight), ('5%', [u'', u'в том числе:', u'Город-\nских', u'4'], CReportBase.AlignRight), ('5%', [u'', u'', u'Сель-\nских', u'5'], CReportBase.AlignRight), ('5%', [ u'', u'', u'осмо-\nтренных спе-\nциали-\nстами выез-\nдных бри-\nгад (зако-\nнчен-\nные слу-\nчаи)', u'6' ], CReportBase.AlignRight), ('5%', [u'взято на Д-учет', u'Всего', u'', u'7'], CReportBase.AlignRight), ('5%', [ u'', u'в том числе:', u'на ранних стад-\nиях забо-\nлева-\nния', u'8' ], CReportBase.AlignRight), ('5%', [u'', u'', u'на поздних стади-\nях забо-\nлева-\nния', u'9'], CReportBase.AlignRight), ('5%', [ u'Распределение прошедших дополнительную диспансеризацию граждан по группам состояния здоровья', u'I гр.', u'', u'10' ], CReportBase.AlignRight), ('5%', [u'', u'II гр.', u'', u'11'], CReportBase.AlignRight), ('5%', [u'', u'III гр.', u'', u'12'], CReportBase.AlignRight), ('5%', [u'', u'IV гр.', u'', u'13'], CReportBase.AlignRight), ('5%', [u'', u'V гр.', u'', u'14'], CReportBase.AlignRight), ] table = createTable(cursor, tableColumns) table.mergeCells(0, 0, 3, 1) table.mergeCells(0, 1, 3, 1) table.mergeCells(0, 2, 1, 4) table.mergeCells(1, 2, 2, 1) table.mergeCells(1, 3, 1, 3) table.mergeCells(0, 6, 1, 3) table.mergeCells(1, 6, 2, 1) table.mergeCells(1, 7, 1, 2) table.mergeCells(0, 9, 1, 5) table.mergeCells(1, 9, 2, 1) table.mergeCells(1, 10, 2, 1) table.mergeCells(1, 11, 2, 1) table.mergeCells(1, 12, 2, 1) table.mergeCells(1, 13, 2, 1) for iRow, row in enumerate(rows): tableRow = table.addRow() for i in xrange(2): table.setText(tableRow, i, row[i]) for i in xrange(reportRowSize): if not (i in [1, 2, 3]): table.setText(tableRow, 2 + i, reportData[iRow][i]) return doc
def _QWidget_grab(self, rect=__QtCore.QRect(0, 0, -1, -1)): if not rect.isValid(): return __QPixmap.grabWidget(self) else: return __QPixmap.grabWidget(self, rect)
def setup(self, context): self.message = None self._dashboard_message = None self._last_dashboard_message_time = 0.0 self._last_platform_state_message = 0.0 self._last_sysinfo_message = 0.0 self._last_power_state_message = 0.0 # SmachViewer self._smach_viewer = SmachWidget() # BaseStatusWidget self._base_status_widget = BaseStatusWidget() # ArmStatusWidget self._arm_status_widget = ArmStatusWidget() # DriversStatusWidget self._drivers_status_widget = DriversStatusWidget() # ArmTuckWidget self._arm_tuck_widget = ArmTuckWidget() # CancelGoalsWidget self._cancel_goals_widget = CancelGoalsWidget() # ClearCostmapWidget self._clear_costmap_widget = ClearCostmapWidget() # LocationWidget self._location_widget = LocationWidget() # Base Battery self._base_bat = BatteryWidget("Base") # Youbot PC Battery self._youbot_pc_bat = BatteryWidget("Youbot PC") # System Info # Wifi Widget self._wifi_widget = WifiWidget("Youbot PC") # Ethernet Widget self._ethernet_widget = EthernetWidget() # Cpu Widget #_self._cpu_widget = CpuWidget("Youbot PC") # Laptop Battery Widget self._laptop_bat = BatteryWidget("Laptop") # Laptop CPU Widget #self._laptop_cpu_widget = CpuWidget("Laptop") # Laptop Wifi Widget self._laptop_wifi_widget = WifiWidget("Laptop") # Subscribers # Platform State self._sub_platform_state = rospy.Subscriber('dashboard/platform_state', PowerBoardState, self.update_platform_state) # System Info self._sub_sysinfo = rospy.Subscriber('dashboard/sysinfo', SysInfo, self.update_sysinfo) # Laptop Status self._sub_laptop_status = rospy.Subscriber('/dashboard/laptopstatus', SysInfo, self.update_laptop_status) # Diagnostics Aggregator self._dashboard_agg_sub = rospy.Subscriber('diagnostics_agg', diagnostic_msgs.msg.DiagnosticArray, self.dashboard_callback) # Timer self._timer = QtCore.QTimer() self._timer.timeout.connect(self.on_timer) self._timer.start(500)