Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
#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)
def _init_filter_text_frame(self):
filter_text_frame = QFrame()
filter_text_frame_layout = QHBoxLayout()
self._filter_term = SearchField(self)
self._filter_term.setIcon(qtawesome.icon("fa.filter"))
self._filter_term.setPlaceholderText("Filter")
self._filter_term.setText(self._config.get(Plugin.Option.Filter_Term).value)
self._filter_term.textChanged.connect(lambda text: self._filter_changed())
filter_text_frame_layout.addWidget(self._filter_term)
self._match_case_checkbox = QCheckBox("Match Case")
self._match_case_checkbox.setChecked(self._config.get(Plugin.Option.Should_Match_Case).value)
self._match_case_checkbox.stateChanged.connect(lambda state: self._filter_changed())
filter_text_frame_layout.addWidget(self._match_case_checkbox)
self._regex_checkbox = QCheckBox("Regex")
self._regex_checkbox.setChecked(self._config.get(Plugin.Option.Is_Regex).value)
self._regex_checkbox.stateChanged.connect(lambda state: self._filter_changed())
filter_text_frame_layout.addWidget(self._regex_checkbox)
self._invert_match_checkbox = QCheckBox("Invert Match")
self.newEntryAction.setIconText('&New entry')
self.newEntryAction.setShortcut('Ctrl+N')
self.newEntryAction.triggered.connect(self.newEntry)
self.toolbar.addAction(self.newEntryAction)
# Edit in an exterior editor
editIcon = qtawesome.icon('fa.pencil-square-o')
self.editAction = QtGui.QAction(editIcon,
'Edi&t (exterior editor)', self)
self.editAction.setIconText('Edi&t (exterior editor)')
self.editAction.setShortcut('Ctrl+T')
self.editAction.triggered.connect(self.editExternal)
self.toolbar.addAction(self.editAction)
# Launch the previewing of the current notebook
previewIcon = qtawesome.icon('fa.desktop')
self.previewAction = QtGui.QAction(previewIcon,
'&Preview notebook', self)
self.previewAction.setIconText('&Preview notebook')
self.previewAction.setShortcut('Ctrl+P')
self.previewAction.triggered.connect(self.preview)
self.toolbar.addAction(self.previewAction)
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)