mirror of
https://github.com/avrdudes/avrdude.git
synced 2026-09-29 04:18:54 +03:00
Add dialog to change log level
This sets the global AVRDUDE verbosity level, based on a radio button group. quell_progress right now not supported
This commit is contained in:
@@ -100,6 +100,7 @@ from ui_adgui import Ui_MainWindow
|
||||
from ui_about import Ui_About
|
||||
from ui_device import Ui_Device
|
||||
from ui_devinfo import Ui_DevInfo
|
||||
from ui_loglevel import Ui_LogLevel
|
||||
|
||||
class About(QDialog):
|
||||
def __init__(self):
|
||||
@@ -119,14 +120,21 @@ class DevInfo(QDialog):
|
||||
self.ui = Ui_DevInfo()
|
||||
self.ui.setupUi(self)
|
||||
|
||||
class LogLevel(QDialog):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.ui = Ui_LogLevel()
|
||||
self.ui.setupUi(self)
|
||||
|
||||
class MainWindow(QMainWindow):
|
||||
def __init__(self):
|
||||
super(MainWindow, self).__init__()
|
||||
self.ui = Ui_MainWindow()
|
||||
self.ui.setupUi(self)
|
||||
|
||||
class adgui():
|
||||
class adgui(QObject):
|
||||
def __init__(self, argv):
|
||||
super().__init__()
|
||||
self.logstring = "Welcome to AVRDUDE!\n"
|
||||
self.app = QApplication(sys.argv)
|
||||
|
||||
@@ -135,6 +143,7 @@ class adgui():
|
||||
self.about = About()
|
||||
self.device = Device()
|
||||
self.devinfo = DevInfo()
|
||||
self.loglevel = LogLevel()
|
||||
|
||||
self.window.ui.actionAbout.triggered.connect(self.about.show)
|
||||
self.window.ui.actionDevice.triggered.connect(self.device.show)
|
||||
@@ -143,6 +152,16 @@ class adgui():
|
||||
(success, message) = avrdude_init()
|
||||
self.initialized = success
|
||||
self.log(message)
|
||||
self.loglevel.ui.radioButton.toggled.connect(self.loglevel_changed)
|
||||
self.loglevel.ui.radioButton_2.toggled.connect(self.loglevel_changed)
|
||||
self.loglevel.ui.radioButton_3.toggled.connect(self.loglevel_changed)
|
||||
self.loglevel.ui.radioButton_4.toggled.connect(self.loglevel_changed)
|
||||
self.loglevel.ui.radioButton_5.toggled.connect(self.loglevel_changed)
|
||||
self.loglevel.ui.radioButton_6.toggled.connect(self.loglevel_changed)
|
||||
self.loglevel.ui.radioButton_7.toggled.connect(self.loglevel_changed)
|
||||
self.loglevel.ui.radioButton_8.toggled.connect(self.loglevel_changed)
|
||||
self.loglevel.ui.radioButton_9.toggled.connect(self.loglevel_changed)
|
||||
self.window.ui.actionLog_level.triggered.connect(self.loglevel.show)
|
||||
if not success:
|
||||
self.window.ui.actionDevice.setEnabled(False)
|
||||
self.window.ui.actionProgrammer.setEnabled(False)
|
||||
@@ -243,6 +262,13 @@ class adgui():
|
||||
self.update_device_info()
|
||||
self.window.ui.actionDevice_Info.setEnabled(True)
|
||||
|
||||
def loglevel_changed(self, checked: bool):
|
||||
btn = self.sender()
|
||||
if checked:
|
||||
# we abuse the tooltip for the verbosity value
|
||||
val = int(btn.toolTip())
|
||||
ad.cvar.verbose = val
|
||||
|
||||
|
||||
def main():
|
||||
gui = adgui(sys.argv)
|
||||
|
||||
@@ -116,6 +116,7 @@
|
||||
<property name="title">
|
||||
<string>Settings</string>
|
||||
</property>
|
||||
<addaction name="actionLog_level"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuHelp">
|
||||
<property name="title">
|
||||
@@ -157,6 +158,61 @@
|
||||
<string>About ...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionError">
|
||||
<property name="text">
|
||||
<string>OS Error</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionWarning">
|
||||
<property name="text">
|
||||
<string>Warning</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionError_2">
|
||||
<property name="text">
|
||||
<string>Error</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionWarning_2">
|
||||
<property name="text">
|
||||
<string>Warning</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionInfo">
|
||||
<property name="text">
|
||||
<string>Info</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionNotice">
|
||||
<property name="text">
|
||||
<string>Notice</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionNotice_2">
|
||||
<property name="text">
|
||||
<string>Notice 2</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDebug">
|
||||
<property name="text">
|
||||
<string>Debug</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionTrace">
|
||||
<property name="text">
|
||||
<string>Trace</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionTrace_2">
|
||||
<property name="text">
|
||||
<string>Trace 2</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionLog_level">
|
||||
<property name="text">
|
||||
<string>Log level …</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
|
||||
201
src/python/loglevel.ui
Normal file
201
src/python/loglevel.ui
Normal file
@@ -0,0 +1,201 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>LogLevel</class>
|
||||
<widget class="QDialog" name="LogLevel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>277</width>
|
||||
<height>317</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Log Level</string>
|
||||
</property>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>180</x>
|
||||
<y>30</y>
|
||||
<width>81</width>
|
||||
<height>241</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>10</y>
|
||||
<width>141</width>
|
||||
<height>301</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Log Level</string>
|
||||
</property>
|
||||
<widget class="QRadioButton" name="radioButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>30</y>
|
||||
<width>107</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>OS Error</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QRadioButton" name="radioButton_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>60</y>
|
||||
<width>107</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Error</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QRadioButton" name="radioButton_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>90</y>
|
||||
<width>107</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Warning</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QRadioButton" name="radioButton_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>120</y>
|
||||
<width>107</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Info</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QRadioButton" name="radioButton_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>150</y>
|
||||
<width>107</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Notice</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QRadioButton" name="radioButton_6">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>180</y>
|
||||
<width>107</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Notice 2</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QRadioButton" name="radioButton_7">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>210</y>
|
||||
<width>107</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Debug</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QRadioButton" name="radioButton_8">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>240</y>
|
||||
<width>107</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Trace</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QRadioButton" name="radioButton_9">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>270</y>
|
||||
<width>107</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Trace 2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>LogLevel</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>LogLevel</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user