Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from PyQt5.QtWidgets import QMessageBox
from .dialogs.cf1config import Cf1ConfigDialog
from .dialogs.cf2config import Cf2ConfigDialog
from .dialogs.inputconfigdialogue import InputConfigDialogue
from .dialogs.logconfigdialogue import LogConfigDialogue
__author__ = 'Bitcraze AB'
__all__ = ['MainUI']
logger = logging.getLogger(__name__)
INTERFACE_PROMPT_TEXT = 'Select an interface'
(main_window_class,
main_windows_base_class) = (uic.loadUiType(cfclient.module_path +
'/ui/main.ui'))
class MyDockWidget(QtWidgets.QDockWidget):
closed = pyqtSignal()
def closeEvent(self, event):
super(MyDockWidget, self).closeEvent(event)
self.closed.emit()
class UIState:
DISCONNECTED = 0
CONNECTING = 1
CONNECTED = 2
SCANNING = 3
from cfclient.ui.widgets.plotwidget import PlotWidget
from PyQt5 import uic
from PyQt5.QtCore import pyqtSignal
from PyQt5.QtCore import QAbstractItemModel
from PyQt5.QtCore import QModelIndex
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QMessageBox
import cfclient
__author__ = 'Bitcraze AB'
__all__ = ['PlotTab']
logger = logging.getLogger(__name__)
plot_tab_class = uic.loadUiType(cfclient.module_path +
"/ui/tabs/plotTab.ui")[0]
class LogConfigModel(QAbstractItemModel):
"""Model for log configurations in the ComboBox"""
def __init__(self, parent=None):
super(LogConfigModel, self).__init__(parent)
self._nodes = []
def add_block(self, block):
self._nodes.append(block)
self.layoutChanged.emit()
def parent(self, index):
"""Re-implemented method to get the parent of the given index"""
"""
Shows all the parameters available in the Crazyflie and also gives the ability
to edit them.
"""
from PyQt5 import QtCore, QtWidgets, uic
from PyQt5.QtCore import Qt, pyqtSignal
import cfclient
from cfclient.ui.tab import Tab
__author__ = 'Bitcraze AB'
__all__ = ['LogBlockDebugTab']
logblock_tab_class = uic.loadUiType(cfclient.module_path +
"/ui/tabs/logBlockDebugTab.ui")[0]
class LogBlockDebugTab(Tab, logblock_tab_class):
"""
Used to show debug-information about log status.
"""
_blocks_updated_signal = pyqtSignal(object, bool)
_disconnected_signal = pyqtSignal(str)
def __init__(self, tabWidget, helper, *args):
super(LogBlockDebugTab, self).__init__(*args)
self.setupUi(self)
self.tabName = "Log Blocks Debugging"
import logging
from PyQt5.QtWidgets import QButtonGroup
from PyQt5.QtCore import * # noqa
from PyQt5.QtWidgets import * # noqa
from PyQt5.Qt import * # noqa
import cfclient
__author__ = 'Bitcraze AB'
__all__ = ['PlotWidget']
logger = logging.getLogger(__name__)
(plot_widget_class, connect_widget_base_class) = (
uic.loadUiType(cfclient.module_path + '/ui/widgets/plotter.ui'))
# Try the imports for PyQtGraph to see if it is installed
try:
import pyqtgraph as pg
from pyqtgraph import ViewBox
import pyqtgraph.console # noqa
import numpy as np # noqa
_pyqtgraph_found = True
except Exception:
import traceback
logger.warning("PyQtGraph (or dependency) failed to import:\n%s",
traceback.format_exc())
_pyqtgraph_found = False
from cfclient.ui.tab import Tab
from cflib.crazyflie.log import LogConfig
from cflib.crazyflie.mem import MemoryElement
from lpslib.lopoanchor import LoPoAnchor
import copy
import sys
__author__ = 'Bitcraze AB'
__all__ = ['LocoPositioningTab']
logger = logging.getLogger(__name__)
locopositioning_tab_class = uic.loadUiType(
cfclient.module_path + "/ui/tabs/locopositioning_tab.ui")[0]
# Try the imports for PyQtGraph to see if it is installed
try:
import pyqtgraph as pg
from pyqtgraph import ViewBox # noqa
import pyqtgraph.console # noqa
import numpy as np # noqa
_pyqtgraph_found = True
except Exception:
import traceback
logger.warning("PyQtGraph (or dependency) failed to import:\n%s",
traceback.format_exc())
_pyqtgraph_found = False
import sys
import cfclient
import cflib.crtp
from PyQt5.QtCore import QT_VERSION_STR
from PyQt5.QtCore import PYQT_VERSION_STR
from PyQt5 import QtWidgets
from PyQt5 import uic
from PyQt5.QtCore import pyqtSignal
from cflib.crazyflie.mem import MemoryElement
__author__ = 'Bitcraze AB'
__all__ = ['AboutDialog']
(about_widget_class,
about_widget_base_class) = (uic.loadUiType(cfclient.module_path +
'/ui/dialogs/about.ui'))
DEBUG_INFO_FORMAT = """
<b>Cfclient</b><br>
Cfclient version: {version}<br>
System: {system}<br>
Python: {pmajor}.{pminor}.{pmicro}<br>
Qt: {qt_version}<br>
PyQt: {pyqt_version}<br>
<br>
<b>Interface status</b><br>
{interface_status}
<br>
<b>Input readers</b><br>
{input_readers}
<br>
import struct
from cflib.crtp.crtpstack import CRTPPacket
from cflib.crtp.crtpstack import CRTPPort
from PyQt5 import QtWidgets
from PyQt5 import uic
from PyQt5.QtCore import pyqtSignal
from PyQt5.QtCore import Qt
import cfclient
__author__ = 'Bitcraze AB'
__all__ = ['DebugDriverToolbox']
debugdriver_tab_class = uic.loadUiType(
cfclient.module_path +
"/ui/toolboxes/debugDriverToolbox.ui")[0]
class DebugDriverToolbox(QtWidgets.QWidget, debugdriver_tab_class):
"""Used to interact with the DebugDriver toolbox"""
connectionDoneSignal = pyqtSignal(str)
disconnectedSignal = pyqtSignal(str)
def __init__(self, helper, *args):
super(DebugDriverToolbox, self).__init__(*args)
self.setupUi(self)
self.helper = helper
# Connected / disconnected signals
self.helper.cf.connected.add_callback(
from time import time
from binascii import hexlify
from PyQt5 import QtWidgets
from PyQt5 import uic
from PyQt5.QtCore import pyqtSignal
from PyQt5.QtCore import pyqtSlot
from PyQt5.QtCore import Qt
import cfclient
__author__ = 'Bitcraze AB'
__all__ = ['CrtpSharkToolbox']
param_tab_class = uic.loadUiType(
cfclient.module_path + "/ui/toolboxes/crtpSharkToolbox.ui")[0]
class CrtpSharkToolbox(QtWidgets.QWidget, param_tab_class):
"""Show packets that is sent vie the communication link"""
nameModified = pyqtSignal()
_incoming_packet_signal = pyqtSignal(object)
_outgoing_packet_signal = pyqtSignal(object)
def __init__(self, helper, *args):
super(CrtpSharkToolbox, self).__init__(*args)
self.setupUi(self)
self.helper = helper
# Init the tree widget
self.logTree.setHeaderLabels(['ms', 'Direction', 'Port/Chan', 'Data'])
import logging
from PyQt4 import QtGui, uic
from PyQt4.QtCore import pyqtSignal
import cfclient
from cfclient.ui.tab import Tab
from cflib.crazyflie.mem import MemoryElement
__author__ = 'Bitcraze AB'
__all__ = ['LEDTab']
logger = logging.getLogger(__name__)
led_tab_class = uic.loadUiType(cfclient.module_path +
"/ui/tabs/ledTab.ui")[0]
class LEDTab(Tab, led_tab_class):
"""Tab for plotting logging data"""
_connected_signal = pyqtSignal(str)
_disconnected_signal = pyqtSignal(str)
def __init__(self, tabWidget, helper, *args):
super(LEDTab, self).__init__(*args)
self.setupUi(self)
self.tabName = "LED"
self.menuName = "LED tab"
self.tabWidget = tabWidget
def __init__(self, crazyflie):
self.dsList = []
# Check if user config exists, otherwise copy files
if (not os.path.exists(cfclient.config_path + "/log")):
logger.info("No user config found, copying dist files")
os.makedirs(cfclient.config_path + "/log")
for f in glob.glob(
cfclient.module_path + "/configs/log/[A-Za-z]*.json"):
shutil.copy2(f, cfclient.config_path + "/log")
self._cf = crazyflie
self._cf.connected.add_callback(self._connected)