Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def run():
"""
Start the IconBrowser and block until the process exits.
"""
app = QtWidgets.QApplication([])
browser = IconBrowser()
browser.show()
sys.exit(app.exec_())
for iconName in fontData:
iconNames.append('%s.%s' % (fontCollection, iconName))
self._filterTimer = QtCore.QTimer(self)
self._filterTimer.setSingleShot(True)
self._filterTimer.setInterval(AUTO_SEARCH_TIMEOUT)
self._filterTimer.timeout.connect(self._updateFilter)
model = IconModel(self.palette().color(QtGui.QPalette.Text))
model.setStringList(sorted(iconNames))
self._proxyModel = QtCore.QSortFilterProxyModel()
self._proxyModel.setSourceModel(model)
self._proxyModel.setFilterCaseSensitivity(QtCore.Qt.CaseInsensitive)
self._listView = IconListView(self)
self._listView.setUniformItemSizes(True)
self._listView.setViewMode(QtWidgets.QListView.IconMode)
self._listView.setModel(self._proxyModel)
self._listView.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
self._listView.doubleClicked.connect(self._copyIconText)
self._lineEdit = QtWidgets.QLineEdit(self)
self._lineEdit.setAlignment(QtCore.Qt.AlignCenter)
self._lineEdit.textChanged.connect(self._triggerDelayedUpdate)
self._lineEdit.returnPressed.connect(self._triggerImmediateUpdate)
self._comboBox = QtWidgets.QComboBox(self)
self._comboBox.setMinimumWidth(75)
self._comboBox.currentIndexChanged.connect(self._triggerImmediateUpdate)
self._comboBox.addItems([ALL_COLLECTIONS] + sorted(fontMaps.keys()))
self.setWindowTitle('QtAwesome Icon Browser')
qtawesome._instance()
fontMaps = qtawesome._resource['iconic'].charmap
iconNames = []
for fontCollection, fontData in fontMaps.items():
for iconName in fontData:
iconNames.append('%s.%s' % (fontCollection, iconName))
self._filterTimer = QtCore.QTimer(self)
self._filterTimer.setSingleShot(True)
self._filterTimer.setInterval(AUTO_SEARCH_TIMEOUT)
self._filterTimer.timeout.connect(self._updateFilter)
model = IconModel(self.palette().color(QtGui.QPalette.Text))
model.setStringList(sorted(iconNames))
self._proxyModel = QtCore.QSortFilterProxyModel()
self._proxyModel.setSourceModel(model)
self._proxyModel.setFilterCaseSensitivity(QtCore.Qt.CaseInsensitive)
self._listView = IconListView(self)
self._listView.setUniformItemSizes(True)
self._listView.setViewMode(QtWidgets.QListView.IconMode)
self._listView.setModel(self._proxyModel)
self._listView.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
self._listView.doubleClicked.connect(self._copyIconText)
self._lineEdit = QtWidgets.QLineEdit(self)
self._lineEdit.setAlignment(QtCore.Qt.AlignCenter)
self._lineEdit.textChanged.connect(self._triggerDelayedUpdate)
'pygments',
'jupyter_client',
],
'include_msvcr': True,
'include_files': [
# cx_Freeze doesn't respect the DSDL definition files that are embedded into the package,
# so we need to include the Pyuavcan package as data in order to work-around this problem.
# Despite the fact that Pyuavcan is included as data, we still need cx_Freeze to analyze its
# dependencies, so we don't exclude it explicitly.
os.path.join(unpacked_eggs_dir, 'uavcan'),
# Same thing goes with the main package - we want its directory structure untouched, so we include
# it as data, too.
PACKAGE_NAME,
# These packages don't work properly when packed in .zip, so here we have another bunch of ugly hacks
os.path.join(unpacked_eggs_dir, os.path.dirname(PyQt5.__file__)),
os.path.join(unpacked_eggs_dir, os.path.dirname(qtawesome.__file__)),
os.path.join(unpacked_eggs_dir, os.path.dirname(qtconsole.__file__)),
os.path.join(unpacked_eggs_dir, os.path.dirname(zmq.__file__)),
os.path.join(unpacked_eggs_dir, os.path.dirname(pygments.__file__)),
os.path.join(unpacked_eggs_dir, os.path.dirname(IPython.__file__)),
os.path.join(unpacked_eggs_dir, os.path.dirname(ipykernel.__file__)),
os.path.join(unpacked_eggs_dir, os.path.dirname(jupyter_client.__file__)),
os.path.join(unpacked_eggs_dir, os.path.dirname(traitlets.__file__)),
os.path.join(unpacked_eggs_dir, os.path.dirname(numpy.__file__)),
] + missing_dlls,
},
'bdist_msi': {
'initial_target_dir': '[ProgramFilesFolder]\\UAVCAN\\' + HUMAN_FRIENDLY_NAME,
},
}
args['executables'] = [
cx_Freeze.Executable(os.path.join('bin', PACKAGE_NAME),
#model_id=int(available_model_ids[i])
model_id = row['model_id']
model_name = row['model_name'] + ' ' + str(model_id)
description = row['description']
units_code = row['units_code']
if model_id in self.models.keys():
print('model %f already stored - skipping' % model_id)
else:
print('Storing model id:',model_id)
self.models[model_id] = Model(model_id, model_name, modal_data, None, self.model_view,
None, None, uff_tree_index,None)
button=pqg.QPushButton(qta.icon('fa.database', color='white'),str(model_name), self)
button.setObjectName('medium')
button.setCheckable(True)
button.clicked.connect(partial(on_activate, model_id))
button.setContextMenuPolicy(pqc.Qt.CustomContextMenu)
button.customContextMenuRequested.connect(self.model_btn_context_menu)
button.model_name=model_name
button.model_id=model_id
button.show()
self.model_buttons[int(model_id)]=button
#deactivate all models and model buttons
self.deactivate_all()
#activate first model automatically
#TODO: implement 'current and previously selected models'
"""
super(self.__class__,self).create_layout()
self._button = pqg.QPushButton(qta.icon('fa.plus-circle', color='white'),'New model', self)
self._button.setObjectName('medium')
self._button.clicked.connect(self.new_model)
self._button5 = pqg.QPushButton(qta.icon('fa.trash-o', color='white'),'Delete model', self)
self._button5.setObjectName('medium')
self._button5.clicked.connect(self.delete_model_dialog)
self._button2 = pqg.QPushButton(qta.icon('fa.search', color='white'),'Fit view', self)
self._button2.setObjectName('medium')
self._button2.clicked.connect(self.autofit_3d_view)
self._b_geom_prim= pqg.QPushButton(qta.icon('fa.industry', color='white'),'Create geometry', self)
self._b_geom_prim.setObjectName('medium')
self._b_geom_prim.clicked.connect(self.create_geom_primitive)
self._button3 = pqg.QPushButton('Add nodes', self)
self._button3.setObjectName('table_button')
self._button3.setCheckable(True)
self._button3.setChecked(True)
self._button3.clicked.connect(self.nodes_data_mode)
self._button6 = pqg.QPushButton('Add lines', self)
self._button6.setObjectName('table_button')
self._button6.setCheckable(True)
self._button6.clicked.connect(self.lines_data_mode)
self._button4 = pqg.QPushButton('Add triangles', self)
color_active='orange'))
self._main_window.rectangular_region_action.setIcon(
qta.icon('fa.square',
active='fa.legal',
color='black',
color_active='orange'))
self._main_window.plot_options_action.setIcon(
qta.icon('fa.line-chart',
active='fa.legal',
color='black',
color_active='orange'))
self._main_window.export_plot_action.setIcon(
qta.icon('fa.download',
active='fa.legal',
color='black',
color_active='orange'))
self._main_window.change_unit_action.setIcon(
qta.icon('fa.exchange',
active='fa.legal',
color='black',
color_active='orange'))
def refresh(self, active_color, inactive_color):
"""Repaint the buttons of the widgetd after the theme has changed."""
self._active_color = active_color
self._inactive_color = inactive_color
self._play.setIcon(qta.icon('fa5s.play',
color=active_color,
color_disabled=inactive_color))
self._pause.setIcon(qta.icon('fa5s.pause',
color=active_color,
color_disabled=inactive_color))
self._stop.setIcon(qta.icon('fa5s.stop',
color=active_color,
color_disabled=inactive_color))
self._set_loop_icon()
self.pushButton.setIcon(spin_icon)#设置图标
self.pushButton.setIconSize(QSize(50,50))
#self.pushButton
self.button_click=1
self.thread.start() #开启线程 进行录音
elif self.button_click==1:
# stream.stop_stream() #结束录音 进行保存
# stream.close()
# p.terminate()
self.thread.terminate() #结束录音
spin_icon = qtawesome.icon('fa5s.microphone-alt', color='white')
self.pushButton.setIcon(spin_icon)#设置图标
self.pushButton.setIconSize(QSize(50,50))
p = pyaudio.PyAudio() #进行保存
wf = wave.open('recode.wav', 'wb')
wf.setnchannels(1)
wf.setsampwidth(p.get_sample_size(pyaudio.paInt16))
wf.setframerate(16000)
wf.writeframes(b''.join(self.flames))
wf.close()
self.button_click=0
speech_recogntion='识别结果:'+baidu_speech_reco()
self.text_label.setText(speech_recogntion)
def update_box(self, text=None):
if text:
if self._show_icons:
self.button_icon.setIcon(qta.icon('fa.remove'))
self.button_icon.setProperty('_remove', True)
else:
if self._show_icons:
self.button_icon.setIcon(qta.icon('fa.search'))
self.button_icon.setProperty('_remove', False)
self._empty = not bool(text)
self.button_icon.setDisabled(self._empty)