def act_open(e=None): # filename=QtGui.QFileDialog.getOpenFileNames(self,tr("Open Image"), "/home/jana", tr("Image Files (*.png *.jpg *.bmp)")) mwv = MainWinView() main_win = mwv.get_ui() filename = QtGui.QFileDialog.getOpenFileName(main_win, const.translate(const.DIALOG_TITLE_OPEN_FILE), const.PATH_HOME, const.DIALOG_FILTER_OPEN_FILE) if not filename: return 0 rpp_reader = RppReader(filename) d = RppImportDialog() d.move((AppView().desktop_width() - d.width()) * 0.5, (AppView().desktop_height() - d.height()) * 0.5) d.addSourceMIDIs(rpp_reader.getSourceMIDIList()) d.exec_() if not d.result(): return 0 name_SrcMIDI = d.getSelectSourceMIDIName() print name_SrcMIDI pr_model = PrModel() pr_model.set_jnote_lst(rpp_reader.getJNoteVOs(name_SrcMIDI)) pr_model.PPQ = rpp_reader.getPPQ() pr_model.tempo = rpp_reader.tempo #dispatch AppView().dispatch_event(events.JNOTES_CHANGED, pr_model.get_jnote_lst())
def initInterface(self): w = const.WIDTH h = const.HEIGHT density = 0.2 while density > 0: if random.random() > 0.5: dtype = 0 area = 1.0 / 32.0 else: dtype = 1 area = 2.0 / 32.0 polygon = const.getPolygon(dtype) polygon = const.expand(polygon, w, h) polygon = const.rotatePolygon(polygon, 2.0 * math.pi * random.random()) m = np.nanmax(polygon, axis=0) m[0] = w - m[0] m[1] = h - m[1] m[0] = m[0] * random.random() m[1] = m[1] * random.random() polygon = const.translate(polygon, m[0], m[1]) polygon = np.around(polygon, decimals=2) a = polygon[0, :] b = polygon[1, :] c = polygon[2, :] if not const.inTriangle(self.rob.p, a, b, c): if not const.intersectsTriangles(polygon, self.triangles): if not const.insideTriangles(polygon, self.triangles): # Aqui indicar los obstaculos y agregarlos a la lista #self.triangles.append(polygon) density = density - area
def __init__(self): super(RppImportDialog, self).__init__() self.setGeometry(0, 0, 500, 300) self.label = QtGui.QLabel(self) self.label.setText('Track Name:') self.label.move(10, 10) self.comboBox = QtGui.QComboBox(self) self.comboBox.setGeometry(10, 30, 200, 25) self.btnOK = QtGui.QPushButton(self) self.btnOK.setGeometry(self.width() / 2, self.height() - 50, 100, 25) self.btnOK.setText(const.translate(const.WINDOW_OK)) self.connect(self.btnOK, QtCore.SIGNAL(events.CLICK), self.onClick)