├── .editorconfig ├── .github ├── ISSUE_TEMPLATE.md ├── dependabot.yml └── workflows │ └── build.yaml ├── .gitignore ├── .pre-commit-config.yaml ├── .pyup.yml ├── AUTHORS.rst ├── CHANGELOG.md ├── CONTRIBUTING.rst ├── LICENSE ├── README.md ├── docs ├── gen_pages.py ├── images │ ├── abstractitemmodelmixin_subclasses.png │ ├── actionsmodel.png │ ├── annotatedscrollbar.png │ ├── astmodel.png │ ├── astviewer.png │ ├── columnjoinerproxymodel_after.png │ ├── columnjoinerproxymodel_before.png │ ├── filterheader.png │ ├── flattentreeproxymodel.png │ ├── flattentreeproxymodel_leaves_only.png │ ├── flattentreeproxymodel_path.png │ ├── flattentreeproxymodel_without.png │ ├── meltproxymodel_after.png │ ├── meltproxymodel_before.png │ ├── slicechangeflagsproxymodel_after.png │ ├── slicechangeflagsproxymodel_before.png │ ├── slicechangeiconsizeproxymodel_after.png │ ├── slicechangeiconsizeproxymodel_before.png │ ├── slicecolorvaluesproxymodel_after.png │ ├── slicecolorvaluesproxymodel_before.png │ ├── slicehighlightcurrentproxymodel_all.png │ ├── slicehighlightcurrentproxymodel_column.png │ ├── slicehighlightcurrentproxymodel_none.png │ ├── slicehighlightcurrentproxymodel_row.png │ ├── tabletolistproxymodel_after.png │ ├── tabletolistproxymodel_before.png │ ├── treewidget_mro.png │ └── treewidget_parentclasses.png ├── javascripts │ └── tablesort.js ├── overrides │ └── dummy.txt └── qt6.inv ├── duties.py ├── mkdocs.yml ├── prettyqt ├── __init__.py ├── __pyinstaller │ ├── __init__.py │ └── hook-prettyqt.py ├── animations │ ├── __init__.py │ ├── animator.py │ ├── cursormoveanimation.py │ ├── flasheffect.py │ ├── fx.py │ ├── slideanimation.py │ ├── textanimation.py │ └── zoomanimation.py ├── bluetooth │ ├── __init__.py │ ├── bluetoothaddress.py │ ├── bluetoothdevicediscoveryagent.py │ ├── bluetoothdeviceinfo.py │ ├── bluetoothhostinfo.py │ ├── bluetoothlocaldevice.py │ ├── bluetoothserver.py │ ├── bluetoothservicediscoveryagent.py │ ├── bluetoothserviceinfo.py │ ├── bluetoothsocket.py │ └── bluetoothuuid.py ├── charts │ ├── __init__.py │ ├── abstractaxis.py │ ├── abstractbarseries.py │ ├── abstractseries.py │ ├── barcategoryaxis.py │ ├── barseries.py │ ├── barset.py │ ├── boxset.py │ ├── candlestickset.py │ ├── categoryaxis.py │ ├── chart.py │ ├── chartview.py │ ├── datetimeaxis.py │ ├── horizontalbarseries.py │ ├── horizontalpercentbarseries.py │ ├── horizontalstackedbarseries.py │ ├── legend.py │ ├── lineseries.py │ ├── logvalueaxis.py │ ├── percentbarseries.py │ ├── pieslice.py │ ├── polarchart.py │ ├── scatterseries.py │ ├── stackedbarseries.py │ ├── valueaxis.py │ └── xyseries.py ├── constants │ └── __init__.py ├── core │ ├── __init__.py │ ├── _calendar.py │ ├── _datetime.py │ ├── _locale.py │ ├── _resource.py │ ├── _time.py │ ├── _uuid.py │ ├── abstractanimation.py │ ├── abstracteventdispatcher.py │ ├── abstractitemmodel.py │ ├── abstractlistmodel.py │ ├── abstractnativeeventfilter.py │ ├── abstractproxymodel.py │ ├── abstracttablemodel.py │ ├── animationgroup.py │ ├── basictimer.py │ ├── buffer.py │ ├── bytearray.py │ ├── bytearraymatcher.py │ ├── collator.py │ ├── collatorsortkey.py │ ├── commandlineoption.py │ ├── commandlineparser.py │ ├── concatenatetablesproxymodel.py │ ├── coreapplication.py │ ├── cryptographichash.py │ ├── datastream.py │ ├── date.py │ ├── deadlinetimer.py │ ├── debug.py │ ├── dir.py │ ├── diriterator.py │ ├── easingcurve.py │ ├── elapsedtimer.py │ ├── event.py │ ├── eventloop.py │ ├── file.py │ ├── filedevice.py │ ├── fileinfo.py │ ├── fileselector.py │ ├── filesystemwatcher.py │ ├── identityproxymodel.py │ ├── iodevice.py │ ├── itemselection.py │ ├── itemselectionmodel.py │ ├── itemselectionrange.py │ ├── jsondocument.py │ ├── jsonvalue.py │ ├── keycombination.py │ ├── library.py │ ├── libraryinfo.py │ ├── line.py │ ├── linef.py │ ├── lockfile.py │ ├── loggingcategory.py │ ├── margins.py │ ├── marginsf.py │ ├── metaenum.py │ ├── metamethod.py │ ├── metaobject.py │ ├── metaproperty.py │ ├── metatype.py │ ├── mimedata.py │ ├── mimedatabase.py │ ├── mimetype.py │ ├── modelindex.py │ ├── modelroledata.py │ ├── mutex.py │ ├── object.py │ ├── operatingsystemversion.py │ ├── parallelanimationgroup.py │ ├── pauseanimation.py │ ├── persistentmodelindex.py │ ├── pluginloader.py │ ├── point.py │ ├── pointf.py │ ├── process.py │ ├── processenvironment.py │ ├── property.py │ ├── propertyanimation.py │ ├── randomgenerator.py │ ├── randomgenerator64.py │ ├── rect.py │ ├── rectf.py │ ├── regularexpression.py │ ├── regularexpressionmatch.py │ ├── regularexpressionmatchiterator.py │ ├── runnable.py │ ├── savefile.py │ ├── semaphore.py │ ├── sequentialanimationgroup.py │ ├── settings.py │ ├── sharedmemory.py │ ├── signalblocker.py │ ├── signalmapper.py │ ├── size.py │ ├── sizef.py │ ├── slot.py │ ├── socketnotifier.py │ ├── sortfilterproxymodel.py │ ├── standardpaths.py │ ├── storageinfo.py │ ├── stringlistmodel.py │ ├── temporarydir.py │ ├── temporaryfile.py │ ├── textboundaryfinder.py │ ├── textstream.py │ ├── thread.py │ ├── threadpool.py │ ├── timeline.py │ ├── timer.py │ ├── timezone.py │ ├── translator.py │ ├── transposeproxymodel.py │ ├── url.py │ ├── urlquery.py │ ├── variantanimation.py │ ├── versionnumber.py │ └── xmlstreamreader.py ├── custom_network │ ├── __init__.py │ ├── downloadworker.py │ ├── googlecompleter.py │ └── update_check.py ├── custom_widgets │ ├── __init__.py │ ├── accordionwidget.py │ ├── actiongrid.py │ ├── adjustingboxlayoutdockwidget.py │ ├── astviewer.py │ ├── autoresizingtextedit.py │ ├── booldicttoolbutton.py │ ├── codeeditor.py │ ├── collapsibleframe.py │ ├── commandpalette.py │ ├── configwidget.py │ ├── crossfadewidget.py │ ├── cyclewidget.py │ ├── defaultdropdownaction.py │ ├── editors │ │ ├── __init__.py │ │ ├── brushedit.py │ │ ├── colorchooserbutton.py │ │ ├── colorcombobox.py │ │ ├── cursoredit.py │ │ ├── enumcombobox.py │ │ ├── enumflagwidget.py │ │ ├── filechooserbutton.py │ │ ├── flagselectionwidget.py │ │ ├── fontchooserbutton.py │ │ ├── iconedit.py │ │ ├── inputandslider.py │ │ ├── keycombinationedit.py │ │ ├── lineedits.py │ │ ├── listinput.py │ │ ├── localeedit.py │ │ ├── mappedcheckbox.py │ │ ├── paletteedit.py │ │ ├── pointedit.py │ │ ├── rangeedit.py │ │ ├── rectedit.py │ │ ├── regexinput.py │ │ ├── regexlineedit.py │ │ ├── selectionwidget.py │ │ ├── singlelinetextedit.py │ │ ├── sizeedit.py │ │ ├── sizepolicyedit.py │ │ ├── sliceedit.py │ │ ├── spanslider.py │ │ └── stringornumberwidget.py │ ├── faderwidget.py │ ├── fuzzycompleter.py │ ├── gridsplitter.py │ ├── iconbrowser.py │ ├── imageviewer.py │ ├── itemviews │ │ ├── __init__.py │ │ ├── filetree.py │ │ └── filterheader.py │ ├── joystickbutton.py │ ├── labeledslider.py │ ├── labels │ │ ├── __init__.py │ │ ├── clickablelabel.py │ │ ├── elidedlabel.py │ │ ├── iconlabel.py │ │ ├── iconwidget.py │ │ └── verticallabel.py │ ├── layouts │ │ ├── __init__.py │ │ ├── borderlayout.py │ │ ├── flowlayout.py │ │ └── multilinelayout.py │ ├── logrecordtableview.py │ ├── logtextedit.py │ ├── modelwidget.py │ ├── multicombobox.py │ ├── notification.py │ ├── numfilterwidget.py │ ├── objectbrowser.py │ ├── optionalwidget.py │ ├── orientedscrollarea.py │ ├── orientedtableview.py │ ├── overlayborder.py │ ├── popupinfo.py │ ├── qobjecthierarchytreeview.py │ ├── qobjectpropertiestableview.py │ ├── regexeditor │ │ ├── __init__.py │ │ ├── __main__.py │ │ ├── ref.html │ │ └── regexeditorwidget.py │ ├── roundprogressbar.py │ ├── scrollareatocwidget.py │ ├── scrollbars │ │ ├── __init__.py │ │ ├── annotatedscrollbar.py │ │ ├── previewscrollbar.py │ │ └── smoothscrollbar.py │ ├── sidebarwidget.py │ ├── standardiconswidget.py │ ├── stretchbuttontoolbar.py │ ├── subsequencecompleter.py │ ├── timeline.py │ ├── twolistsselectionwidget.py │ ├── waitingspinner.py │ └── widgeteditor.py ├── debugging │ ├── __init__.py │ ├── errormessagebox.py │ ├── messagehandler.py │ ├── package_info.py │ ├── proxycomparerwidget.py │ ├── qobjectdetailsdialog.py │ ├── stalker.py │ └── tracebackdialog.py ├── designer │ ├── __init__.py │ ├── abstractextensionfactory.py │ ├── abstractformbuilder.py │ ├── designercustomwidgetinterface.py │ ├── designerformeditorinterface.py │ ├── formbuilder.py │ ├── pydesignercustomwidgetcollection.py │ ├── pydesignercustomwidgetcollectionplugin.py │ ├── pydesignercustomwidgetplugin.py │ └── pydesignertaskmenuextension.py ├── docs │ ├── SUMMARY.md │ ├── __init__.py │ ├── api_guidelines │ │ ├── bindings.md │ │ ├── general.md │ │ ├── mixintree.md │ │ └── types.md │ ├── build_index.py │ ├── build_root.py │ └── features │ │ ├── animating.md │ │ ├── layouts.md │ │ ├── models.md │ │ ├── proxies.md │ │ └── widgets.md ├── eventfilters │ ├── __init__.py │ ├── animatedtooltipeventfilter.py │ ├── autosizecolumnseventfilter.py │ ├── baseeventfilter.py │ ├── debugmode.py │ ├── eventcatcher.py │ ├── hovericoneventfilter.py │ ├── listviewgridresizeeventfilter.py │ ├── sectionautospaneventfilter.py │ ├── slidermovetomouseclickeventfilter.py │ └── timelabeleventfilter.py ├── gui │ ├── __init__.py │ ├── abstractfileiconprovider.py │ ├── abstracttextdocumentlayout.py │ ├── action.py │ ├── actiongroup.py │ ├── backingstore.py │ ├── bitmap.py │ ├── brush.py │ ├── clipboard.py │ ├── color.py │ ├── colorspace.py │ ├── conicalgradient.py │ ├── cursor.py │ ├── desktopservices.py │ ├── doublevalidator.py │ ├── drag.py │ ├── font.py │ ├── fontdatabase.py │ ├── fontinfo.py │ ├── fontmetrics.py │ ├── fontmetricsf.py │ ├── gradient.py │ ├── guiapplication.py │ ├── icon.py │ ├── iconengine.py │ ├── image.py │ ├── imageiohandler.py │ ├── imagereader.py │ ├── imagewriter.py │ ├── inputmethod.py │ ├── intvalidator.py │ ├── keysequence.py │ ├── lineargradient.py │ ├── matrix4x4.py │ ├── movie.py │ ├── pagedpaintdevice.py │ ├── pagelayout.py │ ├── pageranges.py │ ├── pagesize.py │ ├── paintdevice.py │ ├── paintdevicewindow.py │ ├── painter.py │ ├── painterpath.py │ ├── painterpathstroker.py │ ├── palette.py │ ├── pdfwriter.py │ ├── pen.py │ ├── picture.py │ ├── pixmap.py │ ├── pixmapcache.py │ ├── polygon.py │ ├── polygonf.py │ ├── radialgradient.py │ ├── rasterwindow.py │ ├── region.py │ ├── regularexpressionvalidator.py │ ├── screen.py │ ├── sessionmanager.py │ ├── shortcut.py │ ├── standarditem.py │ ├── standarditemmodel.py │ ├── statictext.py │ ├── stylehints.py │ ├── surface.py │ ├── surfaceformat.py │ ├── syntaxhighlighter.py │ ├── textblock.py │ ├── textblockformat.py │ ├── textblockgroup.py │ ├── textblockuserdata.py │ ├── textcharformat.py │ ├── textcursor.py │ ├── textdocument.py │ ├── textdocumentfragment.py │ ├── textdocumentwriter.py │ ├── textformat.py │ ├── textframe.py │ ├── textframeformat.py │ ├── textimageformat.py │ ├── textlayout.py │ ├── textlength.py │ ├── textline.py │ ├── textlistformat.py │ ├── textobject.py │ ├── textobjectinterface.py │ ├── textoption.py │ ├── texttable.py │ ├── texttablecell.py │ ├── texttablecellformat.py │ ├── texttableformat.py │ ├── transform.py │ ├── undocommand.py │ ├── undogroup.py │ ├── undostack.py │ ├── validator.py │ ├── vector3d.py │ ├── vector4d.py │ └── window.py ├── iconprovider │ ├── __init__.py │ ├── animation.py │ ├── awesomefileiconprovider.py │ ├── awesomequickimageprovider.py │ ├── chariconengine.py │ ├── emojiiconengine.py │ ├── fonts │ │ ├── codicon-charmap.json │ │ ├── codicon.ttf │ │ ├── elusiveicons-webfont-charmap.json │ │ ├── elusiveicons-webfont.ttf │ │ ├── fontawesome5-brands-webfont-charmap.json │ │ ├── fontawesome5-brands-webfont.ttf │ │ ├── fontawesome5-regular-webfont-charmap.json │ │ ├── fontawesome5-regular-webfont.ttf │ │ ├── fontawesome5-solid-webfont-charmap.json │ │ ├── fontawesome5-solid-webfont.ttf │ │ ├── materialdesignicons5-webfont-charmap.json │ │ ├── materialdesignicons5-webfont.ttf │ │ ├── materialdesignicons6-webfont-charmap.json │ │ ├── materialdesignicons6-webfont.ttf │ │ ├── phosphor-charmap.json │ │ ├── phosphor.ttf │ │ ├── remixicon-charmap.json │ │ └── remixicon.ttf │ ├── iconic_font.py │ └── svgbuffericonengine.py ├── ipython │ ├── __init__.py │ ├── baseipythonwidget.py │ ├── inprocessipythonwidget.py │ └── outofprocessipythonwidget.py ├── itemdelegates │ ├── __init__.py │ ├── buttondelegate.py │ ├── editordelegate.py │ ├── htmlitemdelegate.py │ ├── icondelegate.py │ ├── nofocusdelegate.py │ ├── progressbardelegate.py │ ├── radiodelegate.py │ ├── renderlinkdelegate.py │ ├── stardelegate.py │ └── widgetdelegate.py ├── itemmodels │ ├── __init__.py │ ├── actionsmodel.py │ ├── astmodel.py │ ├── attrsfieldsmodel.py │ ├── attrsmodel.py │ ├── basedataclassmodel.py │ ├── basefieldsmodel.py │ ├── classtreemodel.py │ ├── columnitemmodel.py │ ├── dataclassfieldsmodel.py │ ├── dataclassmodel.py │ ├── frameinfomodel.py │ ├── fsspecmodel.py │ ├── gitpythontreemodel.py │ ├── importlibdistributionmodel.py │ ├── itemmodelresolver.py │ ├── jsonmodel.py │ ├── listmixin.py │ ├── logrecordmodel.py │ ├── lxmlmodel.py │ ├── mappingmodel.py │ ├── modelindexmodel.py │ ├── modelmixin.py │ ├── moduleinfomodel.py │ ├── nesteditem.py │ ├── nestedmodel.py │ ├── proxies │ │ ├── __init__.py │ │ ├── appearanceproxymodel.py │ │ ├── binsproxymodel.py │ │ ├── changeheadersproxymodel.py │ │ ├── columnjoinerproxymodel.py │ │ ├── columnorderproxymodel.py │ │ ├── flattentreeproxymodel.py │ │ ├── fuzzyfilterproxymodel.py │ │ ├── highlightmouseproxymodel.py │ │ ├── linkedselectionmodel.py │ │ ├── meltproxymodel.py │ │ ├── multicolumnfilterproxymodel.py │ │ ├── predicatefilterproxymodel.py │ │ ├── proxymapper.py │ │ ├── rangefilterproxymodel.py │ │ ├── rankproxymodel.py │ │ ├── sliceappearanceproxymodel.py │ │ ├── slicechangeflagsproxymodel.py │ │ ├── slicechangeiconsizeproxymodel.py │ │ ├── slicecheckableproxymodel.py │ │ ├── slicecolorcategoriesproxymodel.py │ │ ├── slicecolorvaluesproxymodel.py │ │ ├── slicedisplaytextproxymodel.py │ │ ├── slicefilterproxymodel.py │ │ ├── slicehighlightcurrentproxymodel.py │ │ ├── sliceidentityproxymodel.py │ │ ├── slicemaproleproxymodel.py │ │ ├── slicetomarkdownproxymodel.py │ │ ├── slicevaluetransformationproxymodel.py │ │ ├── stackproxymodel.py │ │ ├── subsetfilterproxymodel.py │ │ ├── tabletolistproxymodel.py │ │ ├── unmeltproxymodel.py │ │ └── valuefilterproxymodel.py │ ├── pydanticfieldsmodel.py │ ├── pydanticmodel.py │ ├── pythonobjecttreemodel.py │ ├── qobjectpropertiesmodel.py │ ├── regexmatchesmodel.py │ ├── selectionmixin.py │ ├── shortcutsmodel.py │ ├── storageinfomodel.py │ ├── treemodel.py │ ├── tupletreemodel.py │ ├── widgethierarchymodel.py │ ├── widgetsdetailsmodel.py │ └── xmlmodel.py ├── keybindings.py ├── localization │ ├── language_ar.qm │ ├── language_bg.qm │ ├── language_ca.qm │ ├── language_cs.qm │ ├── language_da.qm │ ├── language_de.qm │ ├── language_es.qm │ ├── language_fa.qm │ ├── language_fi.qm │ ├── language_fr.qm │ ├── language_gd.qm │ ├── language_gl.qm │ ├── language_he.qm │ ├── language_hr.qm │ ├── language_hu.qm │ ├── language_it.qm │ ├── language_ja.qm │ ├── language_ka.qm │ ├── language_ko.qm │ ├── language_lg.qm │ ├── language_lt.qm │ ├── language_lv.qm │ ├── language_nl.qm │ ├── language_nn.qm │ ├── language_pl.qm │ ├── language_pt.qm │ ├── language_pt_BR.qm │ ├── language_pt_PT.qm │ ├── language_ru.qm │ ├── language_sk.qm │ ├── language_sl.qm │ ├── language_sv.qm │ ├── language_tr.qm │ ├── language_uk.qm │ ├── language_zh_CN.qm │ └── language_zh_TW.qm ├── location │ ├── __init__.py │ ├── geocodingmanager.py │ ├── geomaneuver.py │ ├── georoute.py │ ├── georouterequest.py │ ├── georoutesegment.py │ ├── georoutingmanager.py │ ├── geoserviceprovider.py │ ├── place.py │ ├── placeattribute.py │ ├── placecategory.py │ ├── placecontactdetail.py │ ├── placecontent.py │ ├── placecontentreply.py │ ├── placecontentrequest.py │ ├── placedetailsreply.py │ ├── placeicon.py │ ├── placeidreply.py │ ├── placemanager.py │ ├── placematchreply.py │ ├── placematchrequest.py │ ├── placeproposedsearchresult.py │ ├── placeratings.py │ ├── placereply.py │ ├── placeresult.py │ ├── placesearchreply.py │ ├── placesearchrequest.py │ ├── placesearchresult.py │ ├── placesupplier.py │ ├── placeuser.py │ └── qlocation.py ├── multimedia │ ├── __init__.py │ ├── audiodevice.py │ ├── audioformat.py │ ├── camera.py │ ├── cameradevice.py │ ├── cameraformat.py │ ├── mediametadata.py │ ├── mediaplayer.py │ ├── mediarecorder.py │ └── screencapture.py ├── multimediawidgets │ ├── __init__.py │ ├── graphicsvideoitem.py │ └── videowidget.py ├── network │ ├── __init__.py │ ├── abstractsocket.py │ ├── hostaddress.py │ ├── httpmultipart.py │ ├── httppart.py │ ├── localserver.py │ ├── localsocket.py │ ├── networkaccessmanager.py │ ├── networkaddressentry.py │ ├── networkcookie.py │ ├── networkcookiejar.py │ ├── networkdatagram.py │ ├── networkinterface.py │ ├── networkproxy.py │ ├── networkreply.py │ ├── networkrequest.py │ ├── tcpserver.py │ ├── tcpsocket.py │ └── udpsocket.py ├── openglwidgets │ ├── __init__.py │ └── openglwidget.py ├── paths.py ├── pdf │ ├── __init__.py │ ├── pdfbookmarkmodel.py │ ├── pdfdocument.py │ └── pdfsearchmodel.py ├── pdfwidgets │ ├── __init__.py │ └── pdfview.py ├── positioning │ ├── __init__.py │ ├── geoaddress.py │ ├── geoareamonitorinfo.py │ ├── geoareamonitorsource.py │ ├── geocircle.py │ ├── geocoordinate.py │ ├── geolocation.py │ ├── geopath.py │ ├── geopolygon.py │ ├── geopositioninfo.py │ ├── geopositioninfosource.py │ ├── georectangle.py │ ├── geosatelliteinfo.py │ ├── geosatelliteinfosource.py │ ├── geoshape.py │ └── nmeapositioninginfosource.py ├── prettyqtmarkdown │ ├── __init__.py │ ├── markdownmodel.py │ ├── markdownwidget.py │ ├── mkitemmodeltable.py │ ├── mkprettyqtclasspage.py │ ├── mkprettyqtdiagram.py │ ├── mkpropertytable.py │ ├── mkwidgetscreenshot.py │ └── qtlinkprovider.py ├── printsupport │ ├── __init__.py │ ├── abstractprintdialog.py │ ├── pagesetupdialog.py │ ├── printdialog.py │ ├── printengine.py │ ├── printer.py │ ├── printpreviewdialog.py │ └── printpreviewwidget.py ├── py.typed ├── qml │ ├── __init__.py │ ├── jsengine.py │ ├── jsvalue.py │ ├── jsvalueiterator.py │ ├── qmlapplicationengine.py │ ├── qmlcomponent.py │ ├── qmlengine.py │ ├── qmlerror.py │ ├── qmlexpression.py │ ├── qmlimageproviderbase.py │ ├── qmlparserstatus.py │ ├── qmlproperty.py │ └── qmlpropertymap.py ├── qt │ ├── Qsci │ │ └── __init__.py │ ├── QtAsyncio │ │ └── __init__.py │ ├── QtBluetooth │ │ └── __init__.py │ ├── QtCharts │ │ └── __init__.py │ ├── QtCore │ │ └── __init__.py │ ├── QtDesigner │ │ └── __init__.py │ ├── QtGui │ │ └── __init__.py │ ├── QtHelp │ │ └── __init__.py │ ├── QtLocation │ │ └── __init__.py │ ├── QtMultimedia │ │ └── __init__.py │ ├── QtMultimediaWidgets │ │ └── __init__.py │ ├── QtNetwork │ │ └── __init__.py │ ├── QtOpenGLWidgets │ │ └── __init__.py │ ├── QtPdf │ │ └── __init__.py │ ├── QtPdfWidgets │ │ └── __init__.py │ ├── QtPositioning │ │ └── __init__.py │ ├── QtPrintSupport │ │ └── __init__.py │ ├── QtQml │ │ └── __init__.py │ ├── QtQuick │ │ └── __init__.py │ ├── QtQuickWidgets │ │ └── __init__.py │ ├── QtScxml │ │ └── __init__.py │ ├── QtSpatialAudio │ │ └── __init__.py │ ├── QtStateMachine │ │ └── __init__.py │ ├── QtSvg │ │ └── __init__.py │ ├── QtSvgWidgets │ │ └── __init__.py │ ├── QtTest │ │ └── __init__.py │ ├── QtTextToSpeech │ │ └── __init__.py │ ├── QtUiTools │ │ └── __init__.py │ ├── QtWebChannel │ │ └── __init__.py │ ├── QtWebEngineCore │ │ └── __init__.py │ ├── QtWebEngineWidgets │ │ └── __init__.py │ ├── QtWidgets │ │ └── __init__.py │ └── __init__.py ├── qthelp │ ├── __init__.py │ ├── helpcontentitem.py │ ├── helpcontentmodel.py │ ├── helpcontentwidget.py │ ├── helpengine.py │ ├── helpenginecore.py │ ├── helpfilterdata.py │ ├── helpfilterengine.py │ ├── helpfiltersettingswidget.py │ ├── helpindexmodel.py │ ├── helpindexwidget.py │ ├── helplink.py │ ├── helpsearchengine.py │ ├── helpsearchquerywidget.py │ ├── helpsearchresult.py │ └── helpsearchresultwidget.py ├── qtre.py ├── quick │ ├── __init__.py │ ├── quickasyncimageprovider.py │ ├── quickimageprovider.py │ ├── quickimageresponse.py │ ├── quickitem.py │ ├── quickitemgrabresult.py │ ├── quickpainteditem.py │ ├── quickrendercontrol.py │ ├── quicktextdocument.py │ ├── quickview.py │ ├── quickwindow.py │ └── sgnode.py ├── quickwidgets │ ├── __init__.py │ └── quickwidget.py ├── resources │ ├── close_black.svg │ ├── close_white.svg │ └── themes │ │ └── darktheme.qss ├── scintilla │ ├── __init__.py │ └── sciscintilla.py ├── scxml │ ├── __init__.py │ ├── scxmlcompiler.py │ ├── scxmlcppdatamodel.py │ ├── scxmldatamodel.py │ ├── scxmlinvokableservice.py │ ├── scxmlinvokableservicefactory.py │ ├── scxmlnulldatamodel.py │ └── scxmlstatemachine.py ├── spatialaudio │ ├── __init__.py │ ├── ambientsound.py │ ├── audioengine.py │ ├── audiolistener.py │ ├── audioroom.py │ └── spatialsound.py ├── statemachine │ ├── __init__.py │ ├── abstractstate.py │ ├── abstracttransition.py │ ├── eventtransition.py │ ├── finalstate.py │ ├── historystate.py │ ├── keyeventtransition.py │ ├── mouseeventtransition.py │ ├── signaltransition.py │ ├── state.py │ └── statemachine.py ├── svg │ ├── __init__.py │ ├── svggenerator.py │ └── svgrenderer.py ├── svgwidgets │ ├── __init__.py │ ├── graphicssvgitem.py │ └── svgwidget.py ├── syntaxhighlighters │ ├── __init__.py │ ├── baserulesyntaxhighlighter.py │ ├── custom_highlighters │ │ ├── __init__.py │ │ └── regularexpressionlexer.py │ ├── highlightrule.py │ ├── jsonhighlighter.py │ ├── markdownhighlighter.py │ ├── pygmentshighlighter.py │ ├── pygmentshighlighter_alt.py │ ├── pythonhighlighter.py │ ├── regexmatchhighlighter.py │ ├── selectedwordhighlighter.py │ └── yamlhighlighter.py ├── test │ ├── __init__.py │ ├── abstractitemmodeltester.py │ └── signalspy.py ├── texttospeech │ ├── __init__.py │ ├── texttospeech.py │ └── voice.py ├── utils │ ├── __init__.py │ ├── asyncrunner.py │ ├── baseresolver.py │ ├── classhelpers.py │ ├── colors.py │ ├── datatypes.py │ ├── debouncedsignal.py │ ├── fuzzy.py │ ├── helpers.py │ ├── listdelegators.py │ ├── modelhelpers.py │ ├── node.py │ ├── platforms │ │ ├── __init__.py │ │ └── windows │ │ │ ├── TaskbarLib.tlb │ │ │ ├── __init__.py │ │ │ ├── globalhotkeyeventfilter.py │ │ │ ├── keytables.py │ │ │ ├── misc.py │ │ │ ├── taskbaritem.py │ │ │ └── windoweffects.py │ ├── proxifier.py │ ├── proxystyles │ │ ├── __init__.py │ │ ├── centeredboxproxystyle.py │ │ └── materialiconstyle.py │ ├── serializemixin.py │ ├── signallogger.py │ ├── singleapplication.py │ ├── syncedproperty.py │ └── texteditselecter.py ├── validators │ ├── __init__.py │ ├── alphanumericvalidator.py │ ├── blacklistvalidator.py │ ├── colorvalidator.py │ ├── compositevalidator.py │ ├── functionvalidator.py │ ├── hexvalidator.py │ ├── integervalidator.py │ ├── jsonvalidator.py │ ├── monotoniclistvalidator.py │ ├── notstrictvalidator.py │ ├── pathvalidator.py │ ├── pythoncodevalidator.py │ ├── qssvalidator.py │ ├── regexpatternvalidator.py │ ├── regexvalidators.py │ ├── scientificvalidators.py │ ├── textlengthvalidator.py │ └── whitelistvalidator.py ├── webchannel │ ├── __init__.py │ └── webchannel.py ├── webenginecore │ ├── __init__.py │ ├── webenginecontextmenurequest.py │ ├── webenginedownloadrequest.py │ ├── webenginehistory.py │ ├── webenginehistoryitem.py │ ├── webenginehistorymodel.py │ ├── webenginehttprequest.py │ ├── webenginepage.py │ ├── webengineprofile.py │ ├── webenginescript.py │ ├── webenginescriptcollection.py │ ├── webenginesettings.py │ ├── webengineurlscheme.py │ └── webengineurlschemehandler.py ├── webenginewidgets │ ├── __init__.py │ └── webengineview.py └── widgets │ ├── __init__.py │ ├── abstractbutton.py │ ├── abstractgraphicsshapeitem.py │ ├── abstractitemdelegate.py │ ├── abstractitemview.py │ ├── abstractscrollarea.py │ ├── abstractslider.py │ ├── abstractspinbox.py │ ├── application.py │ ├── boxlayout.py │ ├── buttongroup.py │ ├── calendarwidget.py │ ├── checkbox.py │ ├── colordialog.py │ ├── columnview.py │ ├── combobox.py │ ├── commandlinkbutton.py │ ├── commonstyle.py │ ├── completer.py │ ├── datawidgetmapper.py │ ├── dateedit.py │ ├── datetimeedit.py │ ├── dial.py │ ├── dialog.py │ ├── dialogbuttonbox.py │ ├── dockwidget.py │ ├── doublespinbox.py │ ├── errormessage.py │ ├── filedialog.py │ ├── fileiconprovider.py │ ├── filesystemmodel.py │ ├── focusframe.py │ ├── fontcombobox.py │ ├── fontdialog.py │ ├── formlayout.py │ ├── frame.py │ ├── gesture.py │ ├── graphicsanchorlayout.py │ ├── graphicsblureffect.py │ ├── graphicscolorizeeffect.py │ ├── graphicsdropshadoweffect.py │ ├── graphicseffect.py │ ├── graphicsellipseitem.py │ ├── graphicsgridlayout.py │ ├── graphicsitem.py │ ├── graphicsitemgroup.py │ ├── graphicslayout.py │ ├── graphicslayoutitem.py │ ├── graphicslinearlayout.py │ ├── graphicslineitem.py │ ├── graphicsobject.py │ ├── graphicsopacityeffect.py │ ├── graphicspathitem.py │ ├── graphicspixmapitem.py │ ├── graphicspolygonitem.py │ ├── graphicsproxywidget.py │ ├── graphicsrectitem.py │ ├── graphicsrotation.py │ ├── graphicsscale.py │ ├── graphicsscene.py │ ├── graphicssimpletextitem.py │ ├── graphicstextitem.py │ ├── graphicstransform.py │ ├── graphicsview.py │ ├── graphicswidget.py │ ├── gridlayout.py │ ├── groupbox.py │ ├── hboxlayout.py │ ├── headerview.py │ ├── inputdialog.py │ ├── itemdelegate.py │ ├── itemeditorcreatorbase.py │ ├── itemeditorfactory.py │ ├── keysequenceedit.py │ ├── label.py │ ├── layout.py │ ├── layoutitem.py │ ├── lcdnumber.py │ ├── lineedit.py │ ├── listview.py │ ├── listwidget.py │ ├── listwidgetitem.py │ ├── mainwindow.py │ ├── mdiarea.py │ ├── mdisubwindow.py │ ├── menu.py │ ├── menubar.py │ ├── messagebox.py │ ├── pangesture.py │ ├── pinchgesture.py │ ├── plaintextdocumentlayout.py │ ├── plaintextedit.py │ ├── progressbar.py │ ├── progressdialog.py │ ├── proxystyle.py │ ├── pushbutton.py │ ├── radiobutton.py │ ├── rubberband.py │ ├── scrollarea.py │ ├── scrollbar.py │ ├── scroller.py │ ├── scrollerproperties.py │ ├── sizegrip.py │ ├── sizepolicy.py │ ├── slider.py │ ├── spaceritem.py │ ├── spinbox.py │ ├── splashscreen.py │ ├── splitter.py │ ├── splitterhandle.py │ ├── stackedlayout.py │ ├── stackedwidget.py │ ├── statusbar.py │ ├── style.py │ ├── styleditemdelegate.py │ ├── stylefactory.py │ ├── styleoption.py │ ├── styleoptionbutton.py │ ├── styleoptioncombobox.py │ ├── styleoptioncomplex.py │ ├── styleoptiondockwidget.py │ ├── styleoptionfocusrect.py │ ├── styleoptionframe.py │ ├── styleoptiongraphicsitem.py │ ├── styleoptiongroupbox.py │ ├── styleoptionheader.py │ ├── styleoptionmenuitem.py │ ├── styleoptionprogressbar.py │ ├── styleoptionrubberband.py │ ├── styleoptionsizegrip.py │ ├── styleoptionslider.py │ ├── styleoptionspinbox.py │ ├── styleoptiontab.py │ ├── styleoptiontabbarbase.py │ ├── styleoptiontabwidgetframe.py │ ├── styleoptiontitlebar.py │ ├── styleoptiontoolbar.py │ ├── styleoptiontoolbox.py │ ├── styleoptiontoolbutton.py │ ├── styleoptionviewitem.py │ ├── stylepainter.py │ ├── swipegesture.py │ ├── systemtrayicon.py │ ├── tabbar.py │ ├── tableview.py │ ├── tablewidget.py │ ├── tablewidgetitem.py │ ├── tablewidgetselectionrange.py │ ├── tabwidget.py │ ├── tapandholdgesture.py │ ├── tapgesture.py │ ├── textbrowser.py │ ├── textedit.py │ ├── timeedit.py │ ├── toolbar.py │ ├── toolbox.py │ ├── toolbutton.py │ ├── tooltip.py │ ├── treeview.py │ ├── treewidget.py │ ├── treewidgetitem.py │ ├── treewidgetitemiterator.py │ ├── undoview.py │ ├── vboxlayout.py │ ├── whatsthis.py │ ├── widget.py │ ├── widgetaction.py │ ├── widgetitem.py │ ├── wizard.py │ └── wizardpage.py ├── pyproject.toml ├── scripts ├── create_inv_file.py ├── create_screenshots.py ├── download_docs.py ├── download_lang_files.py ├── module_stats.py ├── parse_pyi.py ├── print_repr.py └── replace.py └── tests ├── __init__.py ├── conftest.py ├── qmltest.qml ├── test_animations.py ├── test_application.py ├── test_bluetooth.py ├── test_charts.py ├── test_core.py ├── test_custom_widgets.py ├── test_designer.py ├── test_gui.py ├── test_helpers.py ├── test_ipython.py ├── test_itemdelegates.py ├── test_itemmodels.py ├── test_location.py ├── test_multimedia.py ├── test_multimediawidgets.py ├── test_network.py ├── test_openglwidgets.py ├── test_pdf.py ├── test_pdfwidgets.py ├── test_positioning.py ├── test_printsupport.py ├── test_qml.py ├── test_qthelp.py ├── test_quick.py ├── test_quickwidgets.py ├── test_regexeditor.py ├── test_sciscintilla.py ├── test_scxml.py ├── test_statemachine.py ├── test_svg.py ├── test_svgwidgets.py ├── test_syntaxhighlighters.py ├── test_test.py ├── test_texttospeech.py ├── test_validators.py ├── test_webenginecore.py ├── test_webenginewidgets.py └── test_widgets.py /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | indent_style = space 7 | indent_size = 4 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | charset = utf-8 11 | end_of_line = lf 12 | 13 | [*.bat] 14 | indent_style = tab 15 | end_of_line = crlf 16 | 17 | [LICENSE] 18 | insert_final_newline = false 19 | 20 | [Makefile] 21 | indent_style = tab 22 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | * PrettyQt version: 2 | * Python version: 3 | * Operating System: 4 | 5 | ### Description 6 | 7 | Describe what you were trying to get done. 8 | Tell us what happened, what went wrong, and what you expected to happen. 9 | 10 | ### What I Did 11 | 12 | ``` 13 | Paste the command(s) you ran and the output. 14 | If there was a crash, please include the traceback here. 15 | ``` 16 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # Set update schedule for GitHub Actions 2 | 3 | version: 2 4 | updates: 5 | - package-ecosystem: "github-actions" 6 | directory: "/" 7 | schedule: 8 | # Check for updates to GitHub Actions every week 9 | interval: "weekly" 10 | -------------------------------------------------------------------------------- /AUTHORS.rst: -------------------------------------------------------------------------------- 1 | Credits 2 | ======= 3 | 4 | Development Lead 5 | ---------------- 6 | 7 | * Philipp Temminghoff 8 | 9 | Contributors 10 | ------------ 11 | 12 | None yet. Why not be the first? 13 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## Changelog can be found at [https://phil65.github.io/PrettyQt/changelog.html](https://phil65.github.io/PrettyQt/changelog.html) 2 | -------------------------------------------------------------------------------- /docs/gen_pages.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.docs import build_root, build_index 4 | 5 | import mknodes 6 | 7 | 8 | def build(project: mknodes.Project): 9 | root_nav = build_root.build_root(project) 10 | page = root_nav.add_index_page("Home", hide_nav=True) 11 | build_index.build_index(page) 12 | 13 | 14 | # from prettyqt import prettyqtmarkdown, widgets 15 | # app = widgets.app() 16 | # print(root_nav) 17 | # table = prettyqtmarkdown.MarkdownWidget() 18 | # table.set_markdown(root_nav) 19 | # table.show() 20 | # app.exec() 21 | -------------------------------------------------------------------------------- /docs/images/abstractitemmodelmixin_subclasses.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/docs/images/abstractitemmodelmixin_subclasses.png -------------------------------------------------------------------------------- /docs/images/actionsmodel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/docs/images/actionsmodel.png -------------------------------------------------------------------------------- /docs/images/annotatedscrollbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/docs/images/annotatedscrollbar.png -------------------------------------------------------------------------------- /docs/images/astmodel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/docs/images/astmodel.png -------------------------------------------------------------------------------- /docs/images/astviewer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/docs/images/astviewer.png -------------------------------------------------------------------------------- /docs/images/columnjoinerproxymodel_after.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/docs/images/columnjoinerproxymodel_after.png -------------------------------------------------------------------------------- /docs/images/columnjoinerproxymodel_before.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/docs/images/columnjoinerproxymodel_before.png -------------------------------------------------------------------------------- /docs/images/filterheader.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/docs/images/filterheader.png -------------------------------------------------------------------------------- /docs/images/flattentreeproxymodel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/docs/images/flattentreeproxymodel.png -------------------------------------------------------------------------------- /docs/images/flattentreeproxymodel_leaves_only.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/docs/images/flattentreeproxymodel_leaves_only.png -------------------------------------------------------------------------------- /docs/images/flattentreeproxymodel_path.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/docs/images/flattentreeproxymodel_path.png -------------------------------------------------------------------------------- /docs/images/flattentreeproxymodel_without.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/docs/images/flattentreeproxymodel_without.png -------------------------------------------------------------------------------- /docs/images/meltproxymodel_after.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/docs/images/meltproxymodel_after.png -------------------------------------------------------------------------------- /docs/images/meltproxymodel_before.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/docs/images/meltproxymodel_before.png -------------------------------------------------------------------------------- /docs/images/slicechangeflagsproxymodel_after.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/docs/images/slicechangeflagsproxymodel_after.png -------------------------------------------------------------------------------- /docs/images/slicechangeflagsproxymodel_before.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/docs/images/slicechangeflagsproxymodel_before.png -------------------------------------------------------------------------------- /docs/images/slicechangeiconsizeproxymodel_after.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/docs/images/slicechangeiconsizeproxymodel_after.png -------------------------------------------------------------------------------- /docs/images/slicechangeiconsizeproxymodel_before.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/docs/images/slicechangeiconsizeproxymodel_before.png -------------------------------------------------------------------------------- /docs/images/slicecolorvaluesproxymodel_after.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/docs/images/slicecolorvaluesproxymodel_after.png -------------------------------------------------------------------------------- /docs/images/slicecolorvaluesproxymodel_before.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/docs/images/slicecolorvaluesproxymodel_before.png -------------------------------------------------------------------------------- /docs/images/slicehighlightcurrentproxymodel_all.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/docs/images/slicehighlightcurrentproxymodel_all.png -------------------------------------------------------------------------------- /docs/images/slicehighlightcurrentproxymodel_column.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/docs/images/slicehighlightcurrentproxymodel_column.png -------------------------------------------------------------------------------- /docs/images/slicehighlightcurrentproxymodel_none.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/docs/images/slicehighlightcurrentproxymodel_none.png -------------------------------------------------------------------------------- /docs/images/slicehighlightcurrentproxymodel_row.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/docs/images/slicehighlightcurrentproxymodel_row.png -------------------------------------------------------------------------------- /docs/images/tabletolistproxymodel_after.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/docs/images/tabletolistproxymodel_after.png -------------------------------------------------------------------------------- /docs/images/tabletolistproxymodel_before.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/docs/images/tabletolistproxymodel_before.png -------------------------------------------------------------------------------- /docs/images/treewidget_mro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/docs/images/treewidget_mro.png -------------------------------------------------------------------------------- /docs/images/treewidget_parentclasses.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/docs/images/treewidget_parentclasses.png -------------------------------------------------------------------------------- /docs/javascripts/tablesort.js: -------------------------------------------------------------------------------- 1 | document$.subscribe(function() { 2 | var tables = document.querySelectorAll("article table:not([class])") 3 | tables.forEach(function(table) { 4 | new Tablesort(table) 5 | }) 6 | }) 7 | -------------------------------------------------------------------------------- /docs/overrides/dummy.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/docs/overrides/dummy.txt -------------------------------------------------------------------------------- /docs/qt6.inv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/docs/qt6.inv -------------------------------------------------------------------------------- /prettyqt/__pyinstaller/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | import pathlib 4 | 5 | 6 | def get_hook_dirs(): 7 | return [str(pathlib.Path(__file__).parent)] 8 | # return [str(pathlib.Path(__file__).parent)] 9 | -------------------------------------------------------------------------------- /prettyqt/__pyinstaller/hook-prettyqt.py: -------------------------------------------------------------------------------- 1 | # This is a PyInstaller `hook # noqa: N999 2 | # `_. 3 | # See the `PyInstaller manual `_ 4 | # for more information. 5 | # 6 | from __future__ import annotations 7 | 8 | from PyInstaller.utils.hooks import collect_data_files 9 | 10 | 11 | # For more information see 12 | # `hook global variables 13 | # `_ 14 | # in the manual for more information. 15 | 16 | # hiddenimports = ["pyi_hooksample._hidden"] 17 | # The ``excludes`` parameter of `collect_data_files 18 | # `_ 19 | # excludes ``rthooks.dat`` from the frozen executable, which is only needed when 20 | # freezeing, but not when executing the frozen program. 21 | datas = collect_data_files("prettyqt", excludes=["__pyinstaller"]) 22 | -------------------------------------------------------------------------------- /prettyqt/bluetooth/bluetoothaddress.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt import QtBluetooth 4 | from prettyqt.utils import get_repr 5 | 6 | 7 | class BluetoothAddress(QtBluetooth.QBluetoothAddress): 8 | """Assigns an address to the Bluetooth device.""" 9 | 10 | def __repr__(self): 11 | return get_repr(self, self.toString()) 12 | 13 | def __str__(self): 14 | return self.toString() 15 | 16 | def __bool__(self): 17 | """True when address is not null.""" 18 | return not self.isNull() 19 | 20 | 21 | if __name__ == "__main__": 22 | address = BluetoothAddress() 23 | -------------------------------------------------------------------------------- /prettyqt/bluetooth/bluetoothhostinfo.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import bluetooth 4 | 5 | 6 | class BluetoothHostInfo(bluetooth.QBluetoothHostInfo): 7 | """Encapsulates the details of a local QBluetooth device.""" 8 | 9 | def set_address(self, address: bluetooth.QBluetoothAddress | int | str): 10 | """Set address to given value.""" 11 | if isinstance(address, int | str): 12 | address = bluetooth.QBluetoothAddress(address) 13 | self.setAddress(address) 14 | 15 | def get_address(self) -> bluetooth.BluetoothAddress: 16 | """Get address.""" 17 | return bluetooth.BluetoothAddress(self.address()) 18 | 19 | 20 | if __name__ == "__main__": 21 | address = BluetoothHostInfo() 22 | -------------------------------------------------------------------------------- /prettyqt/charts/abstractseries.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | from prettyqt.qt import QtCharts 5 | 6 | 7 | class AbstractSeriesMixin(core.ObjectMixin): 8 | pass 9 | 10 | 11 | class AbstractSeries(AbstractSeriesMixin, QtCharts.QAbstractSeries): 12 | pass 13 | -------------------------------------------------------------------------------- /prettyqt/charts/barcategoryaxis.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import charts 4 | 5 | 6 | class BarCategoryAxis(charts.AbstractAxisMixin, charts.QBarCategoryAxis): 7 | def __delitem__(self, index: str): 8 | """Remove category.""" 9 | self.remove(index) 10 | 11 | def __getitem__(self, index: int) -> str: 12 | """Return category for given index.""" 13 | return self.categories()[index] 14 | 15 | def __setitem__(self, index: str, value: str): 16 | """Set category at given index to value.""" 17 | self.replace(index, value) 18 | 19 | def __add__(self, other: str) -> BarCategoryAxis: 20 | """Append another category to axis.""" 21 | self.append(other) 22 | return self 23 | -------------------------------------------------------------------------------- /prettyqt/charts/barseries.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import charts 4 | 5 | 6 | class BarSeries(charts.AbstractBarSeriesMixin, charts.QBarSeries): 7 | pass 8 | -------------------------------------------------------------------------------- /prettyqt/charts/candlestickset.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core, gui 4 | from prettyqt.qt import QtCharts 5 | from prettyqt.utils import get_repr 6 | 7 | 8 | class CandlestickSet(core.ObjectMixin, QtCharts.QCandlestickSet): 9 | def __repr__(self): 10 | return get_repr( 11 | self, self.open(), self.high(), self.low(), self.close(), self.timestamp() 12 | ) 13 | 14 | def get_pen(self) -> gui.Pen: 15 | return gui.Pen(self.pen()) 16 | 17 | def get_brush(self) -> gui.Brush: 18 | return gui.Brush(self.brush()) 19 | 20 | 21 | if __name__ == "__main__": 22 | candlestickset = CandlestickSet(1, 3, 0, 2) 23 | -------------------------------------------------------------------------------- /prettyqt/charts/horizontalbarseries.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import charts 4 | 5 | 6 | class HorizontalBarSeries(charts.AbstractBarSeriesMixin, charts.QHorizontalBarSeries): 7 | pass 8 | -------------------------------------------------------------------------------- /prettyqt/charts/horizontalpercentbarseries.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import charts 4 | 5 | 6 | class HorizontalPercentBarSeries( 7 | charts.AbstractBarSeriesMixin, charts.QHorizontalPercentBarSeries 8 | ): 9 | pass 10 | -------------------------------------------------------------------------------- /prettyqt/charts/horizontalstackedbarseries.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import charts 4 | 5 | 6 | class HorizontalStackedBarSeries( 7 | charts.AbstractBarSeriesMixin, charts.QHorizontalStackedBarSeries 8 | ): 9 | pass 10 | -------------------------------------------------------------------------------- /prettyqt/charts/lineseries.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import charts 4 | 5 | 6 | class LineSeries(charts.XYSeriesMixin, charts.QLineSeries): 7 | """QLineSeries with some custom properties.""" 8 | 9 | 10 | if __name__ == "__main__": 11 | from prettyqt.qt import QtCore 12 | 13 | line = LineSeries() 14 | line += QtCore.QPointF(1, 1) 15 | -------------------------------------------------------------------------------- /prettyqt/charts/logvalueaxis.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import charts 4 | 5 | 6 | class LogValueAxis(charts.AbstractAxisMixin, charts.QLogValueAxis): 7 | pass 8 | -------------------------------------------------------------------------------- /prettyqt/charts/percentbarseries.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import charts 4 | 5 | 6 | class PercentBarSeries(charts.AbstractBarSeriesMixin, charts.QPercentBarSeries): 7 | pass 8 | -------------------------------------------------------------------------------- /prettyqt/charts/polarchart.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from typing import Literal 4 | 5 | from prettyqt import charts 6 | from prettyqt.utils import bidict 7 | 8 | 9 | PolarOrientationStr = Literal["radial", "angular"] 10 | 11 | POLAR_ORIENTATIONS: bidict[PolarOrientationStr, charts.QPolarChart.PolarOrientation] = ( 12 | bidict( 13 | radial=charts.QPolarChart.PolarOrientation.PolarOrientationRadial, 14 | angular=charts.QPolarChart.PolarOrientation.PolarOrientationAngular, 15 | ) 16 | ) 17 | 18 | 19 | class PolarChart(charts.ChartMixin, charts.QPolarChart): 20 | def add_axis( 21 | self, 22 | axis: charts.QAbstractAxis, 23 | orientation: PolarOrientationStr | charts.QPolarChart.PolarOrientation, 24 | ): 25 | """Add axis with given orientation.""" 26 | self.addAxis(axis, POLAR_ORIENTATIONS.get_enum_value(orientation)) 27 | -------------------------------------------------------------------------------- /prettyqt/charts/scatterseries.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import charts 4 | 5 | 6 | class ScatterSeries(charts.XYSeriesMixin, charts.QScatterSeries): 7 | pass 8 | -------------------------------------------------------------------------------- /prettyqt/charts/stackedbarseries.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import charts 4 | 5 | 6 | class StackedBarSeries(charts.AbstractBarSeriesMixin, charts.QStackedBarSeries): 7 | pass 8 | -------------------------------------------------------------------------------- /prettyqt/core/abstracteventdispatcher.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | 5 | 6 | class AbstractEventDispatcher(core.ObjectMixin, core.QAbstractEventDispatcher): 7 | """Interface to manage Qt's event queue.""" 8 | -------------------------------------------------------------------------------- /prettyqt/core/abstractlistmodel.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | 5 | 6 | class AbstractListModelMixin(core.AbstractItemModelMixin): 7 | pass 8 | 9 | 10 | class AbstractListModel(AbstractListModelMixin, core.QAbstractListModel): 11 | """Abstract model that can be subclassed to create one-dimensional list models.""" 12 | -------------------------------------------------------------------------------- /prettyqt/core/abstractnativeeventfilter.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt import QtCore 4 | 5 | 6 | class AbstractNativeEventFilter(QtCore.QAbstractNativeEventFilter): 7 | """Interface for receiving native events, such as MSG or XCB event structs.""" 8 | 9 | def install(self): 10 | # theres also QCoreApplication::installNativeEventFilter. Not sure abt difference 11 | QtCore.QAbstractEventDispatcher.instance().installNativeEventFilter(self) 12 | -------------------------------------------------------------------------------- /prettyqt/core/abstracttablemodel.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import constants, core 4 | 5 | 6 | class AbstractTableModelMixin(core.AbstractItemModelMixin): 7 | DEFAULT_FLAGS = ( 8 | constants.DRAG_ENABLED 9 | | constants.IS_ENABLED 10 | | constants.IS_SELECTABLE 11 | | constants.NO_CHILDREN 12 | ) 13 | 14 | 15 | class AbstractTableModel(AbstractTableModelMixin, core.QAbstractTableModel): 16 | """Abstract model that can be subclassed to create table models.""" 17 | 18 | 19 | if __name__ == "__main__": 20 | from prettyqt import itemmodels, widgets 21 | 22 | app = widgets.app() 23 | model = itemmodels.QObjectPropertiesModel(app) 24 | table = widgets.TableView() 25 | table.set_model(model) 26 | print(model.to_markdown()) 27 | -------------------------------------------------------------------------------- /prettyqt/core/basictimer.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import constants, core 4 | 5 | 6 | class BasicTimer(core.QBasicTimer): 7 | """Timer events for objects.""" 8 | 9 | def __bool__(self): 10 | return self.isActive() 11 | 12 | def start_timer( 13 | self, msec: int, obj: core.QObject, timer_type: constants.TimerTypeStr 14 | ): 15 | self.start(msec, constants.TIMER_TYPE.get_enum_value(timer_type), obj) 16 | -------------------------------------------------------------------------------- /prettyqt/core/buffer.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | 5 | 6 | class Buffer(core.IODeviceMixin, core.QBuffer): 7 | """QIODevice interface for a QByteArray.""" 8 | -------------------------------------------------------------------------------- /prettyqt/core/bytearray.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt import QtCore 4 | 5 | 6 | class ByteArray(QtCore.QByteArray): 7 | """Array of bytes.""" 8 | 9 | def __reduce__(self): 10 | return type(self), (bytes(self),) 11 | -------------------------------------------------------------------------------- /prettyqt/core/bytearraymatcher.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt import QtCore 4 | from prettyqt.utils import get_repr 5 | 6 | 7 | class ByteArrayMatcher(QtCore.QByteArrayMatcher): 8 | """Holds a sequence of bytes that can be quickly matched in a byte array.""" 9 | 10 | def __repr__(self): 11 | return get_repr(self, self.get_pattern()) 12 | 13 | def get_pattern(self) -> bytes: 14 | return bytes(self.pattern()) 15 | 16 | 17 | if __name__ == "__main__": 18 | matcher = ByteArrayMatcher(QtCore.QByteArray(b"Test")) 19 | -------------------------------------------------------------------------------- /prettyqt/core/collatorsortkey.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt import QtCore 4 | 5 | 6 | class CollatorSortKey(QtCore.QCollatorSortKey): 7 | """Can be used to speed up string collation.""" 8 | -------------------------------------------------------------------------------- /prettyqt/core/commandlineoption.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from typing import Literal 4 | 5 | from prettyqt import core 6 | from prettyqt.utils import bidict 7 | 8 | 9 | FlagStr = Literal["hidden_from_help", "short_option_style"] 10 | 11 | FLAGS: bidict[FlagStr, core.QCommandLineOption.Flag] = bidict( 12 | hidden_from_help=core.QCommandLineOption.Flag.HiddenFromHelp, 13 | short_option_style=core.QCommandLineOption.Flag.ShortOptionStyle, 14 | ) 15 | 16 | 17 | class CommandLineOption(core.QCommandLineOption): 18 | """Defines a possible command-line option.""" 19 | -------------------------------------------------------------------------------- /prettyqt/core/concatenatetablesproxymodel.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core, qt 4 | 5 | 6 | class ConcatenateTablesProxyModel( 7 | core.AbstractItemModelMixin, core.QConcatenateTablesProxyModel 8 | ): 9 | """Proxies multiple source models, concatenating their rows.""" 10 | 11 | ID = "concatenate" 12 | 13 | def parent(self, *args): 14 | # workaround: PyQt6 QConcatenateTablesProxyModel.parent() missing 15 | if not args and qt.API == "pyqt6": 16 | return core.QAbstractItemModel.parent(self) 17 | return super().parent(*args) 18 | -------------------------------------------------------------------------------- /prettyqt/core/deadlinetimer.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import constants 4 | from prettyqt.qt import QtCore 5 | 6 | 7 | class DeadlineTimer(QtCore.QDeadlineTimer): 8 | """Marks a deadline in the future.""" 9 | 10 | def set_type(self, typ: constants.TimerTypeStr | constants.TimerType): 11 | """Set the timer type. 12 | 13 | Args: 14 | typ: timer type 15 | """ 16 | self.setTimerType(constants.TIMER_TYPE.get_enum_value(typ)) 17 | 18 | def get_type(self) -> constants.TimerTypeStr: 19 | """Return current timer type. 20 | 21 | Returns: 22 | timer type 23 | """ 24 | return constants.TIMER_TYPE.inverse[self.timerType()] 25 | -------------------------------------------------------------------------------- /prettyqt/core/file.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | 5 | 6 | class FileMixin(core.FileDeviceMixin): 7 | pass 8 | 9 | 10 | class File(FileMixin, core.QFile): 11 | """Interface for reading from and writing to files.""" 12 | -------------------------------------------------------------------------------- /prettyqt/core/fileselector.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | import os 4 | from typing import TYPE_CHECKING 5 | 6 | from prettyqt import core 7 | 8 | 9 | if TYPE_CHECKING: 10 | from prettyqt.utils import datatypes 11 | 12 | 13 | class FileSelector(core.ObjectMixin, core.QFileSelector): 14 | """Convenient way of selecting file variants.""" 15 | 16 | def select_path(self, path: datatypes.PathType) -> str: 17 | return self.select(os.fspath(path)) 18 | 19 | def select_url(self, url: datatypes.UrlType) -> core.Url: 20 | if isinstance(url, str): 21 | url = core.QUrl(url) 22 | return core.Url(self.select(url)) 23 | -------------------------------------------------------------------------------- /prettyqt/core/identityproxymodel.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | 5 | 6 | class IdentityProxyModel(core.AbstractProxyModelMixin, core.QIdentityProxyModel): 7 | """Proxies its source model unmodified.""" 8 | 9 | ID = "identity" 10 | -------------------------------------------------------------------------------- /prettyqt/core/itemselection.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt import QtCore 4 | 5 | 6 | class ItemSelection(QtCore.QItemSelection): 7 | """Manages information about selected items in a model.""" 8 | -------------------------------------------------------------------------------- /prettyqt/core/itemselectionrange.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from typing import TYPE_CHECKING 4 | 5 | from prettyqt import core 6 | 7 | 8 | if TYPE_CHECKING: 9 | from collections.abc import Iterator 10 | 11 | 12 | class ItemSelectionRange(core.QItemSelectionRange): 13 | """Manages information about a range of selected items in a model.""" 14 | 15 | def __contains__(self, other: core.ModelIndex): 16 | return self.contains(other) 17 | 18 | def __bool__(self): 19 | return not self.isEmpty() 20 | 21 | def __iter__(self) -> Iterator[core.ModelIndex]: 22 | return iter(self.indexes()) # type: ignore 23 | 24 | def __len__(self): 25 | return len(self.indexes()) 26 | 27 | def __and__(self, other: core.QItemSelectionRange): 28 | return self.intersected(other) 29 | 30 | 31 | if __name__ == "__main__": 32 | temp = ItemSelectionRange() 33 | temp2 = ItemSelectionRange() 34 | temp3 = temp & temp2 35 | -------------------------------------------------------------------------------- /prettyqt/core/jsonvalue.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt import QtCore 4 | from prettyqt.utils import get_repr 5 | 6 | 7 | class JsonValue(QtCore.QJsonValue): 8 | """Encapsulates a value in JSON.""" 9 | 10 | def __str__(self): 11 | return str(self.toVariant()) 12 | 13 | def __repr__(self): 14 | return get_repr(self, self.toVariant()) 15 | 16 | 17 | if __name__ == "__main__": 18 | from prettyqt import core 19 | 20 | doc = core.JsonDocument.from_variant(dict(a="b")) 21 | new = core.JsonDocument() 22 | new.setObject(doc.object()) 23 | val = doc["a"] 24 | -------------------------------------------------------------------------------- /prettyqt/core/mimetype.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt import QtCore 4 | from prettyqt.utils import get_repr 5 | 6 | 7 | class MimeType(QtCore.QMimeType): 8 | """Describes types of file or data, represented by a MIME type string.""" 9 | 10 | def __bool__(self): 11 | return self.isValid() 12 | 13 | def __repr__(self): 14 | return get_repr(self, self.name()) 15 | 16 | def __str__(self): 17 | return self.name() 18 | -------------------------------------------------------------------------------- /prettyqt/core/modelindex.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt import QtCore 4 | 5 | 6 | class ModelIndex(QtCore.QModelIndex): 7 | """Used to locate data in a data model.""" 8 | 9 | def __getitem__(self, flag: int): 10 | return self.data(flag) 11 | -------------------------------------------------------------------------------- /prettyqt/core/modelroledata.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt import QtCore 4 | 5 | 6 | class ModelRoleData(QtCore.QModelRoleData): 7 | """Holds a role and the data associated to that role.""" 8 | -------------------------------------------------------------------------------- /prettyqt/core/mutex.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | import contextlib 4 | 5 | from prettyqt.qt import QtCore 6 | 7 | 8 | class Mutex(QtCore.QMutex): 9 | """Access serialization between threads.""" 10 | 11 | @contextlib.contextmanager 12 | def lock_mutex(self, timeout: int | None = None): 13 | if timeout is None: 14 | timeout = -1 15 | yield self.tryLock(timeout) 16 | self.unlock() 17 | -------------------------------------------------------------------------------- /prettyqt/core/parallelanimationgroup.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | 5 | 6 | class ParallelAnimationGroup(core.AnimationGroupMixin, core.QParallelAnimationGroup): 7 | """Parallel group of animations.""" 8 | 9 | def set_duration(self, duration: int): 10 | for anim in self: 11 | match anim: 12 | # I dont think we need to support nested Animations here.. 13 | case core.QVariantAnimation(): 14 | anim.setDuration(duration) 15 | case _: 16 | msg = "set_duration only works with QVariantAnimations." 17 | raise TypeError(msg) 18 | -------------------------------------------------------------------------------- /prettyqt/core/pauseanimation.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | from prettyqt.utils import get_repr 5 | 6 | 7 | class PauseAnimation(core.AbstractAnimationMixin, core.QPauseAnimation): 8 | """Pause for QSequentialAnimationGroup.""" 9 | 10 | def __repr__(self): 11 | return get_repr(self, self.duration()) 12 | -------------------------------------------------------------------------------- /prettyqt/core/persistentmodelindex.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt import QtCore 4 | 5 | 6 | class PersistentModelIndex(QtCore.QPersistentModelIndex): 7 | """Used to locate data in a data model.""" 8 | 9 | def __bool__(self): 10 | return self.isValid() 11 | 12 | def __getitem__(self, flag: int): 13 | return self.data(flag) 14 | 15 | 16 | if __name__ == "__main__": 17 | index = PersistentModelIndex() 18 | -------------------------------------------------------------------------------- /prettyqt/core/pluginloader.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | 5 | 6 | class PluginLoader(core.ObjectMixin, core.QPluginLoader): 7 | """Load a plugin at runtime.""" 8 | 9 | def get_load_hints(self) -> list[core.library.LoadHintStr]: 10 | return core.library.LOAD_HINTS.get_list(self.loadHints()) 11 | 12 | def set_load_hints(self, **kwargs): 13 | flag = core.QLibrary.LoadHint(0) # type: ignore 14 | for k, v in kwargs.items(): 15 | if v is True: 16 | flag |= core.library.LOAD_HINTS[k] # type: ignore 17 | self.setLoadHints(flag) # type: ignore 18 | -------------------------------------------------------------------------------- /prettyqt/core/property.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt import QtCore 4 | 5 | 6 | class Property(QtCore.Property): 7 | """Template class that enables automatic property bindings.""" 8 | 9 | def __init__(self, *args, **kwargs): 10 | self.doc = kwargs.get("doc") 11 | super().__init__(*args, **kwargs) 12 | 13 | @classmethod 14 | def get_doc_dict(cls, klass: type): 15 | import inspect 16 | 17 | return { 18 | name: member.doc 19 | for name, member in inspect.getmembers(klass) 20 | if isinstance(member, cls) and hasattr(member, "doc") 21 | } 22 | 23 | 24 | if __name__ == "__main__": 25 | prop = Property(int) 26 | -------------------------------------------------------------------------------- /prettyqt/core/randomgenerator.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt import QtCore 4 | 5 | 6 | class RandomGenerator(QtCore.QRandomGenerator): 7 | """Allows one to obtain random values from a high-quality Random Number Generator.""" 8 | -------------------------------------------------------------------------------- /prettyqt/core/randomgenerator64.py: -------------------------------------------------------------------------------- 1 | # from prettyqt import core 2 | 3 | 4 | from __future__ import annotations 5 | 6 | 7 | # QtCore.QRandomGenerator64.__bases__ = (core.RandomGenerator,) 8 | 9 | # class RandomGenerator64(QtCore.QRandomGenerator64): 10 | # pass 11 | -------------------------------------------------------------------------------- /prettyqt/core/rectf.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt import QtCore 4 | from prettyqt.utils import get_repr 5 | 6 | 7 | class RectF(QtCore.QRectF): 8 | """Defines a finite rectangle in the plane using floating point precision.""" 9 | 10 | def __repr__(self): 11 | return get_repr(self, self.x(), self.y(), self.width(), self.height()) 12 | 13 | @property 14 | def _x(self) -> float: 15 | return self.x() 16 | 17 | @property 18 | def _y(self) -> float: 19 | return self.y() 20 | 21 | @property 22 | def _width(self) -> float: 23 | return self.width() 24 | 25 | @property 26 | def _height(self) -> float: 27 | return self.height() 28 | 29 | __match_args__ = ("_x", "_y", "width", "height") 30 | 31 | def __reduce__(self): 32 | return type(self), (self.x(), self.y(), self.width(), self.height()) 33 | 34 | 35 | if __name__ == "__main__": 36 | rect = RectF(0, 2, 5, 5) 37 | print(repr(rect)) 38 | -------------------------------------------------------------------------------- /prettyqt/core/regularexpressionmatchiterator.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | from prettyqt.utils import get_repr 5 | 6 | 7 | class RegularExpressionMatchIterator(core.QRegularExpressionMatchIterator): 8 | """Iterator on the results of a global match of a QRegularExpression.""" 9 | 10 | def __repr__(self): 11 | return get_repr(self) 12 | 13 | def __iter__(self): 14 | return self 15 | 16 | def __next__(self): 17 | if self.hasNext(): 18 | return core.RegularExpressionMatch(self.next()) 19 | raise StopIteration 20 | 21 | def peek_next(self) -> core.RegularExpressionMatch: 22 | return core.RegularExpressionMatch(self.peekNext()) 23 | 24 | 25 | if __name__ == "__main__": 26 | reg = RegularExpressionMatchIterator() 27 | -------------------------------------------------------------------------------- /prettyqt/core/runnable.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt import QtCore 4 | 5 | 6 | class Runnable(QtCore.QRunnable): 7 | """The base class for all runnable objects.""" 8 | -------------------------------------------------------------------------------- /prettyqt/core/savefile.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | 5 | 6 | class SaveFile(core.FileDeviceMixin, core.QSaveFile): 7 | """Interface for safely writing to files.""" 8 | -------------------------------------------------------------------------------- /prettyqt/core/semaphore.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | import contextlib 4 | from typing import TYPE_CHECKING 5 | 6 | from prettyqt.qt import QtCore 7 | 8 | 9 | if TYPE_CHECKING: 10 | from collections.abc import Generator 11 | 12 | 13 | class Semaphore(QtCore.QSemaphore): 14 | """General counting semaphore.""" 15 | 16 | @contextlib.contextmanager 17 | def acquire_resources(self, n: int = 1) -> Generator[bool, None, None]: 18 | yield self.tryAcquire(n) 19 | self.release(n) 20 | -------------------------------------------------------------------------------- /prettyqt/core/signalblocker.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt import QtCore 4 | 5 | 6 | class SignalBlocker(QtCore.QSignalBlocker): 7 | """Exception-safe wrapper around QObject.blockSignals().""" 8 | -------------------------------------------------------------------------------- /prettyqt/core/signalmapper.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | 5 | 6 | class SignalMapper(core.ObjectMixin, core.QSignalMapper): 7 | """Bundles signals from identifiable senders.""" 8 | 9 | def __getitem__(self, index: int | str | core.QObject) -> core.QObject: 10 | return self.mapping(index) 11 | 12 | def __delitem__(self, index: core.QObject): 13 | return self.removeMappings(index) 14 | 15 | def __setitem__(self, index: core.QObject, value: int | str | core.QObject): 16 | self.setMapping(index, value) 17 | 18 | 19 | if __name__ == "__main__": 20 | from prettyqt import widgets 21 | 22 | app = widgets.app() 23 | widget = widgets.Widget() 24 | mapper = SignalMapper() 25 | mapper[widget] = 1 26 | del mapper[widget] 27 | -------------------------------------------------------------------------------- /prettyqt/core/stringlistmodel.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | 5 | 6 | class StringListModelMixin(core.AbstractListModelMixin): 7 | pass 8 | 9 | 10 | class StringListModel(StringListModelMixin, core.QStringListModel): 11 | """Model that supplies strings to views.""" 12 | 13 | def __repr__(self): 14 | return f"{type(self).__name__}: ({self.rowCount()})" 15 | 16 | def columnCount(self, parent: core.ModelIndex | None = None) -> int: 17 | # columnCount is private for StringListModel, but we need it 18 | # to avoid workarounds (for example in our Slice proxies). 19 | # So lets just return 1. 20 | return 1 21 | 22 | @classmethod 23 | def supports(cls, instance) -> bool: 24 | match instance: 25 | case (str(), *_): 26 | return True 27 | case _: 28 | return False 29 | -------------------------------------------------------------------------------- /prettyqt/core/temporaryfile.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | 5 | 6 | class TemporaryFile(core.FileMixin, core.QTemporaryFile): 7 | """I/O device that operates on temporary files.""" 8 | -------------------------------------------------------------------------------- /prettyqt/core/transposeproxymodel.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | 5 | 6 | class TransposeProxyModel(core.AbstractProxyModelMixin, core.QTransposeProxyModel): 7 | """This proxy transposes the source model.""" 8 | 9 | ID = "transpose" 10 | -------------------------------------------------------------------------------- /prettyqt/custom_network/__init__.py: -------------------------------------------------------------------------------- 1 | """custom_network package.""" 2 | -------------------------------------------------------------------------------- /prettyqt/custom_widgets/editors/__init__.py: -------------------------------------------------------------------------------- 1 | """All editors adhere to a get/set_value interface + value_changed signal. 2 | 3 | Additional "core" editors: 4 | - LineEdit 5 | - DoubleSlider 6 | - Slider 7 | - FontComboBox 8 | - ComboBox 9 | - CheckBox 10 | - PushButton 11 | - CalendarWidget 12 | - DateEdit 13 | - DateTimeEdit 14 | - TimeEdit 15 | - Dial 16 | - SpinBox 17 | - DoubleSpinBox 18 | - KeySequenceEdit 19 | - LCDNumber 20 | - ListWidget 21 | - PlainTextEdit 22 | - TextEdit 23 | - ProgressBar 24 | - TextBrowser 25 | """ 26 | 27 | from __future__ import annotations 28 | -------------------------------------------------------------------------------- /prettyqt/custom_widgets/editors/mappedcheckbox.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from typing import Any 4 | 5 | from prettyqt import widgets 6 | 7 | 8 | class MappedCheckBox(widgets.CheckBox): 9 | def __init__( 10 | self, 11 | *args, 12 | true_value=True, 13 | false_value=False, 14 | object_name: str = "mapped_checkbox", 15 | **kwargs, 16 | ): 17 | import bidict 18 | 19 | super().__init__(*args, object_name=object_name, **kwargs) 20 | dct = {True: true_value, False: false_value} 21 | self.map = bidict.bidict[bool, Any](dct) 22 | 23 | def get_value(self): 24 | return self.map[self.isChecked()] 25 | 26 | def set_value(self, value): 27 | val = self.map.inverse[value] 28 | super().set_value(val) 29 | 30 | 31 | if __name__ == "__main__": 32 | app = widgets.app() 33 | widget = MappedCheckBox("Test") 34 | widget.show() 35 | app.exec() 36 | print(widget.get_value()) 37 | -------------------------------------------------------------------------------- /prettyqt/custom_widgets/itemviews/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/custom_widgets/itemviews/__init__.py -------------------------------------------------------------------------------- /prettyqt/custom_widgets/labels/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/custom_widgets/labels/__init__.py -------------------------------------------------------------------------------- /prettyqt/custom_widgets/layouts/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/custom_widgets/layouts/__init__.py -------------------------------------------------------------------------------- /prettyqt/custom_widgets/regexeditor/__init__.py: -------------------------------------------------------------------------------- 1 | """Module containing classes related to the RegEx editor.""" 2 | 3 | from .regexeditorwidget import RegexEditorWidget 4 | 5 | 6 | __all__ = ["RegexEditorWidget"] 7 | -------------------------------------------------------------------------------- /prettyqt/custom_widgets/regexeditor/__main__.py: -------------------------------------------------------------------------------- 1 | """This module contains the editor widget implementation.""" 2 | 3 | from __future__ import annotations 4 | 5 | from prettyqt import widgets 6 | from prettyqt.custom_widgets import regexeditor 7 | 8 | 9 | def run(): 10 | app = widgets.app() 11 | widget = regexeditor.RegexEditorWidget() 12 | widget.show() 13 | app.exec() 14 | 15 | 16 | if __name__ == "__main__": 17 | app = widgets.app() 18 | widget = regexeditor.RegexEditorWidget() 19 | widget.show() 20 | app.exec() 21 | -------------------------------------------------------------------------------- /prettyqt/custom_widgets/scrollbars/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/custom_widgets/scrollbars/__init__.py -------------------------------------------------------------------------------- /prettyqt/debugging/tracebackdialog.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import gui, widgets 4 | 5 | 6 | class TracebackDialog(widgets.Dialog): 7 | """A dialog box that shows Python traceback.""" 8 | 9 | def __init__(self, parent: widgets.QWidget | None = None): 10 | super().__init__(parent, window_title="Traceback") 11 | layout = self.set_layout("vertical") 12 | self._text = widgets.TextEdit(self, read_only=True, line_wrap_mode="none") 13 | self._text.setFontFamily(gui.Font.mono().family()) 14 | layout.addWidget(self._text) 15 | self.resize(600, 400) 16 | 17 | def setText(self, text: str): 18 | """Always set text as a HTML text.""" 19 | self._text.setHtml(text) 20 | 21 | 22 | if __name__ == "__main__": 23 | from prettyqt import widgets 24 | 25 | app = widgets.app() 26 | wnd = TracebackDialog() 27 | wnd.show() 28 | with app.debug_mode(): 29 | app.exec() 30 | -------------------------------------------------------------------------------- /prettyqt/designer/abstractextensionfactory.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt import QtDesigner 4 | 5 | 6 | class AbstractExtensionFactory(QtDesigner.QAbstractExtensionFactory): 7 | """Interface for extension factories in Qt Designer.""" 8 | 9 | 10 | if __name__ == "__main__": 11 | fact = AbstractExtensionFactory() 12 | -------------------------------------------------------------------------------- /prettyqt/designer/abstractformbuilder.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt import QtDesigner 4 | 5 | 6 | class AbstractFormBuilderMixin: 7 | pass 8 | 9 | 10 | class AbstractFormBuilder(AbstractFormBuilderMixin, QtDesigner.QAbstractFormBuilder): 11 | """Default implementation for classes that create user interfaces at run-time.""" 12 | 13 | 14 | if __name__ == "__main__": 15 | builder = AbstractFormBuilder() 16 | print(dir(builder)) 17 | -------------------------------------------------------------------------------- /prettyqt/designer/designercustomwidgetinterface.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt import QtDesigner 4 | 5 | 6 | class DesignerCustomWidgetInterface(QtDesigner.QDesignerCustomWidgetInterface): 7 | """Enables Qt Designer to access and construct custom widgets.""" 8 | 9 | 10 | if __name__ == "__main__": 11 | interface = DesignerCustomWidgetInterface() 12 | -------------------------------------------------------------------------------- /prettyqt/designer/designerformeditorinterface.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | from prettyqt.qt import QtDesigner 5 | 6 | 7 | class DesignerFormEditorInterface( 8 | core.ObjectMixin, QtDesigner.QDesignerFormEditorInterface 9 | ): 10 | """Allows you to access Qt Designer's various components.""" 11 | 12 | 13 | if __name__ == "__main__": 14 | interface = DesignerFormEditorInterface() 15 | -------------------------------------------------------------------------------- /prettyqt/designer/formbuilder.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import designer 4 | 5 | 6 | class FormBuilder( 7 | designer.abstractformbuilder.AbstractFormBuilderMixin, designer.QFormBuilder 8 | ): 9 | """Used to dynamically construct user interfaces from UI files at run-time.""" 10 | 11 | 12 | if __name__ == "__main__": 13 | builder = FormBuilder() 14 | -------------------------------------------------------------------------------- /prettyqt/designer/pydesignercustomwidgetcollection.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt import QtDesigner 4 | 5 | 6 | class PyDesignerCustomWidgetCollection(QtDesigner.QPyDesignerCustomWidgetCollection): 7 | pass 8 | 9 | 10 | if __name__ == "__main__": 11 | fact = PyDesignerCustomWidgetCollection() 12 | -------------------------------------------------------------------------------- /prettyqt/designer/pydesignercustomwidgetcollectionplugin.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | from prettyqt.qt import QtDesigner 5 | 6 | 7 | class PyDesignerCustomWidgetCollectionPlugin( 8 | core.ObjectMixin, QtDesigner.QPyDesignerCustomWidgetCollectionPlugin 9 | ): 10 | def customWidgets(self): 11 | pass 12 | 13 | 14 | if __name__ == "__main__": 15 | fact = PyDesignerCustomWidgetCollectionPlugin() 16 | new = dir(PyDesignerCustomWidgetCollectionPlugin()) 17 | bie = dir(core.Object()) 18 | c = [x for x in new if x not in bie] 19 | -------------------------------------------------------------------------------- /prettyqt/designer/pydesignertaskmenuextension.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | from prettyqt.qt import QtDesigner 5 | 6 | 7 | class PyDesignerTaskMenuExtension( 8 | core.ObjectMixin, QtDesigner.QPyDesignerTaskMenuExtension 9 | ): 10 | def preferredEditAction(self): 11 | return NotImplemented 12 | 13 | def taskActions(self): 14 | return NotImplemented 15 | 16 | 17 | if __name__ == "__main__": 18 | obj = core.Object() 19 | ext = PyDesignerTaskMenuExtension(obj) 20 | new = dir(PyDesignerTaskMenuExtension(obj)) 21 | bie = dir(core.Object()) 22 | c = [x for x in new if x not in bie] 23 | -------------------------------------------------------------------------------- /prettyqt/docs/SUMMARY.md: -------------------------------------------------------------------------------- 1 | * Usage 2 | * [General](api_guidelines/general.md) 3 | * [Types](api_guidelines/types.md) 4 | * [Bindings](api_guidelines/bindings.md) 5 | * Features 6 | * [Proxy models](features/proxies.md) 7 | * [Widgets](features/widgets.md) 8 | * [Layouts](features/layouts.md) 9 | * [Animating](features/animating.md) 10 | -------------------------------------------------------------------------------- /prettyqt/docs/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/docs/__init__.py -------------------------------------------------------------------------------- /prettyqt/docs/features/models.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/docs/features/models.md -------------------------------------------------------------------------------- /prettyqt/eventfilters/baseeventfilter.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | import contextlib 4 | 5 | from prettyqt import core 6 | 7 | 8 | class BaseEventFilter(core.Object): 9 | def __init__(self, *args, **kwargs): 10 | super().__init__(*args, **kwargs) 11 | if not self.objectName(): 12 | self.setObjectName(type(self).__name__) 13 | 14 | @contextlib.contextmanager 15 | def applied_to(self, obj): 16 | obj.installEventFilter(self) 17 | yield obj 18 | obj.removeEventFilter(self) 19 | 20 | 21 | if __name__ == "__main__": 22 | from prettyqt import widgets 23 | 24 | app = widgets.app() 25 | widget = widgets.Widget() 26 | eventfilter = BaseEventFilter() 27 | with eventfilter.applied_to(widget): 28 | pass 29 | -------------------------------------------------------------------------------- /prettyqt/gui/backingstore.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | import contextlib 4 | 5 | from prettyqt.qt import QtGui 6 | 7 | 8 | class BackingStore(QtGui.QBackingStore): 9 | """Drawing area for QWindow.""" 10 | 11 | @contextlib.contextmanager 12 | def paint_on_region(self, region: QtGui.QRegion): 13 | self.beginPaint(region) 14 | yield self 15 | self.endPaint() 16 | 17 | 18 | if __name__ == "__main__": 19 | from prettyqt import widgets 20 | 21 | app = widgets.app() 22 | w = widgets.Widget() 23 | backingstore = BackingStore(w.backingStore()) 24 | -------------------------------------------------------------------------------- /prettyqt/gui/bitmap.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import gui 4 | 5 | 6 | class Bitmap(gui.PixmapMixin, gui.QBitmap): 7 | """Monochrome (1-bit depth) pixmaps.""" 8 | 9 | 10 | if __name__ == "__main__": 11 | app = gui.app() 12 | image = Bitmap() 13 | bytes(image) 14 | -------------------------------------------------------------------------------- /prettyqt/gui/desktopservices.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | import os 4 | from typing import TYPE_CHECKING 5 | 6 | from prettyqt import core, gui 7 | 8 | 9 | if TYPE_CHECKING: 10 | from prettyqt.utils import datatypes 11 | 12 | 13 | class DesktopServices(gui.QDesktopServices): 14 | """Methods for accessing common desktop services.""" 15 | 16 | @classmethod 17 | def open_url(cls, location: datatypes.PathType | datatypes.UrlType) -> bool: 18 | if not isinstance(location, core.QUrl): 19 | location = core.Url.from_user_input(os.fspath(location)) 20 | return cls.openUrl(location) 21 | -------------------------------------------------------------------------------- /prettyqt/gui/fontinfo.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import gui 4 | 5 | 6 | class FontInfo(gui.QFontInfo): 7 | """General information about fonts.""" 8 | 9 | def get_style_hint(self) -> gui.font.StyleHintStr: 10 | return gui.font.STYLE_HINTS.inverse[self.styleHint()] 11 | -------------------------------------------------------------------------------- /prettyqt/gui/fontmetrics.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import constants, core 4 | from prettyqt.qt import QtGui 5 | 6 | 7 | class FontMetrics(QtGui.QFontMetrics): 8 | """Font metrics information.""" 9 | 10 | def elided_text( 11 | self, 12 | text: str, 13 | mode: constants.TextElideModeStr | constants.TextElideMode, 14 | width: int, 15 | flags=0, 16 | ) -> str: 17 | val = constants.TEXT_ELIDE_MODE.get_enum_value(mode) 18 | return self.elidedText(text, val, width, flags) 19 | 20 | def get_bounding_rect(self, *args) -> core.Rect: 21 | return core.Rect(self.boundingRect(*args)) 22 | 23 | def get_tight_bounding_rect(self, text: str) -> core.Rect: 24 | return core.Rect(self.tightBoundingRect(text)) 25 | 26 | 27 | if __name__ == "__main__": 28 | from prettyqt import gui 29 | 30 | app = gui.app() 31 | font = gui.Font() 32 | metrics = FontMetrics(font) 33 | -------------------------------------------------------------------------------- /prettyqt/gui/fontmetricsf.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import constants, core 4 | from prettyqt.qt import QtGui 5 | 6 | 7 | class FontMetricsF(QtGui.QFontMetricsF): 8 | """Font metrics information.""" 9 | 10 | def elided_text( 11 | self, 12 | text: str, 13 | mode: constants.TextElideModeStr | constants.TextElideMode, 14 | width: float, 15 | flags=0, 16 | ) -> str: 17 | val = constants.TEXT_ELIDE_MODE.get_enum_value(mode) 18 | return self.elidedText(text, val, width, flags) 19 | 20 | def get_bounding_rect(self, *args) -> core.RectF: 21 | return core.RectF(self.boundingRect(*args)) 22 | 23 | def get_tight_bounding_rect(self, text: str) -> core.RectF: 24 | return core.RectF(self.tightBoundingRect(text)) 25 | -------------------------------------------------------------------------------- /prettyqt/gui/matrix4x4.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt import QtGui 4 | 5 | 6 | class Matrix4x4(QtGui.QMatrix4x4): 7 | """Represents a 4x4 transformation matrix in 3D space.""" 8 | 9 | 10 | if __name__ == "__main__": 11 | matrix = Matrix4x4([1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4]) 12 | print(matrix) 13 | -------------------------------------------------------------------------------- /prettyqt/gui/paintdevicewindow.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import gui 4 | 5 | 6 | class PaintDeviceWindowMixin(gui.WindowMixin, gui.PaintDeviceMixin): 7 | pass 8 | 9 | 10 | class PaintDeviceWindow(PaintDeviceWindowMixin, gui.QPaintDeviceWindow): 11 | pass 12 | 13 | 14 | if __name__ == "__main__": 15 | window = PaintDeviceWindow() 16 | -------------------------------------------------------------------------------- /prettyqt/gui/picture.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import gui 4 | from prettyqt.utils import serializemixin 5 | 6 | 7 | class Picture(serializemixin.SerializeMixin, gui.PaintDeviceMixin, gui.QPicture): 8 | """Paint device that records and replays QPainter commands.""" 9 | -------------------------------------------------------------------------------- /prettyqt/gui/pixmapcache.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt import QtGui 4 | 5 | 6 | class PixmapCache(QtGui.QPixmapCache): 7 | """Application-wide cache for pixmaps.""" 8 | 9 | def __setitem__(self, key: str, value: QtGui.QPixmap): 10 | self.insert(key, value) 11 | 12 | def __getitem__(self, key: str) -> QtGui.QPixmap | None: 13 | return self.find(key) 14 | 15 | def __delitem__(self, key: str): 16 | self.remove(key) 17 | 18 | 19 | if __name__ == "__main__": 20 | from prettyqt import gui 21 | from prettyqt.qt import QtCore 22 | 23 | app = gui.app() 24 | cache = PixmapCache() 25 | pix = gui.Pixmap.create_char("a", 10) 26 | cache["test"] = pix 27 | test = cache["test"] 28 | 29 | ba = QtCore.QByteArray() 30 | stream = QtCore.QDataStream(ba, QtCore.QIODeviceBase.OpenModeFlag.WriteOnly) 31 | stream << test 32 | assert ba.data() == bytes(pix) 33 | -------------------------------------------------------------------------------- /prettyqt/gui/rasterwindow.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import gui 4 | 5 | 6 | class RasterWindow(gui.PaintDeviceWindowMixin, gui.QRasterWindow): 7 | """Convenience class for using QPainter on a QWindow.""" 8 | 9 | 10 | if __name__ == "__main__": 11 | app = gui.app() 12 | -------------------------------------------------------------------------------- /prettyqt/gui/syntaxhighlighter.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core, gui 4 | 5 | 6 | class SyntaxHighlighterMixin(core.ObjectMixin): 7 | def __init__(self, parent: core.QObject | None = None): 8 | super().__init__(parent) # type: ignore 9 | 10 | def get_current_block(self) -> gui.TextBlock: 11 | return gui.TextBlock(self.currentBlock()) 12 | 13 | def get_format(self, position: int) -> gui.TextCharFormat: 14 | return gui.TextCharFormat(self.format(position)) 15 | 16 | 17 | class SyntaxHighlighter(SyntaxHighlighterMixin, gui.QSyntaxHighlighter): 18 | pass 19 | -------------------------------------------------------------------------------- /prettyqt/gui/textblockgroup.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from typing import TYPE_CHECKING 4 | 5 | from prettyqt import gui 6 | from prettyqt.utils import get_repr 7 | 8 | 9 | if TYPE_CHECKING: 10 | from collections.abc import Iterator 11 | 12 | 13 | class TextBlockGroup(gui.TextObjectMixin, gui.QTextBlockGroup): 14 | def __repr__(self): 15 | return get_repr(self) 16 | 17 | def __iter__(self) -> Iterator[gui.TextBlock]: 18 | return iter(gui.TextBlock(i) for i in self.blockList()) 19 | 20 | def get_blocklist(self) -> list[gui.TextBlock]: 21 | return [gui.TextBlock(i) for i in self.blockList()] 22 | 23 | 24 | if __name__ == "__main__": 25 | doc = gui.TextDocument() 26 | group = TextBlockGroup(doc) 27 | -------------------------------------------------------------------------------- /prettyqt/gui/textblockuserdata.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt import QtGui 4 | from prettyqt.utils import get_repr 5 | 6 | 7 | class TextBlockUserData(QtGui.QTextBlockUserData): 8 | """Storage for the user data associated with each line.""" 9 | 10 | def __init__(self, **kwds): 11 | for key, value in kwds.items(): 12 | setattr(self, key, value) 13 | super().__init__() 14 | 15 | def __repr__(self): 16 | kwargs = {i: getattr(self, i) for i in dir(self) if not i.startswith("__")} 17 | return get_repr(self, **kwargs) 18 | -------------------------------------------------------------------------------- /prettyqt/gui/textframe.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import gui 4 | from prettyqt.utils import get_repr 5 | 6 | 7 | class TextFrameMixin(gui.TextObjectMixin): 8 | def __repr__(self): 9 | return get_repr(self) 10 | 11 | def get_first_cursor_position(self) -> gui.TextCursor: 12 | return gui.TextCursor(self.firstCursorPosition()) 13 | 14 | def get_last_cursor_position(self) -> gui.TextCursor: 15 | return gui.TextCursor(self.lastCursorPosition()) 16 | 17 | 18 | class TextFrame(TextFrameMixin, gui.QTextFrame): 19 | pass 20 | 21 | 22 | if __name__ == "__main__": 23 | doc = gui.TextDocument() 24 | frame = TextFrame(doc) 25 | -------------------------------------------------------------------------------- /prettyqt/gui/textimageformat.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import gui 4 | 5 | 6 | class TextImageFormat(gui.TextCharFormatMixin, gui.QTextImageFormat): 7 | def __bool__(self): 8 | return self.isValid() 9 | 10 | 11 | if __name__ == "__main__": 12 | fmt = TextImageFormat() 13 | -------------------------------------------------------------------------------- /prettyqt/gui/textlayout.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | import contextlib 4 | 5 | from prettyqt import gui 6 | from prettyqt.utils import get_repr 7 | 8 | 9 | class TextLayout(gui.QTextLayout): 10 | def __repr__(self): 11 | return get_repr(self, self.text()) 12 | 13 | @contextlib.contextmanager 14 | def process_layout(self): 15 | self.beginLayout() 16 | yield self 17 | self.endLayout() 18 | 19 | def get_text_option(self) -> gui.TextOption: 20 | return gui.TextOption(self.textOption()) 21 | 22 | 23 | if __name__ == "__main__": 24 | layout = TextLayout() 25 | -------------------------------------------------------------------------------- /prettyqt/gui/textlength.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from typing import Literal 4 | 5 | from prettyqt.qt import QtGui 6 | from prettyqt.utils import bidict, get_repr 7 | 8 | 9 | TYPES = bidict( 10 | variable=QtGui.QTextLength.Type.VariableLength, 11 | fixed=QtGui.QTextLength.Type.FixedLength, 12 | percentage=QtGui.QTextLength.Type.PercentageLength, 13 | ) 14 | 15 | TypeStr = Literal["variable", "fixed", "percentage"] 16 | 17 | 18 | class TextLength(QtGui.QTextLength): 19 | def __repr__(self): 20 | return get_repr(self, self.type(), self.rawValue()) 21 | 22 | def get_type(self) -> TypeStr: 23 | """Return type of this length object. 24 | 25 | Returns: 26 | timer type 27 | """ 28 | return TYPES.inverse[self.type()] 29 | 30 | 31 | if __name__ == "__main__": 32 | length = TextLength() 33 | -------------------------------------------------------------------------------- /prettyqt/gui/textobject.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core, gui 4 | from prettyqt.utils import get_repr 5 | 6 | 7 | class TextObjectMixin(core.ObjectMixin): 8 | def __repr__(self): 9 | return get_repr(self) 10 | 11 | def get_format(self) -> gui.TextFormat: 12 | return gui.TextFormat(self.format()) 13 | 14 | 15 | class TextObject(TextObjectMixin, gui.QTextObject): 16 | pass 17 | 18 | 19 | if __name__ == "__main__": 20 | doc = gui.TextDocument() 21 | obj = TextObject(doc) 22 | -------------------------------------------------------------------------------- /prettyqt/gui/textobjectinterface.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt import QtGui 4 | 5 | 6 | class TextObjectInterface(QtGui.QTextObjectInterface): 7 | pass 8 | 9 | 10 | if __name__ == "__main__": 11 | interface = TextObjectInterface() 12 | -------------------------------------------------------------------------------- /prettyqt/gui/texttable.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import gui 4 | 5 | 6 | class TextTable(gui.textframe.TextFrameMixin, gui.QTextTable): 7 | def __getitem__(self, index: int | tuple[int, int]) -> gui.TextTableCell: 8 | if isinstance(index, int): 9 | cell = gui.TextTableCell(self.cellAt(index)) 10 | else: 11 | cell = gui.TextTableCell(self.cellAt(*index)) 12 | if not cell.isValid(): 13 | raise IndexError(index) 14 | return cell 15 | 16 | # def get_format(self) -> gui.TextTableFormat: 17 | # return gui.TextTableFormat(self.format()) 18 | 19 | 20 | if __name__ == "__main__": 21 | doc = gui.TextDocument() 22 | table = TextTable(doc) 23 | -------------------------------------------------------------------------------- /prettyqt/gui/texttablecell.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import gui 4 | 5 | 6 | class TextTableCell(gui.QTextTableCell): 7 | def get_format(self) -> gui.TextCharFormat: 8 | # .format() seems to crash both bindings? 9 | return gui.TextCharFormat(self.format()) 10 | 11 | def get_first_cursor_position(self) -> gui.TextCursor: 12 | return gui.TextCursor(self.firstCursorPosition()) 13 | 14 | def get_last_cursor_position(self) -> gui.TextCursor: 15 | return gui.TextCursor(self.lastCursorPosition()) 16 | 17 | 18 | if __name__ == "__main__": 19 | app = gui.app() 20 | cell = TextTableCell() 21 | cell.get_format() 22 | -------------------------------------------------------------------------------- /prettyqt/gui/undocommand.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt import QtGui 4 | 5 | 6 | class UndoCommand(QtGui.QUndoCommand): 7 | def __len__(self) -> int: 8 | return self.childCount() 9 | 10 | def __getitem__(self, index: int) -> QtGui.QUndoCommand: 11 | if index >= self.childCount(): 12 | raise IndexError(index) 13 | return self.child(index) 14 | 15 | # def __setstate__(self, state): 16 | # for c in state["children"]: 17 | # c.setParent(self) 18 | 19 | # def __reduce__(self): 20 | # return type(self), (), self.__getstate__() 21 | -------------------------------------------------------------------------------- /prettyqt/gui/undogroup.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | from prettyqt.qt import QtGui 5 | 6 | 7 | class UndoGroupMixin(core.ObjectMixin): 8 | def __len__(self) -> int: 9 | return len(self.stacks()) 10 | 11 | def __getitem__(self, index: int) -> QtGui.QUndoStack: 12 | return self.stacks()[index] 13 | 14 | 15 | class UndoGroup(UndoGroupMixin, QtGui.QUndoGroup): 16 | pass 17 | -------------------------------------------------------------------------------- /prettyqt/gui/validator.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | from prettyqt.qt import QtGui 5 | from prettyqt.utils import get_repr 6 | 7 | 8 | class ValidatorMixin(core.ObjectMixin): 9 | def __repr__(self): 10 | return get_repr(self) 11 | 12 | def __and__(self, other: Validator): 13 | from prettyqt import validators 14 | 15 | return validators.AndValidator([self, other]) 16 | 17 | def __or__(self, other: Validator): 18 | from prettyqt import validators 19 | 20 | return validators.OrValidator([self, other]) 21 | 22 | def is_valid_value(self, value: str, pos: int = 0) -> bool: 23 | val = self.validate(value, pos) 24 | return val[0] == self.State.Acceptable # type: ignore 25 | 26 | 27 | class Validator(ValidatorMixin, QtGui.QValidator): 28 | pass 29 | 30 | 31 | if __name__ == "__main__": 32 | val = Validator() & Validator() 33 | print(val) 34 | -------------------------------------------------------------------------------- /prettyqt/gui/vector3d.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | from prettyqt.qt import QtGui 5 | 6 | 7 | class Vector3D(QtGui.QVector3D): 8 | def __bool__(self): 9 | return not self.isNull() 10 | 11 | def __abs__(self) -> float: 12 | return self.length() 13 | 14 | @property 15 | def _x(self) -> float: 16 | return self.x() 17 | 18 | @property 19 | def _y(self) -> float: 20 | return self.y() 21 | 22 | @property 23 | def _z(self) -> float: 24 | return self.z() 25 | 26 | __match_args__ = ("_x", "_y", "z") 27 | 28 | def __reduce__(self): 29 | return type(self), (self.x(), self.y(), self.z()) 30 | 31 | def to_point(self) -> core.Point: 32 | return core.Point(self.toPoint()) 33 | 34 | def to_pointf(self) -> core.PointF: 35 | return core.PointF(self.toPointF()) 36 | 37 | 38 | if __name__ == "__main__": 39 | vector = Vector3D(0, 0, 1) 40 | print(abs(vector)) 41 | -------------------------------------------------------------------------------- /prettyqt/iconprovider/awesomequickimageprovider.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from typing import TYPE_CHECKING 4 | 5 | from prettyqt import iconprovider, quick 6 | 7 | 8 | if TYPE_CHECKING: 9 | from prettyqt.qt import QtCore 10 | 11 | 12 | class AwesomeQuickImageProvider(quick.QuickImageProvider): 13 | def requestPixmap(self, id_: str, requested_size: QtCore.QSize): 14 | pix = iconprovider.get_icon(id_).pixmap(requested_size) 15 | return pix, pix.size() 16 | 17 | def requestImage(self, id_: str, requested_size: QtCore.QSize): 18 | img = iconprovider.get_icon(id_).pixmap(requested_size).toImage() 19 | return img, img.size() 20 | -------------------------------------------------------------------------------- /prettyqt/iconprovider/chariconengine.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import constants, core, gui 4 | 5 | 6 | ZERO_COORD = core.Point(0, 0) 7 | 8 | 9 | class CharIconEngine(gui.IconEngine): 10 | """Specialization of gui.QIconEngine used to draw font-based icons.""" 11 | 12 | def __init__(self, iconic, options): 13 | super().__init__() 14 | self.iconic = iconic 15 | self.options = options 16 | 17 | def paint(self, painter: gui.QPainter, rect: core.QRect, mode, state): 18 | self.iconic.paint(painter, rect, mode, state, self.options) 19 | 20 | def pixmap(self, size, mode, state) -> gui.QPixmap: 21 | pm = gui.QPixmap(size) 22 | pm.fill(constants.GlobalColor.transparent) # type: ignore 23 | rect = core.Rect(ZERO_COORD, size) 24 | with gui.Painter(pm) as painter: 25 | self.paint(painter, rect, mode, state) 26 | return pm 27 | -------------------------------------------------------------------------------- /prettyqt/iconprovider/fonts/codicon.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/iconprovider/fonts/codicon.ttf -------------------------------------------------------------------------------- /prettyqt/iconprovider/fonts/elusiveicons-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/iconprovider/fonts/elusiveicons-webfont.ttf -------------------------------------------------------------------------------- /prettyqt/iconprovider/fonts/fontawesome5-brands-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/iconprovider/fonts/fontawesome5-brands-webfont.ttf -------------------------------------------------------------------------------- /prettyqt/iconprovider/fonts/fontawesome5-regular-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/iconprovider/fonts/fontawesome5-regular-webfont.ttf -------------------------------------------------------------------------------- /prettyqt/iconprovider/fonts/fontawesome5-solid-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/iconprovider/fonts/fontawesome5-solid-webfont.ttf -------------------------------------------------------------------------------- /prettyqt/iconprovider/fonts/materialdesignicons5-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/iconprovider/fonts/materialdesignicons5-webfont.ttf -------------------------------------------------------------------------------- /prettyqt/iconprovider/fonts/materialdesignicons6-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/iconprovider/fonts/materialdesignicons6-webfont.ttf -------------------------------------------------------------------------------- /prettyqt/iconprovider/fonts/phosphor.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/iconprovider/fonts/phosphor.ttf -------------------------------------------------------------------------------- /prettyqt/iconprovider/fonts/remixicon.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/iconprovider/fonts/remixicon.ttf -------------------------------------------------------------------------------- /prettyqt/ipython/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from .baseipythonwidget import BaseIPythonWidget 4 | from .inprocessipythonwidget import InProcessIPythonWidget 5 | from .outofprocessipythonwidget import OutOfProcessIPythonWidget 6 | 7 | 8 | __all__ = ["BaseIPythonWidget", "InProcessIPythonWidget", "OutOfProcessIPythonWidget"] 9 | -------------------------------------------------------------------------------- /prettyqt/itemdelegates/nofocusdelegate.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core, gui, widgets 4 | 5 | 6 | # https://stackoverflow.com/a/55252650/3620725 7 | 8 | 9 | class NoFocusDelegate(widgets.StyledItemDelegate): 10 | """Delegate to remove dotted border on cell focus.""" 11 | 12 | ID = "no_focus" 13 | 14 | def paint( 15 | self, 16 | painter: gui.QPainter, 17 | option: widgets.QStyleOptionViewItem, 18 | index: core.ModelIndex, 19 | ): 20 | if option.state & widgets.Style.StateFlag.State_HasFocus: 21 | option.state = option.state ^ widgets.Style.StateFlag.State_HasFocus 22 | super().paint(painter, option, index) 23 | -------------------------------------------------------------------------------- /prettyqt/itemmodels/proxies/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/itemmodels/proxies/__init__.py -------------------------------------------------------------------------------- /prettyqt/localization/language_ar.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/localization/language_ar.qm -------------------------------------------------------------------------------- /prettyqt/localization/language_bg.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/localization/language_bg.qm -------------------------------------------------------------------------------- /prettyqt/localization/language_ca.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/localization/language_ca.qm -------------------------------------------------------------------------------- /prettyqt/localization/language_cs.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/localization/language_cs.qm -------------------------------------------------------------------------------- /prettyqt/localization/language_da.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/localization/language_da.qm -------------------------------------------------------------------------------- /prettyqt/localization/language_de.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/localization/language_de.qm -------------------------------------------------------------------------------- /prettyqt/localization/language_es.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/localization/language_es.qm -------------------------------------------------------------------------------- /prettyqt/localization/language_fa.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/localization/language_fa.qm -------------------------------------------------------------------------------- /prettyqt/localization/language_fi.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/localization/language_fi.qm -------------------------------------------------------------------------------- /prettyqt/localization/language_fr.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/localization/language_fr.qm -------------------------------------------------------------------------------- /prettyqt/localization/language_gd.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/localization/language_gd.qm -------------------------------------------------------------------------------- /prettyqt/localization/language_gl.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/localization/language_gl.qm -------------------------------------------------------------------------------- /prettyqt/localization/language_he.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/localization/language_he.qm -------------------------------------------------------------------------------- /prettyqt/localization/language_hr.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/localization/language_hr.qm -------------------------------------------------------------------------------- /prettyqt/localization/language_hu.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/localization/language_hu.qm -------------------------------------------------------------------------------- /prettyqt/localization/language_it.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/localization/language_it.qm -------------------------------------------------------------------------------- /prettyqt/localization/language_ja.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/localization/language_ja.qm -------------------------------------------------------------------------------- /prettyqt/localization/language_ka.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/localization/language_ka.qm -------------------------------------------------------------------------------- /prettyqt/localization/language_ko.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/localization/language_ko.qm -------------------------------------------------------------------------------- /prettyqt/localization/language_lg.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/localization/language_lg.qm -------------------------------------------------------------------------------- /prettyqt/localization/language_lt.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/localization/language_lt.qm -------------------------------------------------------------------------------- /prettyqt/localization/language_lv.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/localization/language_lv.qm -------------------------------------------------------------------------------- /prettyqt/localization/language_nl.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/localization/language_nl.qm -------------------------------------------------------------------------------- /prettyqt/localization/language_nn.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/localization/language_nn.qm -------------------------------------------------------------------------------- /prettyqt/localization/language_pl.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/localization/language_pl.qm -------------------------------------------------------------------------------- /prettyqt/localization/language_pt.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/localization/language_pt.qm -------------------------------------------------------------------------------- /prettyqt/localization/language_pt_BR.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/localization/language_pt_BR.qm -------------------------------------------------------------------------------- /prettyqt/localization/language_pt_PT.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/localization/language_pt_PT.qm -------------------------------------------------------------------------------- /prettyqt/localization/language_ru.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/localization/language_ru.qm -------------------------------------------------------------------------------- /prettyqt/localization/language_sk.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/localization/language_sk.qm -------------------------------------------------------------------------------- /prettyqt/localization/language_sl.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/localization/language_sl.qm -------------------------------------------------------------------------------- /prettyqt/localization/language_sv.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/localization/language_sv.qm -------------------------------------------------------------------------------- /prettyqt/localization/language_tr.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/localization/language_tr.qm -------------------------------------------------------------------------------- /prettyqt/localization/language_uk.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/localization/language_uk.qm -------------------------------------------------------------------------------- /prettyqt/localization/language_zh_CN.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/localization/language_zh_CN.qm -------------------------------------------------------------------------------- /prettyqt/localization/language_zh_TW.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/localization/language_zh_TW.qm -------------------------------------------------------------------------------- /prettyqt/location/geocodingmanager.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from typing import TYPE_CHECKING 4 | 5 | from prettyqt import core 6 | 7 | 8 | if TYPE_CHECKING: 9 | from prettyqt.qt import QtLocation 10 | 11 | 12 | class GeoCodingManager(core.ObjectMixin): 13 | """Support for geocoding operations.""" 14 | 15 | def __init__(self, item: QtLocation.QGeoCodingManager): 16 | self.item = item 17 | 18 | def __getattr__(self, val): 19 | return getattr(self.item, val) 20 | 21 | def get_locale(self) -> core.Locale: 22 | return core.Locale(self.item.locale()) 23 | -------------------------------------------------------------------------------- /prettyqt/location/georoutesegment.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import location, positioning 4 | 5 | 6 | class GeoRouteSegment(location.QGeoRouteSegment): 7 | """Represents a segment of a route.""" 8 | 9 | def __bool__(self): 10 | return self.isValid() 11 | 12 | def __abs__(self) -> float: 13 | return self.distance() 14 | 15 | def get_maneuver(self) -> location.GeoManeuver: 16 | return location.GeoManeuver(self.maneuver()) 17 | 18 | def get_path(self) -> list[positioning.GeoCoordinate]: 19 | return [positioning.GeoCoordinate(i) for i in self.path()] 20 | 21 | 22 | if __name__ == "__main__": 23 | segment = GeoRouteSegment() 24 | segment.setDistance(1) 25 | -------------------------------------------------------------------------------- /prettyqt/location/placecategory.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import location 4 | 5 | 6 | class PlaceCategory(location.QPlaceCategory): 7 | """Represents a category that a QPlace can be associated with.""" 8 | 9 | def __str__(self): 10 | return self.name() 11 | 12 | def __bool__(self): 13 | return not self.isEmpty() 14 | 15 | def get_icon(self) -> location.PlaceIcon | None: 16 | icon = self.icon() 17 | return None if icon.isEmpty() else location.PlaceIcon(icon) 18 | 19 | def get_visibility(self) -> location.VisibilityStr: 20 | """Return the visibility of the place. 21 | 22 | Returns: 23 | Visibility 24 | """ 25 | return location.VISIBILITY.inverse[self.visibility()] 26 | 27 | 28 | if __name__ == "__main__": 29 | category = PlaceCategory() 30 | print(bool(category)) 31 | -------------------------------------------------------------------------------- /prettyqt/location/placecontentrequest.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import location 4 | 5 | 6 | class PlaceContentRequest(location.QPlaceContentRequest): 7 | """Represents the parameters of a content request.""" 8 | 9 | def set_content_type( 10 | self, typ: location.placecontent.TypeStr | location.PlaceContent.Type 11 | ): 12 | """Set the content type. 13 | 14 | Args: 15 | typ: Relevance type 16 | """ 17 | self.setContentType(location.placecontent.TYPE.get_enum_value(typ)) 18 | 19 | def get_content_type(self) -> location.placecontent.TypeStr: 20 | """Return current content type. 21 | 22 | Returns: 23 | Relevance type 24 | """ 25 | return location.placecontent.TYPE.inverse[self.contentType()] 26 | 27 | 28 | if __name__ == "__main__": 29 | request = PlaceContentRequest() 30 | -------------------------------------------------------------------------------- /prettyqt/location/placedetailsreply.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from typing import Self 4 | 5 | from prettyqt import location 6 | 7 | 8 | class PlaceDetailsReply(location.PlaceReplyMixin, location.QPlaceDetailsReply): 9 | """Manages a place details fetch operation started by an instance of QPlaceManager.""" 10 | 11 | @classmethod 12 | def clone_from(cls, obj: location.QPlaceDetailsReply) -> Self: 13 | reply = cls(obj.parent()) 14 | reply.setPlace(location.Place(obj.place())) 15 | return reply 16 | 17 | def get_place(self) -> location.Place: 18 | return location.Place(self.place()) 19 | 20 | 21 | if __name__ == "__main__": 22 | reply = PlaceDetailsReply() 23 | print(dir(reply)) 24 | -------------------------------------------------------------------------------- /prettyqt/location/placematchrequest.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from typing import TYPE_CHECKING 4 | 5 | from prettyqt import location 6 | 7 | 8 | if TYPE_CHECKING: 9 | from prettyqt.utils import datatypes 10 | 11 | 12 | class PlaceMatchRequest(location.QPlaceMatchRequest): 13 | def __setitem__(self, index: str, val: datatypes.Variant): 14 | attrs = self.parameters() 15 | attrs[index] = val 16 | self.setParameters(attrs) 17 | 18 | def __getitem__(self, index: str) -> datatypes.Variant: 19 | attr = self.parameters() 20 | if index not in attr: 21 | msg = f"Key {index!r} does not exist." 22 | raise KeyError(msg) 23 | return attr[index] 24 | 25 | def get_places(self) -> list[location.Place]: 26 | return [location.Place(i) for i in self.places()] 27 | 28 | 29 | if __name__ == "__main__": 30 | request = PlaceMatchRequest() 31 | -------------------------------------------------------------------------------- /prettyqt/location/placeproposedsearchresult.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import location 4 | 5 | 6 | class PlaceProposedSearchResult( 7 | location.PlaceSearchResultMixin, location.QPlaceProposedSearchResult 8 | ): 9 | """Represents a search result containing a proposed search.""" 10 | -------------------------------------------------------------------------------- /prettyqt/location/placeratings.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt import QtLocation 4 | 5 | 6 | class PlaceRatings(QtLocation.QPlaceRatings): 7 | """Holds rating information about a place.""" 8 | 9 | def __bool__(self): 10 | return not self.isEmpty() 11 | 12 | def __float__(self): 13 | return self.average() 14 | 15 | 16 | if __name__ == "__main__": 17 | ratings = PlaceRatings() 18 | print(bool(ratings)) 19 | -------------------------------------------------------------------------------- /prettyqt/location/placeresult.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import location 4 | 5 | 6 | class PlaceResult(location.PlaceSearchResultMixin, location.QPlaceResult): 7 | """Represents a search result containing a place.""" 8 | 9 | def get_place(self) -> location.Place: 10 | return location.Place(self.place()) 11 | -------------------------------------------------------------------------------- /prettyqt/location/placesupplier.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from typing import TYPE_CHECKING 4 | 5 | from prettyqt import core, location 6 | 7 | 8 | if TYPE_CHECKING: 9 | from prettyqt.utils import datatypes 10 | 11 | 12 | class PlaceSupplier(location.QPlaceSupplier): 13 | def __bool__(self): 14 | return not self.isEmpty() 15 | 16 | def get_icon(self) -> location.PlaceIcon | None: 17 | icon = self.icon() 18 | return None if icon.isEmpty() else location.PlaceIcon(icon) 19 | 20 | def set_url(self, url: datatypes.UrlType): 21 | url = core.Url(url) 22 | self.setUrl(url) 23 | 24 | def get_url(self) -> core.Url: 25 | return core.Url(self.url()) 26 | 27 | 28 | if __name__ == "__main__": 29 | supplier = PlaceSupplier() 30 | print(bool(supplier)) 31 | -------------------------------------------------------------------------------- /prettyqt/location/placeuser.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt import QtLocation 4 | 5 | 6 | class PlaceUser(QtLocation.QPlaceUser): 7 | """Represents an individual user.""" 8 | 9 | def __str__(self): 10 | return self.name() 11 | 12 | 13 | if __name__ == "__main__": 14 | user = PlaceUser() 15 | -------------------------------------------------------------------------------- /prettyqt/location/qlocation.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from typing import Literal 4 | 5 | from prettyqt.qt import QtLocation 6 | from prettyqt.utils import bidict 7 | 8 | 9 | try: # PySide2 5.15 doesnt include these 10 | VISIBILITY = bidict( 11 | unspecified=QtLocation.QLocation.UnspecifiedVisibility, # type: ignore 12 | device=QtLocation.QLocation.DeviceVisibility, # type: ignore 13 | private=QtLocation.QLocation.PrivateVisibility, # type: ignore 14 | public=QtLocation.QLocation.PublicVisibility, # type: ignore 15 | ) 16 | except AttributeError: 17 | VISIBILITY = bidict() 18 | 19 | 20 | VisibilityStr = Literal["unspecified", "device", "private", "public"] 21 | -------------------------------------------------------------------------------- /prettyqt/multimedia/__init__.py: -------------------------------------------------------------------------------- 1 | """A rich set of classes to handle multimedia content.""" 2 | 3 | from __future__ import annotations 4 | 5 | from prettyqt.qt.QtMultimedia import * # noqa: F403 6 | 7 | from .mediametadata import MediaMetaData 8 | from .audioformat import AudioFormat 9 | from .audiodevice import AudioDevice 10 | from .cameraformat import CameraFormat 11 | from .cameradevice import CameraDevice 12 | from .camera import Camera 13 | from .mediaplayer import MediaPlayer 14 | from .screencapture import ScreenCapture 15 | from .mediarecorder import MediaRecorder 16 | from prettyqt.qt import QtMultimedia 17 | 18 | QT_MODULE = QtMultimedia 19 | 20 | __all__ = [ 21 | "AudioDevice", 22 | "AudioFormat", 23 | "Camera", 24 | "CameraDevice", 25 | "CameraFormat", 26 | "MediaMetaData", 27 | "MediaPlayer", 28 | "MediaRecorder", 29 | "ScreenCapture", 30 | ] 31 | -------------------------------------------------------------------------------- /prettyqt/multimedia/cameradevice.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from typing import Literal 4 | 5 | from prettyqt import multimedia 6 | from prettyqt.utils import bidict 7 | 8 | 9 | PositionStr = Literal["unspecified", "back", "front"] 10 | 11 | POSITION: bidict[PositionStr, multimedia.QCameraDevice.Position] = bidict( 12 | unspecified=multimedia.QCameraDevice.Position.UnspecifiedPosition, 13 | back=multimedia.QCameraDevice.Position.BackFace, 14 | front=multimedia.QCameraDevice.Position.FrontFace, 15 | ) 16 | 17 | 18 | class CameraDevice(multimedia.QCameraDevice): 19 | def get_position(self) -> PositionStr: 20 | return POSITION.inverse[self.position()] 21 | 22 | def get_video_formats(self) -> list[multimedia.CameraFormat]: 23 | return [multimedia.CameraFormat(i) for i in self.videoFormats()] 24 | 25 | 26 | if __name__ == "__main__": 27 | fmt = CameraDevice() 28 | -------------------------------------------------------------------------------- /prettyqt/multimedia/cameraformat.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt import QtMultimedia 4 | 5 | 6 | class CameraFormat(QtMultimedia.QCameraFormat): 7 | def __bool__(self): 8 | return not self.isNull() 9 | 10 | 11 | if __name__ == "__main__": 12 | fmt = CameraFormat() 13 | -------------------------------------------------------------------------------- /prettyqt/multimediawidgets/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt.QtMultimediaWidgets import * # noqa: F403 4 | 5 | from .graphicsvideoitem import GraphicsVideoItem 6 | from .videowidget import VideoWidget 7 | from prettyqt.qt import QtMultimediaWidgets 8 | 9 | QT_MODULE = QtMultimediaWidgets 10 | 11 | __all__ = ["GraphicsVideoItem", "VideoWidget"] 12 | -------------------------------------------------------------------------------- /prettyqt/network/httppart.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import network 4 | from prettyqt.qt import QtCore 5 | from prettyqt.utils import datatypes 6 | 7 | 8 | class HttpPart(network.QHttpPart): 9 | """Holds a body part to be used inside a HTTP multipart MIME message.""" 10 | 11 | def set_body(self, body: datatypes.ByteArrayType): 12 | body = datatypes.to_bytearray(body) 13 | self.setBody(body) 14 | 15 | def set_headers(self, headers: dict[str, str]): 16 | for k, v in headers.items(): 17 | self.setRawHeader( 18 | QtCore.QByteArray(k.encode()), QtCore.QByteArray(v.encode()) 19 | ) 20 | 21 | def set_header(self, name: str, value: network.networkrequest.KnownHeaderStr): 22 | self.setHeader(network.networkrequest.KNOWN_HEADER[name], value) 23 | 24 | 25 | if __name__ == "__main__": 26 | part = HttpPart() 27 | -------------------------------------------------------------------------------- /prettyqt/network/networkdatagram.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import network 4 | from prettyqt.qt import QtCore 5 | 6 | 7 | class NetworkDatagram(network.QNetworkDatagram): 8 | """The data and metadata of a UDP datagram.""" 9 | 10 | def get_destination_address(self) -> network.HostAddress: 11 | return network.HostAddress(self.destinationAddress()) 12 | 13 | def get_sender_address(self) -> network.HostAddress: 14 | return network.HostAddress(self.senderAddress()) 15 | 16 | def set_data(self, data: str): 17 | self.setData(QtCore.QByteArray(data.encode())) 18 | 19 | def get_data(self) -> str: 20 | return self.data().data().decode() 21 | 22 | 23 | if __name__ == "__main__": 24 | datagram = NetworkDatagram() 25 | -------------------------------------------------------------------------------- /prettyqt/network/tcpserver.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core, network 4 | 5 | 6 | class TcpServer(core.ObjectMixin, network.QTcpServer): 7 | """TCP-based server.""" 8 | 9 | def listen( # type: ignore 10 | self, address: str | network.QHostAddress, port: int = 0 11 | ) -> bool: 12 | if isinstance(address, str): 13 | address = network.HostAddress(address) 14 | return super().listen(address, port) 15 | 16 | def get_server_address(self) -> network.HostAddress: 17 | return network.HostAddress(self.serverAddress()) 18 | 19 | def get_proxy(self) -> network.NetworkProxy: 20 | return network.NetworkProxy(self.proxy()) 21 | 22 | def get_server_error(self) -> network.abstractsocket.SocketErrorStr: 23 | return network.abstractsocket.SOCKET_ERROR.inverse[self.serverError()] 24 | -------------------------------------------------------------------------------- /prettyqt/network/tcpsocket.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import network 4 | 5 | 6 | class TcpSocket(network.AbstractSocketMixin, network.QTcpSocket): 7 | """TCP Socket.""" 8 | -------------------------------------------------------------------------------- /prettyqt/network/udpsocket.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import network 4 | 5 | 6 | class UdpSocket(network.AbstractSocketMixin, network.QUdpSocket): 7 | """UDP Socket.""" 8 | 9 | def get_multicast_interface(self) -> network.NetworkInterface: 10 | return network.NetworkInterface(self.multicastInterface()) 11 | 12 | def receive_datagram(self, max_size: int | None = None) -> network.NetworkDatagram: 13 | if max_size is None: 14 | max_size = -1 15 | return network.NetworkDatagram(self.receiveDatagram(max_size)) 16 | 17 | 18 | if __name__ == "__main__": 19 | socket = UdpSocket() 20 | socket.bind_to("localhost") 21 | socket.get_multicast_interface() 22 | socket.receive_datagram() 23 | -------------------------------------------------------------------------------- /prettyqt/openglwidgets/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt.QtOpenGLWidgets import * # noqa: F403 4 | 5 | from .openglwidget import OpenGLWidget 6 | from prettyqt.qt import QtOpenGLWidgets 7 | 8 | QT_MODULE = QtOpenGLWidgets 9 | 10 | 11 | __all__ = ["OpenGLWidget"] 12 | -------------------------------------------------------------------------------- /prettyqt/paths.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from importlib import resources 4 | import pathlib 5 | 6 | 7 | ROOT_PATH = pathlib.Path(resources.files("prettyqt")) # type: ignore 8 | 9 | LOCALIZATION_PATH = ROOT_PATH / "localization" 10 | THEMES_PATH = ROOT_PATH / "resources" / "themes" 11 | RE_LEXER_PATH = ( 12 | ROOT_PATH / "syntaxhighlighters" / "custom_highlighters" / "regularexpressionlexer.py" 13 | ) 14 | ICON_FONT_PATH = ROOT_PATH / "iconprovider" / "fonts" 15 | 16 | DOCS_PATH = ROOT_PATH.parent / "docs" 17 | INV_FILE = DOCS_PATH / "qt6.inv" 18 | -------------------------------------------------------------------------------- /prettyqt/pdf/__init__.py: -------------------------------------------------------------------------------- 1 | """Classes and functions for rendering PDF documents.""" 2 | 3 | from __future__ import annotations 4 | 5 | from prettyqt.qt.QtPdf import * # noqa: F403 6 | 7 | from .pdfbookmarkmodel import PdfBookmarkModel 8 | from .pdfdocument import PdfDocument 9 | from .pdfsearchmodel import PdfSearchModel 10 | from prettyqt.qt import QtPdf 11 | 12 | QT_MODULE = QtPdf 13 | 14 | 15 | __all__ = ["PdfBookmarkModel", "PdfDocument", "PdfSearchModel"] 16 | -------------------------------------------------------------------------------- /prettyqt/pdfwidgets/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt.QtPdfWidgets import * # noqa: F403 4 | 5 | from .pdfview import PdfView 6 | from prettyqt.qt import QtPdfWidgets 7 | 8 | QT_MODULE = QtPdfWidgets 9 | 10 | __all__ = ["PdfView"] 11 | -------------------------------------------------------------------------------- /prettyqt/positioning/geoaddress.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt import QtPositioning 4 | 5 | 6 | class GeoAddress(QtPositioning.QGeoAddress): 7 | def __str__(self): 8 | return self.text() 9 | -------------------------------------------------------------------------------- /prettyqt/positioning/geolocation.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import positioning 4 | from prettyqt.qt import QtPositioning 5 | 6 | 7 | class GeoLocation(QtPositioning.QGeoLocation): 8 | def get_address(self) -> positioning.GeoAddress: 9 | return positioning.GeoAddress(self.address()) 10 | 11 | def get_coordinate(self) -> positioning.GeoCoordinate: 12 | return positioning.GeoCoordinate(self.coordinate()) 13 | 14 | def get_bounding_shape(self) -> positioning.GeoShape: 15 | return positioning.GeoShape(self.boundingShape()) 16 | 17 | 18 | if __name__ == "__main__": 19 | location = GeoLocation() 20 | -------------------------------------------------------------------------------- /prettyqt/positioning/georectangle.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import positioning 4 | from prettyqt.qt import QtPositioning 5 | from prettyqt.utils import get_repr 6 | 7 | 8 | class GeoRectangle(positioning.GeoShapeMixin, QtPositioning.QGeoRectangle): 9 | def __repr__(self): 10 | return get_repr(self, self.get_top_left(), self.get_bottom_right()) 11 | 12 | def get_top_left(self) -> positioning.GeoCoordinate: 13 | return positioning.GeoCoordinate(self.topLeft()) 14 | 15 | def get_bottom_right(self) -> positioning.GeoCoordinate: 16 | return positioning.GeoCoordinate(self.bottomRight()) 17 | 18 | 19 | if __name__ == "__main__": 20 | coord1 = positioning.GeoCoordinate(1, 1) 21 | coord2 = positioning.GeoCoordinate(11, 11) 22 | rect = GeoRectangle(coord1, coord2) 23 | -------------------------------------------------------------------------------- /prettyqt/positioning/geoshape.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt import QtPositioning 4 | from prettyqt.utils import bidict 5 | 6 | 7 | SHAPE_TYPES = bidict( 8 | unknown=QtPositioning.QGeoShape.ShapeType.UnknownType, 9 | rectangle=QtPositioning.QGeoShape.ShapeType.RectangleType, 10 | circle=QtPositioning.QGeoShape.ShapeType.CircleType, 11 | path=QtPositioning.QGeoShape.ShapeType.PathType, 12 | polygon=QtPositioning.QGeoShape.ShapeType.PolygonType, 13 | ) 14 | 15 | 16 | class GeoShapeMixin: 17 | def __contains__(self, other: QtPositioning.QGeoCoordinate): 18 | return self.contains(other) 19 | 20 | def __str__(self): 21 | return self.toString()[1:] 22 | 23 | def get_type(self) -> str: 24 | return SHAPE_TYPES.inverse[self.type()] 25 | 26 | 27 | class GeoShape(GeoShapeMixin, QtPositioning.QGeoShape): 28 | pass 29 | -------------------------------------------------------------------------------- /prettyqt/prettyqtmarkdown/__init__.py: -------------------------------------------------------------------------------- 1 | """Module containing stuff to help buidling docs. 2 | 3 | This module builds on mknodes and contains some new nodes to help building documentation, 4 | an MkItemModelTable to easily display Qt ItemModels as Markdown Tables 5 | as well as a model + widget to preview a generated mknodes tree. 6 | 7 | """ 8 | 9 | from __future__ import annotations 10 | 11 | from .qtlinkprovider import QtLinkProvider 12 | from .markdownmodel import MkNodesModel 13 | from .markdownwidget import MarkdownWidget 14 | from .mkitemmodeltable import MkItemModelTable 15 | from .mkprettyqtdiagram import MkPrettyQtDiagram 16 | from .mkpropertytable import MkPropertyTable 17 | from .mkwidgetscreenshot import MkWidgetScreenShot 18 | 19 | 20 | __all__ = [ 21 | "MarkdownWidget", 22 | "MkItemModelTable", 23 | "MkNodesModel", 24 | "MkPrettyQtDiagram", 25 | "MkPropertyTable", 26 | "MkWidgetScreenShot", 27 | "QtLinkProvider", 28 | ] 29 | -------------------------------------------------------------------------------- /prettyqt/prettyqtmarkdown/qtlinkprovider.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | import logging 4 | 5 | from mknodes.info import linkprovider 6 | 7 | 8 | logger = logging.getLogger(__name__) 9 | 10 | 11 | class QtLinkProvider(linkprovider.LinkProvider): 12 | def link_for_klass(self, kls: type): 13 | mod_path = kls.__module__ 14 | if mod_path.startswith("prettyqt"): 15 | return linkprovider.linked(kls.__qualname__) 16 | return super().link_for_klass(kls) 17 | 18 | 19 | if __name__ == "__main__": 20 | provider = QtLinkProvider() 21 | -------------------------------------------------------------------------------- /prettyqt/printsupport/__init__.py: -------------------------------------------------------------------------------- 1 | """Classes to make printing easier and more portable.""" 2 | 3 | from __future__ import annotations 4 | 5 | from prettyqt.qt.QtPrintSupport import * # noqa: F403 6 | 7 | from .printer import Printer 8 | from .abstractprintdialog import AbstractPrintDialog, AbstractPrintDialogMixin 9 | from .printdialog import PrintDialog 10 | from .pagesetupdialog import PageSetupDialog 11 | from .printengine import PrintEngine 12 | from .printpreviewwidget import PrintPreviewWidget 13 | from .printpreviewdialog import PrintPreviewDialog 14 | from prettyqt.qt import QtPrintSupport 15 | 16 | QT_MODULE = QtPrintSupport 17 | 18 | __all__ = [ 19 | "AbstractPrintDialog", 20 | "AbstractPrintDialogMixin", 21 | "PageSetupDialog", 22 | "PrintDialog", 23 | "PrintEngine", 24 | "PrintPreviewDialog", 25 | "PrintPreviewWidget", 26 | "Printer", 27 | ] 28 | -------------------------------------------------------------------------------- /prettyqt/printsupport/pagesetupdialog.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | from prettyqt.qt import QtPrintSupport 5 | 6 | 7 | class PageSetupDialog(widgets.DialogMixin, QtPrintSupport.QPageSetupDialog): 8 | """Configuration dialog for the page-related options on a printer.""" 9 | 10 | @classmethod 11 | def setup_example(cls): 12 | return None 13 | 14 | 15 | if __name__ == "__main__": 16 | from prettyqt import widgets 17 | 18 | app = widgets.app() 19 | dlg = PageSetupDialog() 20 | dlg.show() 21 | -------------------------------------------------------------------------------- /prettyqt/printsupport/printdialog.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import printsupport 4 | 5 | 6 | class PrintDialog(printsupport.AbstractPrintDialogMixin, printsupport.QPrintDialog): 7 | """Dialog for specifying the printer's configuration.""" 8 | 9 | @classmethod 10 | def setup_example(cls): 11 | return None 12 | 13 | 14 | if __name__ == "__main__": 15 | from prettyqt import widgets 16 | 17 | app = widgets.app() 18 | dlg = PrintDialog() 19 | dlg.show() 20 | -------------------------------------------------------------------------------- /prettyqt/printsupport/printpreviewdialog.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | from prettyqt.qt import QtPrintSupport 5 | 6 | 7 | class PrintPreviewDialog(widgets.DialogMixin, QtPrintSupport.QPrintPreviewDialog): 8 | """Dialog for previewing and configuring page layouts for printer output.""" 9 | 10 | @classmethod 11 | def setup_example(cls): 12 | return None 13 | 14 | 15 | if __name__ == "__main__": 16 | from prettyqt import widgets 17 | 18 | app = widgets.app() 19 | dlg = PrintPreviewDialog() 20 | dlg.show() 21 | -------------------------------------------------------------------------------- /prettyqt/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/py.typed -------------------------------------------------------------------------------- /prettyqt/qml/jsvalueiterator.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt import QtQml 4 | 5 | 6 | class JSValueIterator(QtQml.QJSValueIterator): 7 | """Java-style iterator for JSValue.""" 8 | 9 | def __iter__(self): 10 | return self 11 | 12 | def __next__(self): 13 | if self.next(): 14 | return (self.name(), self.value().toVariant()) 15 | raise StopIteration 16 | -------------------------------------------------------------------------------- /prettyqt/qml/qmlerror.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | from prettyqt.qt import QtQml 5 | from prettyqt.utils import get_repr 6 | 7 | 8 | class QmlError(QtQml.QQmlError): 9 | """Encapsulates a QML error.""" 10 | 11 | def __repr__(self): 12 | return get_repr(self, self.toString()) 13 | 14 | def get_url(self) -> core.Url: 15 | return core.Url(self.url()) 16 | 17 | def get_property(self) -> core.MetaProperty: 18 | return core.MetaProperty(self.property()) 19 | 20 | def __str__(self): 21 | return self.toString() 22 | 23 | 24 | if __name__ == "__main__": 25 | error = QmlError() 26 | -------------------------------------------------------------------------------- /prettyqt/qml/qmlexpression.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | import pathlib 4 | 5 | from prettyqt import core, qml 6 | 7 | 8 | class QmlExpression(core.ObjectMixin, qml.QQmlExpression): 9 | """Evaluates JavaScript in a QML context.""" 10 | 11 | def get_source_file(self) -> pathlib.Path | None: 12 | return pathlib.Path(source) if (source := self.sourceFile()) else None 13 | 14 | def get_error(self) -> qml.QmlError: 15 | return qml.QmlError(self.error()) 16 | 17 | 18 | if __name__ == "__main__": 19 | exp = QmlExpression() 20 | print(exp.get_error()) 21 | -------------------------------------------------------------------------------- /prettyqt/qml/qmlimageproviderbase.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt import QtQml 4 | from prettyqt.utils import bidict 5 | 6 | 7 | mod = QtQml.QQmlImageProviderBase 8 | 9 | FLAGS = bidict( 10 | force_async_image_loading=mod.Flag.ForceAsynchronousImageLoading, 11 | ) 12 | 13 | 14 | IMAGE_TYPE = bidict( 15 | image=mod.ImageType.Image, 16 | pixmap=mod.ImageType.Pixmap, 17 | texture=mod.ImageType.Texture, 18 | image_response=mod.ImageType.ImageResponse, 19 | ) 20 | 21 | 22 | class QmlImageProviderBaseMixin: 23 | pass 24 | 25 | 26 | class QmlImageProviderBase(QmlImageProviderBaseMixin, QtQml.QQmlImageProviderBase): 27 | """Used to register image providers in the QML engine.""" 28 | -------------------------------------------------------------------------------- /prettyqt/qml/qmlparserstatus.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt import QtQml 4 | 5 | 6 | class QmlParserStatusMixin: 7 | pass 8 | 9 | 10 | class QmlParserStatus(QmlParserStatusMixin, QtQml.QQmlParserStatus): 11 | """Updates on the QML parser state.""" 12 | -------------------------------------------------------------------------------- /prettyqt/qt/Qsci/__init__.py: -------------------------------------------------------------------------------- 1 | """Provides QtStateMachine classes and functions.""" 2 | 3 | from prettyqt.qt import PYQT6 4 | 5 | 6 | if PYQT6: 7 | from PyQt6.Qsci import * 8 | else: 9 | raise ModuleNotFoundError("No Qt bindings could be found") 10 | -------------------------------------------------------------------------------- /prettyqt/qt/QtAsyncio/__init__.py: -------------------------------------------------------------------------------- 1 | """Provides QtAsyncio classes and functions.""" 2 | 3 | from prettyqt.qt import PYSIDE6 4 | 5 | 6 | if PYSIDE6: 7 | from PySide6.QtAsyncio import * # noqa: F403 # type: ignore 8 | else: 9 | msg = "No Qt bindings could be found" 10 | raise ModuleNotFoundError(msg) 11 | -------------------------------------------------------------------------------- /prettyqt/qt/QtBluetooth/__init__.py: -------------------------------------------------------------------------------- 1 | """Provides QtBluetooth classes and functions.""" 2 | 3 | from prettyqt.qt import PYSIDE6 4 | 5 | 6 | if PYSIDE6: 7 | from PySide6.QtBluetooth import * 8 | else: 9 | raise ModuleNotFoundError("No Qt bindings could be found") 10 | -------------------------------------------------------------------------------- /prettyqt/qt/QtCharts/__init__.py: -------------------------------------------------------------------------------- 1 | """Provides QtCharts classes and functions.""" 2 | 3 | from prettyqt.qt import PYQT6, PYSIDE6 4 | 5 | 6 | if PYQT6: 7 | try: 8 | from PyQt6.QtCharts import * 9 | except ImportError: 10 | raise ModuleNotFoundError( 11 | "The QtChart module was not found. " 12 | "It needs to be installed separately for PyQt6." 13 | ) 14 | 15 | elif PYSIDE6: 16 | from PySide6.QtCharts import * 17 | else: 18 | raise ModuleNotFoundError("No Qt bindings could be found") 19 | -------------------------------------------------------------------------------- /prettyqt/qt/QtDesigner/__init__.py: -------------------------------------------------------------------------------- 1 | """Provides QtDesigner classes and functions.""" 2 | 3 | from prettyqt.qt import PYQT6, PYSIDE6 4 | 5 | 6 | if PYQT6: 7 | from PyQt6.QtDesigner import * 8 | elif PYSIDE6: 9 | from PySide6.QtDesigner import * 10 | else: 11 | raise ModuleNotFoundError("No Qt bindings could be found") 12 | -------------------------------------------------------------------------------- /prettyqt/qt/QtHelp/__init__.py: -------------------------------------------------------------------------------- 1 | """Provides QtHelp classes and functions.""" 2 | 3 | from prettyqt.qt import PYQT6, PYSIDE6 4 | 5 | 6 | if PYQT6: 7 | from PyQt6.QtHelp import * 8 | elif PYSIDE6: 9 | from PySide6.QtHelp import * 10 | else: 11 | raise ModuleNotFoundError("No Qt bindings could be found") 12 | -------------------------------------------------------------------------------- /prettyqt/qt/QtLocation/__init__.py: -------------------------------------------------------------------------------- 1 | """Provides QtLocation classes and functions.""" 2 | 3 | from prettyqt.qt import PYQT6, PYSIDE6 4 | 5 | 6 | if PYQT6: 7 | from PyQt6.QtLocation import * 8 | elif PYSIDE6: 9 | from PySide6.QtLocation import * # type: ignore 10 | else: 11 | raise ModuleNotFoundError("No Qt bindings could be found") 12 | -------------------------------------------------------------------------------- /prettyqt/qt/QtMultimedia/__init__.py: -------------------------------------------------------------------------------- 1 | """Provides QtMultimedia classes and functions.""" 2 | 3 | from prettyqt.qt import PYQT6, PYSIDE6 4 | 5 | 6 | if PYSIDE6: 7 | from PySide6.QtMultimedia import * 8 | elif PYQT6: 9 | from PyQt6.QtMultimedia import * 10 | else: 11 | raise ModuleNotFoundError("No Qt bindings could be found") 12 | -------------------------------------------------------------------------------- /prettyqt/qt/QtMultimediaWidgets/__init__.py: -------------------------------------------------------------------------------- 1 | """Provides QtMultimediaWidgets classes and functions.""" 2 | 3 | from prettyqt.qt import PYQT6, PYSIDE6 4 | 5 | 6 | if PYQT6: 7 | from PyQt6.QtMultimediaWidgets import * 8 | elif PYSIDE6: 9 | from PySide6.QtMultimediaWidgets import * 10 | else: 11 | raise ModuleNotFoundError("No Qt bindings could be found") 12 | -------------------------------------------------------------------------------- /prettyqt/qt/QtNetwork/__init__.py: -------------------------------------------------------------------------------- 1 | """Provides QtNetwork classes and functions.""" 2 | 3 | from prettyqt.qt import PYQT6, PYSIDE6 4 | 5 | 6 | if PYQT6: 7 | from PyQt6.QtNetwork import * 8 | elif PYSIDE6: 9 | from PySide6.QtNetwork import * # type: ignore 10 | else: 11 | raise ModuleNotFoundError("No Qt bindings could be found") 12 | -------------------------------------------------------------------------------- /prettyqt/qt/QtOpenGLWidgets/__init__.py: -------------------------------------------------------------------------------- 1 | """Provides QtOpenGLWidgets classes and functions.""" 2 | 3 | from prettyqt.qt import PYQT6, PYSIDE6 4 | 5 | 6 | if PYQT6: 7 | from PyQt6.QtOpenGLWidgets import * 8 | elif PYSIDE6: 9 | from PySide6.QtOpenGLWidgets import * 10 | else: 11 | raise ModuleNotFoundError("No Qt bindings could be found") 12 | -------------------------------------------------------------------------------- /prettyqt/qt/QtPdf/__init__.py: -------------------------------------------------------------------------------- 1 | """Provides QtPdf classes and functions.""" 2 | 3 | from prettyqt.qt import PYQT6, PYSIDE6 4 | 5 | 6 | if PYQT6: 7 | from PyQt6.QtPdf import * 8 | elif PYSIDE6: 9 | from PySide6.QtPdf import * 10 | else: 11 | raise ModuleNotFoundError("No Qt bindings could be found") 12 | -------------------------------------------------------------------------------- /prettyqt/qt/QtPdfWidgets/__init__.py: -------------------------------------------------------------------------------- 1 | """Provides QtPdfWidgets classes and functions.""" 2 | 3 | from prettyqt.qt import PYQT6, PYSIDE6 4 | 5 | 6 | if PYQT6: 7 | from PyQt6.QtPdfWidgets import * 8 | elif PYSIDE6: 9 | from PySide6.QtPdfWidgets import * 10 | else: 11 | raise ModuleNotFoundError("No Qt bindings could be found") 12 | -------------------------------------------------------------------------------- /prettyqt/qt/QtPositioning/__init__.py: -------------------------------------------------------------------------------- 1 | """Provides QtPositioning classes and functions.""" 2 | 3 | from prettyqt.qt import PYQT6, PYSIDE6 4 | 5 | 6 | if PYSIDE6: 7 | from PySide6.QtPositioning import * 8 | elif PYQT6: 9 | from PyQt6.QtPositioning import * 10 | else: 11 | raise ModuleNotFoundError("No Qt bindings could be found") 12 | -------------------------------------------------------------------------------- /prettyqt/qt/QtPrintSupport/__init__.py: -------------------------------------------------------------------------------- 1 | """Provides QtPrintSupport classes and functions.""" 2 | 3 | from prettyqt.qt import PYQT6, PYSIDE6 4 | 5 | 6 | if PYQT6: 7 | from PyQt6.QtPrintSupport import * 8 | elif PYSIDE6: 9 | from PySide6.QtPrintSupport import * # type: ignore 10 | else: 11 | raise ModuleNotFoundError("No Qt bindings could be found") 12 | -------------------------------------------------------------------------------- /prettyqt/qt/QtQml/__init__.py: -------------------------------------------------------------------------------- 1 | """Provides QtQml classes and functions.""" 2 | 3 | from prettyqt.qt import PYQT6, PYSIDE6 4 | 5 | 6 | if PYQT6: 7 | from PyQt6.QtQml import * 8 | elif PYSIDE6: 9 | from PySide6.QtQml import * # type: ignore 10 | else: 11 | raise ModuleNotFoundError("No Qt bindings could be found") 12 | -------------------------------------------------------------------------------- /prettyqt/qt/QtQuick/__init__.py: -------------------------------------------------------------------------------- 1 | """Provides QtQuick classes and functions.""" 2 | 3 | from prettyqt.qt import PYQT6, PYSIDE6 4 | 5 | 6 | if PYQT6: 7 | from PyQt6.QtQuick import * 8 | elif PYSIDE6: 9 | from PySide6.QtQuick import * # type: ignore 10 | else: 11 | raise ModuleNotFoundError("No Qt bindings could be found") 12 | -------------------------------------------------------------------------------- /prettyqt/qt/QtQuickWidgets/__init__.py: -------------------------------------------------------------------------------- 1 | """Provides QtQuickWidgets classes and functions.""" 2 | 3 | from prettyqt.qt import PYQT6, PYSIDE6 4 | 5 | 6 | if PYQT6: 7 | from PyQt6.QtQuickWidgets import * 8 | elif PYSIDE6: 9 | from PySide6.QtQuickWidgets import * # type: ignore 10 | else: 11 | raise ModuleNotFoundError("No Qt bindings could be found") 12 | -------------------------------------------------------------------------------- /prettyqt/qt/QtScxml/__init__.py: -------------------------------------------------------------------------------- 1 | """Provides QtScxml classes and functions.""" 2 | 3 | from prettyqt.qt import PYQT6, PYSIDE6 4 | 5 | 6 | if PYQT6: 7 | from PyQt6.QtScxml import * 8 | elif PYSIDE6: 9 | from PySide6.QtScxml import * 10 | else: 11 | raise ModuleNotFoundError("No Qt bindings could be found") 12 | -------------------------------------------------------------------------------- /prettyqt/qt/QtSpatialAudio/__init__.py: -------------------------------------------------------------------------------- 1 | """Provides QtSpatialAudio classes and functions.""" 2 | 3 | from prettyqt.qt import PYQT6, PYSIDE6 4 | 5 | 6 | if PYQT6: 7 | from PyQt6.QtSpatialAudio import * 8 | elif PYSIDE6: 9 | from PySide6.QtSpatialAudio import * 10 | else: 11 | raise ModuleNotFoundError("No Qt bindings could be found") 12 | -------------------------------------------------------------------------------- /prettyqt/qt/QtStateMachine/__init__.py: -------------------------------------------------------------------------------- 1 | """Provides QtStateMachine classes and functions.""" 2 | 3 | from prettyqt.qt import PYSIDE6 4 | 5 | 6 | # elif PYQT6: 7 | # from PyQt6.QtStateMachine import * 8 | if PYSIDE6: 9 | from PySide6.QtStateMachine import * 10 | else: 11 | raise ModuleNotFoundError("No Qt bindings could be found") 12 | -------------------------------------------------------------------------------- /prettyqt/qt/QtSvg/__init__.py: -------------------------------------------------------------------------------- 1 | """Provides QtSvg classes and functions.""" 2 | 3 | from prettyqt.qt import PYQT6, PYSIDE6 4 | 5 | 6 | if PYQT6: 7 | from PyQt6.QtSvg import * 8 | elif PYSIDE6: 9 | from PySide6.QtSvg import * 10 | from PySide6.QtSvgWidgets import QGraphicsSvgItem, QSvgWidget # type: ignore 11 | else: 12 | raise ModuleNotFoundError("No Qt bindings could be found") 13 | -------------------------------------------------------------------------------- /prettyqt/qt/QtSvgWidgets/__init__.py: -------------------------------------------------------------------------------- 1 | """Provides QtSvg classes and functions.""" 2 | 3 | from prettyqt.qt import PYQT6, PYSIDE6 4 | 5 | 6 | if PYQT6: 7 | from PyQt6.QtSvgWidgets import * 8 | elif PYSIDE6: 9 | from PySide6.QtSvgWidgets import * 10 | else: 11 | raise ModuleNotFoundError("No Qt bindings could be found") 12 | -------------------------------------------------------------------------------- /prettyqt/qt/QtTest/__init__.py: -------------------------------------------------------------------------------- 1 | """Provides QtTest classes and functions.""" 2 | 3 | from prettyqt.qt import PYQT6, PYSIDE6 4 | 5 | 6 | if PYQT6: 7 | from PyQt6.QtTest import * 8 | elif PYSIDE6: 9 | from PySide6.QtTest import * # type: ignore 10 | else: 11 | raise ModuleNotFoundError("No Qt bindings could be found") 12 | -------------------------------------------------------------------------------- /prettyqt/qt/QtTextToSpeech/__init__.py: -------------------------------------------------------------------------------- 1 | """Provides QtTextToSpeech classes and functions.""" 2 | 3 | from prettyqt.qt import PYQT6, PYSIDE6 4 | 5 | 6 | if PYQT6: 7 | from PyQt6.QtTextToSpeech import * 8 | elif PYSIDE6: 9 | from PySide6.QtTextToSpeech import * 10 | else: 11 | raise ModuleNotFoundError("No Qt bindings could be found") 12 | -------------------------------------------------------------------------------- /prettyqt/qt/QtUiTools/__init__.py: -------------------------------------------------------------------------------- 1 | """Provides QtTest classes and functions.""" 2 | 3 | from prettyqt.qt import PYSIDE6 4 | 5 | 6 | if PYSIDE6: 7 | from PySide6.QtUiTools import QUiLoader, loadUiType # type: ignore 8 | 9 | RCC_CMD = "pyside6-rcc --no-compress --verbose" 10 | LUPDATE_CMD = "pyside6-lupdate -verbose" 11 | UIC_CMD = "pyside6-uic" 12 | else: 13 | raise ModuleNotFoundError("No Qt bindings could be found") 14 | -------------------------------------------------------------------------------- /prettyqt/qt/QtWebChannel/__init__.py: -------------------------------------------------------------------------------- 1 | """Provides QtWebEngineCore classes and functions.""" 2 | 3 | from prettyqt.qt import PYQT6, PYSIDE6 4 | 5 | 6 | if PYSIDE6: 7 | from PySide6.QtWebChannel import * 8 | elif PYQT6: 9 | from PyQt6.QtWebChannel import * 10 | else: 11 | raise ModuleNotFoundError("No Qt bindings could be found") 12 | -------------------------------------------------------------------------------- /prettyqt/qt/QtWebEngineCore/__init__.py: -------------------------------------------------------------------------------- 1 | """Provides QtWebEngineCore classes and functions.""" 2 | 3 | from prettyqt.qt import PYQT6, PYSIDE6 4 | 5 | 6 | if PYQT6: 7 | from PyQt6.QtWebEngineCore import * 8 | elif PYSIDE6: 9 | from PySide6.QtWebEngineCore import * 10 | else: 11 | raise ModuleNotFoundError("No Qt bindings could be found") 12 | -------------------------------------------------------------------------------- /prettyqt/qt/QtWebEngineWidgets/__init__.py: -------------------------------------------------------------------------------- 1 | """Provides widgets to embed browser components in the user interface.""" 2 | 3 | from prettyqt.qt import PYQT6, PYSIDE6 4 | 5 | 6 | if PYQT6: 7 | from PyQt6.QtWebEngineWidgets import * 8 | elif PYSIDE6: 9 | from PySide6.QtWebEngineWidgets import * 10 | else: 11 | raise ModuleNotFoundError("No Qt bindings could be found") 12 | -------------------------------------------------------------------------------- /prettyqt/qt/QtWidgets/__init__.py: -------------------------------------------------------------------------------- 1 | """Provides QtWidgets classes and functions.""" 2 | 3 | from prettyqt.qt import PYQT6, PYSIDE6 4 | 5 | 6 | if PYQT6: 7 | from PyQt6.QtWidgets import * 8 | from PyQt6.QtGui import QFileSystemModel 9 | 10 | elif PYSIDE6: 11 | from PySide6.QtWidgets import * 12 | else: 13 | raise ModuleNotFoundError("No Qt bindings could be found") 14 | -------------------------------------------------------------------------------- /prettyqt/qthelp/helpcontentitem.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from typing import TYPE_CHECKING 4 | 5 | from prettyqt import core 6 | 7 | 8 | if TYPE_CHECKING: 9 | from prettyqt.qt import QtHelp 10 | 11 | 12 | class HelpContentItem: 13 | """Item for use with QHelpContentModel.""" 14 | 15 | def __init__(self, item: QtHelp.QHelpContentItem): 16 | self.item = item 17 | 18 | def __getattr__(self, val): 19 | return getattr(self.item, val) 20 | 21 | def __len__(self): 22 | return self.childCount() 23 | 24 | def get_url(self) -> core.Url: 25 | return core.Url(self.url()) 26 | -------------------------------------------------------------------------------- /prettyqt/qthelp/helpcontentmodel.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core, qthelp 4 | 5 | 6 | class HelpContentModel(core.AbstractItemModelMixin): 7 | """Model that supplies content to views.""" 8 | 9 | def __init__(self, item: qthelp.QHelpContentModel): 10 | self.item = item 11 | 12 | def __getattr__(self, val): 13 | return getattr(self.item, val) 14 | 15 | def get_content_item_at(self, index) -> qthelp.HelpContentItem: 16 | return qthelp.HelpContentItem(self.contentItemAt(index)) 17 | -------------------------------------------------------------------------------- /prettyqt/qthelp/helpcontentwidget.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from typing import TYPE_CHECKING 4 | 5 | from prettyqt import widgets 6 | from prettyqt.qt import QtCore, QtHelp 7 | 8 | 9 | if TYPE_CHECKING: 10 | from prettyqt.utils import datatypes 11 | 12 | 13 | class HelpContentWidget(widgets.TreeViewMixin, QtHelp.QHelpContentWidget): 14 | """Tree view for displaying help content model items.""" 15 | 16 | def index_of(self, url: datatypes.UrlType) -> QtCore.QModelIndex | None: 17 | if isinstance(url, str): 18 | url = QtCore.QUrl(url) 19 | idx = self.indexOf(url) 20 | return idx if idx.isValid() else None 21 | 22 | @classmethod 23 | def setup_example(cls): 24 | return None 25 | -------------------------------------------------------------------------------- /prettyqt/qthelp/helpengine.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import qthelp 4 | 5 | 6 | class HelpEngine(qthelp.HelpEngineCoreMixin, qthelp.QHelpEngine): 7 | """Access to contents and indices of the help engine.""" 8 | 9 | def get_content_model(self) -> qthelp.HelpContentModel: 10 | return qthelp.HelpContentModel(self.contentModel()) 11 | 12 | 13 | if __name__ == "__main__": 14 | engine = HelpEngine("") 15 | engine.get_files("a", "b") 16 | -------------------------------------------------------------------------------- /prettyqt/qthelp/helpfilterdata.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | from prettyqt.qt import QtHelp 5 | 6 | 7 | class HelpFilterDataMixin: 8 | def get_versions(self) -> list[core.VersionNumber]: 9 | return [core.VersionNumber(i) for i in self.versions()] 10 | 11 | def set_versions(self, versions: list[core.QVersionNumber]): 12 | self.setVersions(versions) 13 | 14 | 15 | class HelpFilterData(HelpFilterDataMixin): 16 | """Details for the filters used by QHelpFilterEngine.""" 17 | 18 | def __init__(self, item: QtHelp.QHelpFilterData): 19 | self.item = item 20 | 21 | def __getattr__(self, val): 22 | return getattr(self.item, val) 23 | 24 | 25 | if __name__ == "__main__": 26 | data = HelpFilterData(QtHelp.QHelpFilterData()) 27 | print(data.get_versions()) 28 | -------------------------------------------------------------------------------- /prettyqt/qthelp/helpfilterengine.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core, qthelp 4 | 5 | 6 | class HelpFilterEngine(core.ObjectMixin): 7 | """Filtered view of the help contents.""" 8 | 9 | def __init__(self, item: qthelp.QHelpFilterEngine): 10 | self.item = item 11 | 12 | def __getattr__(self, val): 13 | return getattr(self.item, val) 14 | 15 | def get_available_versions(self) -> list[core.VersionNumber]: 16 | return [core.VersionNumber(i) for i in self.availableVersions()] 17 | 18 | def get_filter_data(self, filter_name: str) -> qthelp.HelpFilterData: 19 | return qthelp.HelpFilterData(self.filterData(filter_name)) 20 | 21 | 22 | if __name__ == "__main__": 23 | core_engine = qthelp.HelpEngineCore("test") 24 | engine = HelpFilterEngine(core_engine) 25 | print(engine.get_filter_data("a")) 26 | -------------------------------------------------------------------------------- /prettyqt/qthelp/helpfiltersettingswidget.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | from prettyqt.qt import QtHelp 5 | 6 | 7 | class HelpFilterSettingsWidget(widgets.WidgetMixin, QtHelp.QHelpFilterSettingsWidget): 8 | """Widget that allows for creating, editing and removing filters.""" 9 | 10 | 11 | if __name__ == "__main__": 12 | app = widgets.app() 13 | widget = HelpFilterSettingsWidget() 14 | widget.show() 15 | app.exec() 16 | -------------------------------------------------------------------------------- /prettyqt/qthelp/helpindexmodel.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | from prettyqt.qt import QtHelp 5 | 6 | 7 | class HelpIndexModel(core.StringListModelMixin, QtHelp.QHelpIndexModel): 8 | """Model that supplies index keywords to views.""" 9 | -------------------------------------------------------------------------------- /prettyqt/qthelp/helpindexwidget.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | from prettyqt.qt import QtHelp 5 | 6 | 7 | class HelpIndexWidget(widgets.ListViewMixin, QtHelp.QHelpIndexWidget): 8 | """List view displaying the QHelpIndexModel.""" 9 | 10 | @classmethod 11 | def setup_example(cls): 12 | return None 13 | -------------------------------------------------------------------------------- /prettyqt/qthelp/helplink.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from typing import TYPE_CHECKING 4 | 5 | from prettyqt import core 6 | 7 | 8 | if TYPE_CHECKING: 9 | from prettyqt.qt import QtHelp 10 | 11 | 12 | class HelpLink: 13 | """Struct provides the data associated with a help link.""" 14 | 15 | def __init__(self, item: QtHelp.QHelpLink): 16 | self.item = item 17 | 18 | def __getattr__(self, val): 19 | return getattr(self.item, val) 20 | 21 | def get_url(self) -> core.Url: 22 | return core.Url(self.url) 23 | -------------------------------------------------------------------------------- /prettyqt/qthelp/helpsearchengine.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core, qthelp 4 | 5 | 6 | class HelpSearchEngine(core.ObjectMixin, qthelp.QHelpSearchEngine): 7 | """Access to widgets reusable to integrate fulltext search.""" 8 | 9 | def search_results(self, start: int, end: int) -> list[qthelp.HelpSearchResult]: 10 | return [qthelp.HelpSearchResult(i) for i in self.searchResults(start, end)] 11 | 12 | def get_result_widget(self) -> qthelp.HelpSearchResultWidget: 13 | return qthelp.HelpSearchResultWidget(self.resultWidget()) 14 | 15 | 16 | if __name__ == "__main__": 17 | from prettyqt import widgets 18 | 19 | app = widgets.app() 20 | core_engine = qthelp.HelpEngineCore("test") 21 | engine = HelpSearchEngine(core_engine) 22 | widget = engine.get_result_widget() 23 | widget.show() 24 | app.exec() 25 | -------------------------------------------------------------------------------- /prettyqt/qthelp/helpsearchquerywidget.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | from prettyqt.qt import QtHelp 5 | 6 | 7 | class HelpSearchQueryWidget(widgets.WidgetMixin, QtHelp.QHelpSearchQueryWidget): 8 | """Widget to enable the user to input a search term in a standardized input mask.""" 9 | -------------------------------------------------------------------------------- /prettyqt/qthelp/helpsearchresult.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | from prettyqt.qt import QtHelp 5 | 6 | 7 | class HelpSearchResult(QtHelp.QHelpSearchResult): 8 | """The data associated with the search result.""" 9 | 10 | def get_url(self) -> core.Url: 11 | return core.Url(self.url()) 12 | -------------------------------------------------------------------------------- /prettyqt/quick/quickasyncimageprovider.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import quick 4 | from prettyqt.qt import QtQuick 5 | 6 | 7 | class QuickAsyncImageProvider( 8 | quick.QuickImageProviderMixin, QtQuick.QQuickAsyncImageProvider 9 | ): 10 | """Interface for asynchronous control of QML image requests.""" 11 | -------------------------------------------------------------------------------- /prettyqt/quick/quickimageprovider.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import qml 4 | from prettyqt.qt import QtQuick 5 | 6 | 7 | class QuickImageProviderMixin(qml.QmlImageProviderBaseMixin): 8 | pass 9 | 10 | 11 | class QuickImageProvider(QuickImageProviderMixin, QtQuick.QQuickImageProvider): 12 | """Interface for supporting pixmaps and threaded image requests in QML.""" 13 | -------------------------------------------------------------------------------- /prettyqt/quick/quickimageresponse.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | from prettyqt.qt import QtQuick 5 | 6 | 7 | class QuickImageResponse(core.ObjectMixin, QtQuick.QQuickImageResponse): 8 | """Interface for asynchronous image loading in QQuickAsyncImageProvider.""" 9 | 10 | 11 | if __name__ == "__main__": 12 | item = QuickImageResponse() 13 | -------------------------------------------------------------------------------- /prettyqt/quick/quickitemgrabresult.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from typing import TYPE_CHECKING 4 | 5 | from prettyqt import core, gui 6 | 7 | 8 | if TYPE_CHECKING: 9 | from prettyqt.qt import QtQuick 10 | 11 | 12 | class QuickItemGrabResult(core.ObjectMixin): 13 | """Contains the result from QQuickItem::grabToImage().""" 14 | 15 | def __init__(self, item: QtQuick.QQuickItemGrabResult): 16 | self.item = item 17 | 18 | def __getattr__(self, val): 19 | return getattr(self.item, val) 20 | 21 | def get_image(self) -> gui.Image: 22 | return gui.Image(self.image()) 23 | 24 | def get_url(self) -> core.Url: 25 | return core.Url(self.url()) 26 | 27 | 28 | # if __name__ == "__main__": 29 | # item = QuickItemGrabResult() 30 | -------------------------------------------------------------------------------- /prettyqt/quick/quickrendercontrol.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | import contextlib 4 | 5 | from prettyqt import core 6 | from prettyqt.qt import QtQuick 7 | 8 | 9 | class QuickRenderControl(core.ObjectMixin, QtQuick.QQuickRenderControl): 10 | """Mechanism for rendering the Qt Quick scenegraph onto an offscreen render target.""" 11 | 12 | @contextlib.contextmanager 13 | def edit_frame(self): 14 | self.beginFrame() 15 | yield None 16 | self.endFrame() 17 | 18 | 19 | if __name__ == "__main__": 20 | item = QuickRenderControl() 21 | -------------------------------------------------------------------------------- /prettyqt/quick/quicktextdocument.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | from prettyqt.qt import QtQuick 5 | 6 | 7 | class QuickTextDocument(core.ObjectMixin, QtQuick.QQuickTextDocument): 8 | """Access to the QTextDocument of QQuickTextEdit.""" 9 | 10 | 11 | if __name__ == "__main__": 12 | item = QtQuick.QQuickItem() 13 | doc = QuickTextDocument(item) 14 | -------------------------------------------------------------------------------- /prettyqt/quickwidgets/__init__.py: -------------------------------------------------------------------------------- 1 | """Provides a widget class for displaying a Qt Quick user interface.""" 2 | 3 | from __future__ import annotations 4 | 5 | from prettyqt.qt.QtQuickWidgets import * # noqa: F403 6 | 7 | from .quickwidget import QuickWidget 8 | from prettyqt.qt import QtQuickWidgets 9 | 10 | QT_MODULE = QtQuickWidgets 11 | 12 | __all__ = [ 13 | "QuickWidget", 14 | ] 15 | -------------------------------------------------------------------------------- /prettyqt/resources/close_black.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /prettyqt/resources/close_white.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /prettyqt/scintilla/__init__.py: -------------------------------------------------------------------------------- 1 | """Text editor component for Qt.""" 2 | 3 | from __future__ import annotations 4 | 5 | from .sciscintilla import SciScintilla 6 | from prettyqt.qt import Qsci 7 | 8 | QT_MODULE = Qsci 9 | 10 | __all__ = ["SciScintilla"] 11 | -------------------------------------------------------------------------------- /prettyqt/scxml/__init__.py: -------------------------------------------------------------------------------- 1 | """Provides classes / tools for creating and embedding state machines from SCXML files.""" 2 | 3 | from __future__ import annotations 4 | 5 | from prettyqt.qt.QtScxml import * # noqa: F403 6 | 7 | from .scxmlcompiler import ScxmlCompiler 8 | from scxmlstatemachine import ScxmlStateMachine 9 | from .scxmldatamodel import ScXmlDataModel 10 | from .scxmlcppdatamodel import ScXmlCppDataModel 11 | from .scxmlnulldatamodel import ScXmlNullDataModel 12 | from .scxmlinvokableservice import ScXmlInvokableService 13 | from .scxmlinvokableservicefactory import ScXmlInvokableServiceFactory 14 | from prettyqt.qt import QtScxml 15 | 16 | QT_MODULE = QtScxml 17 | 18 | __all__ = [ 19 | "ScXmlCppDataModel", 20 | "ScXmlDataModel", 21 | "ScXmlInvokableService", 22 | "ScXmlInvokableServiceFactory", 23 | "ScXmlNullDataModel", 24 | "ScxmlCompiler", 25 | "ScxmlStateMachine", 26 | ] 27 | -------------------------------------------------------------------------------- /prettyqt/scxml/scxmlcompiler.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | import pathlib 4 | 5 | from prettyqt.qt import QtScxml 6 | 7 | 8 | class ScxmlCompiler(QtScxml.QScxmlCompiler): 9 | """Compiler for SCXML files.""" 10 | 11 | def get_file_name(self) -> pathlib.Path: 12 | return pathlib.Path(self.fileName()) 13 | 14 | 15 | if __name__ == "__main__": 16 | from prettyqt.qt import QtCore 17 | 18 | reader = QtCore.QXmlStreamReader() 19 | compiler = ScxmlCompiler(reader) 20 | -------------------------------------------------------------------------------- /prettyqt/scxml/scxmlcppdatamodel.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import scxml 4 | 5 | 6 | class ScxmlCppDataModel( 7 | scxml.scxmldatamodel.ScxmlDataModelMixin, scxml.QScxmlCppDataModel 8 | ): 9 | """C++ data model for a Qt SCXML state machine.""" 10 | -------------------------------------------------------------------------------- /prettyqt/scxml/scxmldatamodel.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | from prettyqt.qt import QtScxml 5 | 6 | 7 | class ScxmlDataModelMixin(core.ObjectMixin): 8 | pass 9 | 10 | 11 | class ScxmlDataModel(ScxmlDataModelMixin, QtScxml.QScxmlDataModel): 12 | """The data model base class for a Qt SCXML state machine.""" 13 | -------------------------------------------------------------------------------- /prettyqt/scxml/scxmlinvokableservice.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | from prettyqt.qt import QtScxml 5 | 6 | 7 | class ScxmlInvokableService(core.ObjectMixin, QtScxml.QScxmlInvokableService): 8 | """The base class for services called from state machines.""" 9 | -------------------------------------------------------------------------------- /prettyqt/scxml/scxmlinvokableservicefactory.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | from prettyqt.qt import QtScxml 5 | 6 | 7 | class ScxmlInvokableServiceFactory( 8 | core.ObjectMixin, QtScxml.QScxmlInvokableServiceFactory 9 | ): 10 | """Creates invokable service instances.""" 11 | -------------------------------------------------------------------------------- /prettyqt/scxml/scxmlnulldatamodel.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import scxml 4 | 5 | 6 | class ScxmlNullDataModel( 7 | scxml.scxmldatamodel.ScxmlDataModelMixin, scxml.QScxmlNullDataModel 8 | ): 9 | """The null data model for a Qt SCXML stateMachine.""" 10 | -------------------------------------------------------------------------------- /prettyqt/scxml/scxmlstatemachine.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | from prettyqt.qt import QtScxml 5 | 6 | 7 | class ScxmlStateMachine(core.ObjectMixin, QtScxml.QScxmlStateMachine): 8 | """Interface to the state machines created from SCXML files.""" 9 | -------------------------------------------------------------------------------- /prettyqt/spatialaudio/__init__.py: -------------------------------------------------------------------------------- 1 | """Create sound scenes in 3D space containing different sound sources.""" 2 | 3 | from __future__ import annotations 4 | 5 | from prettyqt.qt.QtSpatialAudio import * # noqa: F403 6 | 7 | from .ambientsound import AmbientSound 8 | from .audioengine import AudioEngine 9 | from .audiolistener import AudioListener 10 | from .audioroom import AudioRoom 11 | from .spatialsound import SpatialSound 12 | from prettyqt.qt import QtSpatialAudio 13 | 14 | QT_MODULE = QtSpatialAudio 15 | 16 | __all__ = ["AmbientSound", "AudioEngine", "AudioListener", "AudioRoom", "SpatialSound"] 17 | -------------------------------------------------------------------------------- /prettyqt/spatialaudio/audiolistener.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | from prettyqt.qt import QtSpatialAudio 5 | from prettyqt.utils import datatypes 6 | 7 | 8 | class AudioListener(core.ObjectMixin, QtSpatialAudio.QAudioListener): 9 | """Defines the position and orientation of the person listening to a sound field.""" 10 | 11 | def set_position(self, position: datatypes.Vector3DType): 12 | self.setPosition(datatypes.to_vector3d(position)) 13 | -------------------------------------------------------------------------------- /prettyqt/statemachine/__init__.py: -------------------------------------------------------------------------------- 1 | """Provides classes for creating and executing state graphs.""" 2 | 3 | from __future__ import annotations 4 | 5 | from prettyqt.qt.QtStateMachine import * # noqa: F403 6 | 7 | from .abstractstate import AbstractState, AbstractStateMixin 8 | from .abstracttransition import AbstractTransition, AbstractTransitionMixin 9 | from .eventtransition import EventTransition 10 | from .finalstate import FinalState 11 | from .historystate import HistoryState 12 | from .signaltransition import SignalTransition 13 | from .state import State 14 | from .statemachine import StateMachine 15 | from prettyqt.qt import QtStateMachine 16 | 17 | QT_MODULE = QtStateMachine 18 | 19 | __all__ = [ 20 | "AbstractState", 21 | "AbstractStateMixin", 22 | "AbstractTransition", 23 | "AbstractTransitionMixin", 24 | "EventTransition", 25 | "FinalState", 26 | "HistoryState", 27 | "SignalTransition", 28 | "State", 29 | "StateMachine", 30 | ] 31 | -------------------------------------------------------------------------------- /prettyqt/statemachine/abstractstate.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | from prettyqt.qt import QtStateMachine 5 | 6 | 7 | class AbstractStateMixin(core.ObjectMixin): 8 | pass 9 | 10 | 11 | class AbstractState(AbstractStateMixin, QtStateMachine.QAbstractState): 12 | pass 13 | 14 | 15 | if __name__ == "__main__": 16 | state = AbstractState() 17 | -------------------------------------------------------------------------------- /prettyqt/statemachine/eventtransition.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import statemachine 4 | 5 | 6 | class EventTransition( 7 | statemachine.AbstractTransitionMixin, statemachine.QEventTransition 8 | ): 9 | pass 10 | -------------------------------------------------------------------------------- /prettyqt/statemachine/finalstate.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import statemachine 4 | 5 | 6 | class FinalState(statemachine.AbstractStateMixin, statemachine.QFinalState): 7 | pass 8 | -------------------------------------------------------------------------------- /prettyqt/statemachine/keyeventtransition.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import statemachine 4 | 5 | 6 | class KeyEventTransition( 7 | statemachine.EventTransitionMixin, statemachine.QKeyEventTransition 8 | ): 9 | pass 10 | -------------------------------------------------------------------------------- /prettyqt/statemachine/mouseeventtransition.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import statemachine 4 | 5 | 6 | class MouseEventTransition( 7 | statemachine.EventTransitionMixin, statemachine.QMouseEventTransition 8 | ): 9 | pass 10 | -------------------------------------------------------------------------------- /prettyqt/statemachine/signaltransition.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import statemachine 4 | 5 | 6 | class SignalTransition( 7 | statemachine.AbstractTransitionMixin, statemachine.QSignalTransition 8 | ): 9 | pass 10 | -------------------------------------------------------------------------------- /prettyqt/svg/__init__.py: -------------------------------------------------------------------------------- 1 | """Classes for displaying the contents of SVG files.""" 2 | 3 | from prettyqt.qt.QtSvg import * # noqa: F403 4 | 5 | from .svggenerator import SvgGenerator 6 | from .svgrenderer import SvgRenderer 7 | from prettyqt.qt import QtSvg 8 | 9 | QT_MODULE = QtSvg 10 | 11 | __all__ = ["SvgGenerator", "SvgRenderer"] 12 | -------------------------------------------------------------------------------- /prettyqt/svg/svggenerator.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core, gui 4 | from prettyqt.qt import QtSvg 5 | from prettyqt.utils import datatypes 6 | 7 | 8 | class SvgGenerator(gui.PaintDeviceMixin, QtSvg.QSvgGenerator): 9 | def get_viewbox(self) -> core.Rect: 10 | return core.Rect(self.viewBox()) 11 | 12 | def get_viewboxf(self) -> core.RectF: 13 | return core.RectF(self.viewBoxF()) 14 | 15 | def get_size(self) -> core.Size: 16 | return core.Size(self.size()) 17 | 18 | def set_size(self, size: datatypes.SizeType | core.QSizeF): 19 | self.setSize(datatypes.to_size(size)) 20 | -------------------------------------------------------------------------------- /prettyqt/svgwidgets/__init__.py: -------------------------------------------------------------------------------- 1 | """Widgets for displaying SVG files.""" 2 | 3 | from prettyqt.qt.QtSvgWidgets import * # noqa: F403 4 | 5 | from .graphicssvgitem import GraphicsSvgItem 6 | from .svgwidget import SvgWidget 7 | from prettyqt.qt import QtSvgWidgets 8 | 9 | QT_MODULE = QtSvgWidgets 10 | 11 | __all__ = ["GraphicsSvgItem", "SvgWidget"] 12 | -------------------------------------------------------------------------------- /prettyqt/svgwidgets/graphicssvgitem.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | from prettyqt.qt import QtSvgWidgets 5 | 6 | 7 | class GraphicsSvgItem(widgets.GraphicsObjectMixin, QtSvgWidgets.QGraphicsSvgItem): 8 | pass 9 | -------------------------------------------------------------------------------- /prettyqt/svgwidgets/svgwidget.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | import os 4 | from typing import TYPE_CHECKING 5 | 6 | from prettyqt import widgets 7 | from prettyqt.qt import QtSvgWidgets 8 | 9 | 10 | if TYPE_CHECKING: 11 | from prettyqt.utils import datatypes 12 | 13 | 14 | class SvgWidget(widgets.WidgetMixin, QtSvgWidgets.QSvgWidget): 15 | def load_file(self, path: datatypes.PathType): 16 | self.load(os.fspath(path)) 17 | -------------------------------------------------------------------------------- /prettyqt/syntaxhighlighters/__init__.py: -------------------------------------------------------------------------------- 1 | """syntaxhighlighters module. 2 | 3 | contains some custom syntax highlighers 4 | """ 5 | 6 | from .highlightrule import HighlightRule 7 | from .baserulesyntaxhighlighter import BaseRuleSyntaxHighlighter 8 | from .jsonhighlighter import JsonHighlighter 9 | from .markdownhighlighter import MarkdownHighlighter 10 | from .pygmentshighlighter import PygmentsHighlighter 11 | from .pythonhighlighter import PythonHighlighter 12 | from .regexmatchhighlighter import RegexMatchHighlighter 13 | from .selectedwordhighlighter import SelectedWordHighlighter 14 | from .yamlhighlighter import YamlHighlighter 15 | 16 | 17 | __all__ = [ 18 | "BaseRuleSyntaxHighlighter", 19 | "HighlightRule", 20 | "JsonHighlighter", 21 | "MarkdownHighlighter", 22 | "PygmentsHighlighter", 23 | "PythonHighlighter", 24 | "RegexMatchHighlighter", 25 | "SelectedWordHighlighter", 26 | "YamlHighlighter", 27 | ] 28 | -------------------------------------------------------------------------------- /prettyqt/syntaxhighlighters/custom_highlighters/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/syntaxhighlighters/custom_highlighters/__init__.py -------------------------------------------------------------------------------- /prettyqt/test/__init__.py: -------------------------------------------------------------------------------- 1 | """Classes for unit testing Qt applications and libraries.""" 2 | 3 | from .abstractitemmodeltester import AbstractItemModelTester 4 | from .signalspy import SignalSpy 5 | from prettyqt.qt import QtTest 6 | 7 | QT_MODULE = QtTest 8 | 9 | __all__ = ["AbstractItemModelTester", "SignalSpy"] 10 | -------------------------------------------------------------------------------- /prettyqt/test/abstractitemmodeltester.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | from prettyqt.qt import QtTest 5 | 6 | 7 | class AbstractItemModelTester(core.ObjectMixin, QtTest.QAbstractItemModelTester): 8 | pass 9 | 10 | 11 | if __name__ == "__main__": 12 | from prettyqt import gui 13 | 14 | model = gui.StandardItemModel() 15 | tester = AbstractItemModelTester(model) 16 | -------------------------------------------------------------------------------- /prettyqt/test/signalspy.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | from prettyqt.qt import QtTest 5 | 6 | 7 | class SignalSpy(core.ObjectMixin, QtTest.QSignalSpy): 8 | pass 9 | 10 | 11 | if __name__ == "__main__": 12 | from prettyqt import widgets 13 | 14 | app = widgets.app() 15 | cb = widgets.CheckBox() 16 | tester = SignalSpy(cb.clicked) 17 | cb.animateClick() 18 | -------------------------------------------------------------------------------- /prettyqt/texttospeech/__init__.py: -------------------------------------------------------------------------------- 1 | """TextToSpeech module. 2 | 3 | Contains QtTextToSpeech-based classes 4 | """ 5 | 6 | from prettyqt.qt.QtTextToSpeech import * # noqa: F403 7 | 8 | from .texttospeech import TextToSpeech 9 | from .voice import Voice 10 | from prettyqt.qt import QtTextToSpeech 11 | 12 | QT_MODULE = QtTextToSpeech 13 | 14 | __all__ = ["TextToSpeech", "Voice"] 15 | -------------------------------------------------------------------------------- /prettyqt/utils/platforms/__init__.py: -------------------------------------------------------------------------------- 1 | """platforms package.""" 2 | -------------------------------------------------------------------------------- /prettyqt/utils/platforms/windows/TaskbarLib.tlb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/utils/platforms/windows/TaskbarLib.tlb -------------------------------------------------------------------------------- /prettyqt/utils/platforms/windows/__init__.py: -------------------------------------------------------------------------------- 1 | """windows package.""" 2 | -------------------------------------------------------------------------------- /prettyqt/utils/proxystyles/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phil65/PrettyQt/afa7268f19ba2daaeb751bfceeb4ace9b04c93f0/prettyqt/utils/proxystyles/__init__.py -------------------------------------------------------------------------------- /prettyqt/utils/signallogger.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | import logging 4 | 5 | from prettyqt import core 6 | 7 | 8 | class Signals(core.Object): 9 | formatted_line = core.Signal(str) 10 | log_record = core.Signal(logging.LogRecord) 11 | 12 | 13 | class SignalLogger(logging.Handler): 14 | # formatted_line = core.Signal(str) 15 | # log_record = core.Signal(logging.LogRecord) 16 | # multiple inheritance doesnt work for PySide6 here 17 | def __init__(self): 18 | super().__init__() 19 | # core.Object.__init__(self) 20 | self.signals = Signals() 21 | 22 | def emit(self, record): 23 | msg = self.format(record) 24 | try: 25 | self.signals.formatted_line.emit(msg) 26 | self.signals.log_record.emit(record) 27 | except RuntimeError: 28 | pass 29 | -------------------------------------------------------------------------------- /prettyqt/validators/alphanumericvalidator.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import gui 4 | 5 | 6 | class AlphaNumericValidator(gui.Validator): 7 | """Validator which checks whether only alphanumeric characters are included.""" 8 | 9 | ID = "alphanumeric" 10 | 11 | def __eq__(self, other: object): 12 | return isinstance(other, AlphaNumericValidator) 13 | 14 | def validate(self, text: str, pos: int = 0): 15 | if text.replace("_", "").isalnum(): 16 | return self.State.Acceptable, text, pos 17 | return self.State.Invalid, text, pos 18 | 19 | 20 | if __name__ == "__main__": 21 | from prettyqt import widgets 22 | 23 | val = AlphaNumericValidator() 24 | app = widgets.app() 25 | widget = widgets.LineEdit("Thisisatest") 26 | widget.setValidator(val) 27 | widget.show() 28 | app.exec() 29 | -------------------------------------------------------------------------------- /prettyqt/validators/colorvalidator.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import gui 4 | 5 | 6 | class ColorValidator(gui.Validator): 7 | """Validator which checks for strings representing a color.""" 8 | 9 | ID = "color" 10 | 11 | def __eq__(self, other: object): 12 | return isinstance(other, ColorValidator) 13 | 14 | def validate(self, text: str, pos: int = 0) -> tuple[gui.QValidator.State, str, int]: 15 | color = gui.Color(text) 16 | if color.isValid(): 17 | return self.State.Acceptable, text, pos 18 | return self.State.Intermediate, text, pos 19 | 20 | 21 | if __name__ == "__main__": 22 | from prettyqt import widgets 23 | 24 | val = ColorValidator() 25 | app = widgets.app() 26 | widget = widgets.LineEdit() 27 | widget.setValidator(val) 28 | widget.show() 29 | app.exec() 30 | -------------------------------------------------------------------------------- /prettyqt/validators/pythoncodevalidator.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | import ast 4 | 5 | from prettyqt import gui 6 | 7 | 8 | class PythonCodeValidator(gui.Validator): 9 | """Validator which checks whether given string is valid Python code.""" 10 | 11 | ID = "python_code" 12 | 13 | def __eq__(self, other: object): 14 | return isinstance(other, PythonCodeValidator) 15 | 16 | def validate(self, text: str, pos: int = 0) -> tuple[gui.QValidator.State, str, int]: 17 | try: 18 | ast.parse(text) 19 | except SyntaxError: 20 | return self.State.Intermediate, text, pos 21 | else: 22 | return self.State.Acceptable, text, pos 23 | 24 | 25 | if __name__ == "__main__": 26 | from prettyqt import widgets 27 | 28 | val = PythonCodeValidator() 29 | app = widgets.app() 30 | widget = widgets.LineEdit() 31 | widget.setValidator(val) 32 | widget.show() 33 | app.exec() 34 | -------------------------------------------------------------------------------- /prettyqt/webchannel/__init__.py: -------------------------------------------------------------------------------- 1 | """Webenginewidgets module. 2 | 3 | contains QtWebEngineCore-based classes 4 | """ 5 | 6 | import logging 7 | 8 | 9 | logger = logging.getLogger(__name__) 10 | 11 | try: 12 | from .webchannel import WebChannel 13 | from prettyqt.qt import QtWebChannel 14 | 15 | QT_MODULE = QtWebChannel 16 | 17 | __all__ = ["WebChannel"] 18 | except ModuleNotFoundError: 19 | logger.warning("Tried to import WebEngine module but not installed.") 20 | -------------------------------------------------------------------------------- /prettyqt/webchannel/webchannel.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | from prettyqt.qt import QtWebChannel 5 | 6 | 7 | class WebChannel(core.ObjectMixin, QtWebChannel.QWebChannel): 8 | pass 9 | 10 | 11 | if __name__ == "__main__": 12 | channel = WebChannel() 13 | -------------------------------------------------------------------------------- /prettyqt/webenginecore/webenginehistoryitem.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | from prettyqt.qt import QtWebEngineCore 5 | 6 | 7 | class WebEngineHistoryItem(QtWebEngineCore.QWebEngineHistoryItem): 8 | def get_url(self) -> core.Url: 9 | return core.Url(self.url()) 10 | 11 | def get_icon_url(self) -> core.Url: 12 | return core.Url(self.iconUrl()) 13 | 14 | def get_last_visited(self) -> core.DateTime: 15 | return core.DateTime(self.lastVisited()) 16 | -------------------------------------------------------------------------------- /prettyqt/webenginecore/webengineurlschemehandler.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from typing import TYPE_CHECKING, Any 4 | 5 | from prettyqt import core 6 | from prettyqt.qt import QtWebEngineCore 7 | 8 | 9 | if TYPE_CHECKING: 10 | from collections.abc import Callable 11 | 12 | 13 | class WebEngineUrlSchemeHandler( 14 | core.ObjectMixin, QtWebEngineCore.QWebEngineUrlSchemeHandler 15 | ): 16 | pass 17 | 18 | 19 | class CallbackWebEngineUrlSchemeHandler(WebEngineUrlSchemeHandler): 20 | def __init__( 21 | self, 22 | callback: Callable[[QtWebEngineCore.QWebEngineUrlRequestJob], Any], 23 | *args: Any, 24 | **kwargs: Any, 25 | ): 26 | super().__init__(*args, **kwargs) 27 | self.callback = callback 28 | 29 | def requestStarted(self, request: QtWebEngineCore.QWebEngineUrlRequestJob): 30 | self.callback(request) 31 | 32 | 33 | if __name__ == "__main__": 34 | item = WebEngineUrlSchemeHandler() 35 | -------------------------------------------------------------------------------- /prettyqt/webenginewidgets/__init__.py: -------------------------------------------------------------------------------- 1 | """Webenginewidgets module. 2 | 3 | contains QtWebEngineWidgets-based classes 4 | """ 5 | 6 | import logging 7 | 8 | 9 | logger = logging.getLogger(__name__) 10 | 11 | try: 12 | from prettyqt.qt.QtWebEngineWidgets import * # noqa: F403 13 | 14 | from .webengineview import WebEngineView 15 | from prettyqt.qt import QtWebEngineWidgets 16 | 17 | QT_MODULE = QtWebEngineWidgets 18 | __all__ = [ 19 | "WebEngineView", 20 | ] 21 | except ModuleNotFoundError: 22 | logger.warning("Tried to import WebEngine module but not installed.") 23 | -------------------------------------------------------------------------------- /prettyqt/widgets/abstractgraphicsshapeitem.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | 5 | 6 | class AbstractGraphicsShapeItemMixin(widgets.GraphicsItemMixin): 7 | pass 8 | 9 | 10 | class AbstractGraphicsShapeItem( 11 | AbstractGraphicsShapeItemMixin, widgets.QAbstractGraphicsShapeItem 12 | ): 13 | """Common base for all path items.""" 14 | -------------------------------------------------------------------------------- /prettyqt/widgets/buttongroup.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | from prettyqt.qt import QtWidgets 5 | 6 | 7 | class ButtonGroup(core.ObjectMixin, QtWidgets.QButtonGroup): 8 | """Container to organize groups of button widgets.""" 9 | 10 | def __getitem__(self, index: int) -> QtWidgets.QAbstractButton: 11 | return self.button(index) 12 | -------------------------------------------------------------------------------- /prettyqt/widgets/columnview.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | 5 | 6 | class ColumnView(widgets.AbstractItemViewMixin, widgets.QColumnView): 7 | """Model/view implementation of a column view.""" 8 | 9 | 10 | if __name__ == "__main__": 11 | app = widgets.app() 12 | view = ColumnView() 13 | view.parent() 14 | view.show() 15 | app.exec() 16 | -------------------------------------------------------------------------------- /prettyqt/widgets/commandlinkbutton.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core, widgets 4 | 5 | 6 | class CommandLinkButton(widgets.PushButtonMixin, widgets.QCommandLinkButton): 7 | """Vista style command link button.""" 8 | 9 | value_changed = core.Signal(bool) 10 | 11 | 12 | if __name__ == "__main__": 13 | app = widgets.app() 14 | widget = CommandLinkButton("This is a test") 15 | widget.show() 16 | app.exec() 17 | -------------------------------------------------------------------------------- /prettyqt/widgets/commonstyle.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | 5 | 6 | class CommonStyleMixin(widgets.StyleMixin): 7 | pass 8 | 9 | 10 | class CommonStyle(CommonStyleMixin, widgets.QCommonStyle): 11 | """Encapsulates the common Look and Feel of a GUI.""" 12 | 13 | 14 | if __name__ == "__main__": 15 | style = CommonStyle() 16 | -------------------------------------------------------------------------------- /prettyqt/widgets/dial.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core, widgets 4 | 5 | 6 | class Dial(widgets.AbstractSliderMixin, widgets.QDial): 7 | """Rounded range control (like a speedometer or potentiometer).""" 8 | 9 | value_changed = core.Signal(int) 10 | 11 | def __init__(self, *args, **kwargs): 12 | super().__init__(*args, **kwargs) 13 | self.valueChanged.connect(self.on_value_change) 14 | 15 | 16 | if __name__ == "__main__": 17 | app = widgets.app() 18 | slider = Dial() 19 | slider.setRange(0, 100) 20 | slider.show() 21 | app.exec() 22 | -------------------------------------------------------------------------------- /prettyqt/widgets/errormessage.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | 5 | 6 | class ErrorMessage(widgets.DialogMixin, widgets.QErrorMessage): 7 | """Error message display dialog.""" 8 | 9 | 10 | if __name__ == "__main__": 11 | app = widgets.app() 12 | widget = ErrorMessage() 13 | widget.set_icon("mdi.timer") 14 | widget.show() 15 | app.exec() 16 | -------------------------------------------------------------------------------- /prettyqt/widgets/focusframe.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | 5 | 6 | class FocusFrame(widgets.WidgetMixin, widgets.QFocusFrame): 7 | """Focus frame which can be outside of a widget's normal paintable area.""" 8 | 9 | 10 | if __name__ == "__main__": 11 | app = widgets.app() 12 | container = widgets.Splitter() 13 | widget = widgets.PlainTextEdit() 14 | widget2 = widgets.PlainTextEdit() 15 | container.add(widget) 16 | container.add(widget2) 17 | errorbox = FocusFrame(container) 18 | errorbox.setWidget(container) 19 | errorbox.show() 20 | container.show() 21 | app.exec() 22 | -------------------------------------------------------------------------------- /prettyqt/widgets/fontdialog.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import gui, widgets 4 | 5 | 6 | class FontDialog(widgets.DialogMixin, widgets.QFontDialog): 7 | """Dialog widget for selecting a font.""" 8 | 9 | def get_current_font(self) -> gui.Font: 10 | return gui.Font(self.currentFont()) 11 | 12 | 13 | if __name__ == "__main__": 14 | app = widgets.app() 15 | widget = FontDialog.getFont() 16 | app.exec() 17 | -------------------------------------------------------------------------------- /prettyqt/widgets/graphicscolorizeeffect.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | from prettyqt.utils import colors, datatypes 5 | 6 | 7 | class GraphicsColorizeEffect( 8 | widgets.GraphicsEffectMixin, widgets.QGraphicsColorizeEffect 9 | ): 10 | def set_color(self, color: datatypes.ColorType): 11 | color = colors.get_color(color) 12 | super().setColor(color) 13 | 14 | 15 | if __name__ == "__main__": 16 | app = widgets.app() 17 | effect = GraphicsColorizeEffect() 18 | effect.set_color("window_role") 19 | print(effect.color()) 20 | -------------------------------------------------------------------------------- /prettyqt/widgets/graphicsdropshadoweffect.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | 5 | 6 | class GraphicsDropShadowEffect( 7 | widgets.GraphicsEffectMixin, widgets.QGraphicsDropShadowEffect 8 | ): 9 | pass 10 | -------------------------------------------------------------------------------- /prettyqt/widgets/graphicseffect.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | from prettyqt.qt import QtWidgets 5 | 6 | 7 | class GraphicsEffectMixin(core.ObjectMixin): 8 | pass 9 | 10 | 11 | class GraphicsEffect(GraphicsEffectMixin, QtWidgets.QGraphicsEffect): 12 | """The base class for all graphics effects.""" 13 | -------------------------------------------------------------------------------- /prettyqt/widgets/graphicsellipseitem.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core, widgets 4 | from prettyqt.utils import get_repr 5 | 6 | 7 | class GraphicsEllipseItem( 8 | widgets.AbstractGraphicsShapeItemMixin, widgets.QGraphicsEllipseItem 9 | ): 10 | """Ellipse item that you can add to a QGraphicsScene.""" 11 | 12 | def __repr__(self): 13 | return get_repr(self, self.get_rect()) 14 | 15 | def get_rect(self) -> core.RectF: 16 | return core.RectF(self.rect()) 17 | 18 | 19 | if __name__ == "__main__": 20 | item = GraphicsEllipseItem() 21 | item.get_rect() 22 | -------------------------------------------------------------------------------- /prettyqt/widgets/graphicsitemgroup.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | 5 | 6 | class GraphicsItemGroup(widgets.GraphicsItemMixin, widgets.QGraphicsItemGroup): 7 | """Container that treats a group of items as a single item.""" 8 | -------------------------------------------------------------------------------- /prettyqt/widgets/graphicslinearlayout.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import constants, widgets 4 | 5 | 6 | class GraphicsLinearLayout(widgets.GraphicsLayoutMixin, widgets.QGraphicsLinearLayout): 7 | """Horizontal or vertical layout for managing widgets in Graphics View.""" 8 | 9 | def __init__( 10 | self, 11 | orientation: constants.OrientationStr | constants.Orientation = "horizontal", 12 | parent: widgets.QGraphicsLayoutItem | None = None, 13 | ): 14 | ori = constants.ORIENTATION.get_enum_value(orientation) 15 | super().__init__(ori, parent) 16 | 17 | def __add__(self, other): 18 | self[self.count()] = other 19 | return self 20 | 21 | 22 | if __name__ == "__main__": 23 | app = widgets.app() 24 | layout = GraphicsLinearLayout() 25 | -------------------------------------------------------------------------------- /prettyqt/widgets/graphicslineitem.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core, widgets 4 | from prettyqt.utils import get_repr 5 | 6 | 7 | class GraphicsLineItem(widgets.GraphicsItemMixin, widgets.QGraphicsLineItem): 8 | """Line item that you can add to a QGraphicsScene.""" 9 | 10 | def __repr__(self): 11 | return get_repr(self, self.get_line()) 12 | 13 | def get_line(self) -> core.LineF: 14 | return core.LineF(self.line()) 15 | 16 | 17 | if __name__ == "__main__": 18 | item = GraphicsLineItem(core.Point(0, 0), core.Point(2, 2)) 19 | -------------------------------------------------------------------------------- /prettyqt/widgets/graphicsobject.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core, widgets 4 | 5 | 6 | class GraphicsObjectMixin(core.ObjectMixin, widgets.GraphicsItemMixin): 7 | pass 8 | 9 | 10 | class GraphicsObject(GraphicsObjectMixin, widgets.QGraphicsObject): 11 | """Base class for all graphics items that require signals, slots and properties.""" 12 | -------------------------------------------------------------------------------- /prettyqt/widgets/graphicsopacityeffect.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import gui, widgets 4 | 5 | 6 | class GraphicsOpacityEffect(widgets.GraphicsEffectMixin, widgets.QGraphicsOpacityEffect): 7 | def get_opacity_mask(self) -> gui.Brush: 8 | return gui.Brush(self.opacityMask()) 9 | -------------------------------------------------------------------------------- /prettyqt/widgets/graphicspathitem.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | 5 | 6 | class GraphicsPathItem(widgets.AbstractGraphicsShapeItemMixin, widgets.QGraphicsPathItem): 7 | """Path item that you can add to a QGraphicsScene.""" 8 | -------------------------------------------------------------------------------- /prettyqt/widgets/graphicspolygonitem.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import constants, gui, widgets 4 | 5 | 6 | class GraphicsPolygonItem( 7 | widgets.AbstractGraphicsShapeItemMixin, widgets.QGraphicsPolygonItem 8 | ): 9 | """Polygon item that you can add to a QGraphicsScene.""" 10 | 11 | def get_polygon(self) -> gui.PolygonF: 12 | return gui.PolygonF(self.polygon()) 13 | 14 | def set_fill_rule(self, rule: constants.FillRuleStr | constants.FillRule): 15 | self.setFillRule(constants.FILL_RULE.get_enum_value(rule)) 16 | 17 | def get_fill_rule(self) -> constants.FillRuleStr: 18 | return constants.FILL_RULE.inverse[self.fillRule()] 19 | -------------------------------------------------------------------------------- /prettyqt/widgets/graphicsproxywidget.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | 5 | 6 | class GraphicsProxyWidget(widgets.GraphicsWidgetMixin, widgets.QGraphicsProxyWidget): 7 | """Proxy layer for embedding a QWidget in a QGraphicsScene.""" 8 | 9 | 10 | if __name__ == "__main__": 11 | app = widgets.app() 12 | w = GraphicsProxyWidget() 13 | -------------------------------------------------------------------------------- /prettyqt/widgets/graphicsrectitem.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core, widgets 4 | from prettyqt.utils import get_repr 5 | 6 | 7 | class GraphicsRectItem(widgets.AbstractGraphicsShapeItemMixin, widgets.QGraphicsRectItem): 8 | """Rectangle item that you can add to a QGraphicsScene.""" 9 | 10 | def __repr__(self): 11 | return get_repr(self, self.get_rect()) 12 | 13 | def get_rect(self) -> core.RectF: 14 | return core.RectF(self.rect()) 15 | 16 | def serialize_fields(self): 17 | return dict(rect=self.get_rect()) 18 | 19 | def __setstate__(self, state): 20 | super().__setstate__(state) 21 | self.setRect(state["rect"]) 22 | -------------------------------------------------------------------------------- /prettyqt/widgets/graphicsrotation.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import constants, widgets 4 | from prettyqt.utils import datatypes 5 | 6 | 7 | class GraphicsRotation(widgets.GraphicsTransformMixin, widgets.QGraphicsRotation): 8 | """Rotation transformation around a given axis.""" 9 | 10 | def set_axis(self, axis: constants.AxisStr | constants.Axis): 11 | self.setAxis(constants.AXIS.get_enum_value(axis)) 12 | 13 | def set_origin(self, origin: datatypes.Vector3DType): 14 | self.setOrigin(datatypes.to_vector3d(origin)) 15 | 16 | 17 | if __name__ == "__main__": 18 | rotation = GraphicsRotation() 19 | rotation.set_origin((1, 1, 1)) 20 | -------------------------------------------------------------------------------- /prettyqt/widgets/graphicsscale.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | from prettyqt.utils import datatypes 5 | 6 | 7 | class GraphicsScale(widgets.GraphicsTransformMixin, widgets.QGraphicsScale): 8 | def set_origin(self, origin: datatypes.Vector3DType): 9 | self.setOrigin(datatypes.to_vector3d(origin)) 10 | 11 | 12 | if __name__ == "__main__": 13 | scale = GraphicsScale() 14 | scale.set_origin((1, 1, 1)) 15 | -------------------------------------------------------------------------------- /prettyqt/widgets/graphicssimpletextitem.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | from prettyqt.utils import get_repr 5 | 6 | 7 | class GraphicsSimpleTextItem( 8 | widgets.AbstractGraphicsShapeItemMixin, widgets.QGraphicsSimpleTextItem 9 | ): 10 | """Simple text path item that you can add to a QGraphicsScene.""" 11 | 12 | def __repr__(self): 13 | return get_repr(self, self.text()) 14 | -------------------------------------------------------------------------------- /prettyqt/widgets/graphicstextitem.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | from prettyqt.utils import get_repr 5 | 6 | 7 | class GraphicsTextItem(widgets.GraphicsObjectMixin, widgets.QGraphicsTextItem): 8 | """Text item that you can add to a QGraphicsScene to display formatted text.""" 9 | 10 | def __repr__(self): 11 | return get_repr(self, self.toPlainText()) 12 | -------------------------------------------------------------------------------- /prettyqt/widgets/graphicstransform.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core 4 | from prettyqt.qt import QtWidgets 5 | 6 | 7 | class GraphicsTransformMixin(core.ObjectMixin): 8 | pass 9 | 10 | 11 | class GraphicsTransform(GraphicsTransformMixin, QtWidgets.QGraphicsTransform): 12 | """Abstract base class for building advanced transformations on QGraphicsItems.""" 13 | 14 | 15 | if __name__ == "__main__": 16 | transform = GraphicsTransform() 17 | -------------------------------------------------------------------------------- /prettyqt/widgets/hboxlayout.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | 5 | 6 | class HBoxLayout(widgets.boxlayout.BoxLayoutMixin, widgets.QHBoxLayout): 7 | """Lines up widgets horizontally.""" 8 | 9 | ID = "horizontal" 10 | 11 | 12 | if __name__ == "__main__": 13 | from prettyqt import widgets 14 | 15 | app = widgets.app() 16 | layout = HBoxLayout() 17 | widget = widgets.Widget() 18 | widget2 = widgets.RadioButton("Test") 19 | layout.add(widget2) 20 | widget.set_layout(layout) 21 | widget.show() 22 | app.exec() 23 | -------------------------------------------------------------------------------- /prettyqt/widgets/itemdelegate.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | 5 | 6 | class ItemDelegate(widgets.AbstractItemDelegateMixin, widgets.QItemDelegate): 7 | """Display and editing facilities for data items from a model.""" 8 | -------------------------------------------------------------------------------- /prettyqt/widgets/itemeditorcreatorbase.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt import QtWidgets 4 | 5 | 6 | class ItemEditorCreatorBase(QtWidgets.QItemEditorCreatorBase): 7 | """Abstract base class for implementing new item editor creators.""" 8 | -------------------------------------------------------------------------------- /prettyqt/widgets/mdisubwindow.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | from prettyqt.utils import bidict 5 | 6 | 7 | SUB_WINDOW_OPTION = bidict( 8 | rubber_band_resize=widgets.QMdiSubWindow.SubWindowOption.RubberBandResize, 9 | rubber_band_move=widgets.QMdiSubWindow.SubWindowOption.RubberBandMove, 10 | ) 11 | 12 | 13 | class MdiSubWindow(widgets.WidgetMixin, widgets.QMdiSubWindow): 14 | """Subwindow class for QMdiArea.""" 15 | 16 | 17 | if __name__ == "__main__": 18 | app = widgets.app() 19 | widget = MdiSubWindow() 20 | widget.show() 21 | app.exec() 22 | -------------------------------------------------------------------------------- /prettyqt/widgets/pangesture.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core, widgets 4 | 5 | 6 | class PanGesture(widgets.GestureMixin, widgets.QPanGesture): 7 | """Describes a panning gesture made by the user.""" 8 | 9 | def get_delta(self) -> core.PointF: 10 | return core.PointF(self.delta()) 11 | 12 | def get_last_offset(self) -> core.PointF: 13 | return core.PointF(self.lastOffset()) 14 | 15 | def get_offset(self) -> core.PointF: 16 | return core.PointF(self.offset()) 17 | 18 | 19 | if __name__ == "__main__": 20 | from prettyqt import widgets 21 | 22 | app = widgets.app() 23 | gesture = PanGesture() 24 | -------------------------------------------------------------------------------- /prettyqt/widgets/plaintextdocumentlayout.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import gui 4 | from prettyqt.qt import QtWidgets 5 | 6 | 7 | class PlainTextDocumentLayout( 8 | gui.AbstractTextDocumentLayoutMixin, QtWidgets.QPlainTextDocumentLayout 9 | ): 10 | """Implements a plain text layout for QTextDocument.""" 11 | 12 | 13 | if __name__ == "__main__": 14 | doc = gui.TextDocument() 15 | layout = PlainTextDocumentLayout(doc) 16 | -------------------------------------------------------------------------------- /prettyqt/widgets/proxystyle.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | 5 | 6 | class ProxyStyle(widgets.CommonStyleMixin, widgets.QProxyStyle): 7 | """Convenience class that simplifies dynamically overriding QStyle elements.""" 8 | 9 | 10 | if __name__ == "__main__": 11 | style = ProxyStyle() 12 | -------------------------------------------------------------------------------- /prettyqt/widgets/radiobutton.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core, widgets 4 | 5 | 6 | class RadioButton(widgets.AbstractButtonMixin, widgets.QRadioButton): 7 | """Radio button with a text label.""" 8 | 9 | value_changed = core.Signal(bool) 10 | 11 | def __init__(self, *args, **kwargs): 12 | super().__init__(*args, **kwargs) 13 | self.toggled.connect(self.value_changed) 14 | 15 | 16 | if __name__ == "__main__": 17 | app = widgets.app() 18 | widget = RadioButton("This is a test") 19 | widget.set_icon("mdi.timer") 20 | widget.show() 21 | app.exec() 22 | -------------------------------------------------------------------------------- /prettyqt/widgets/sizegrip.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | 5 | 6 | class SizeGrip(widgets.WidgetMixin, widgets.QSizeGrip): 7 | """Resize handle for resizing top-level windows.""" 8 | 9 | @classmethod 10 | def setup_example(cls): 11 | w = widgets.Widget() 12 | return cls(w) 13 | 14 | 15 | if __name__ == "__main__": 16 | app = widgets.app() 17 | w = widgets.Widget() 18 | widget = SizeGrip(w) 19 | widget.show() 20 | app.exec() 21 | -------------------------------------------------------------------------------- /prettyqt/widgets/styleditemdelegate.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | 5 | 6 | class StyledItemDelegate(widgets.AbstractItemDelegateMixin, widgets.QStyledItemDelegate): 7 | pass 8 | -------------------------------------------------------------------------------- /prettyqt/widgets/stylefactory.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt import QtWidgets 4 | 5 | 6 | class StyleFactory(QtWidgets.QStyleFactory): 7 | pass 8 | -------------------------------------------------------------------------------- /prettyqt/widgets/styleoption.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from typing import Self 4 | 5 | from prettyqt.qt import QtWidgets 6 | 7 | 8 | class StyleOptionMixin: 9 | @classmethod 10 | def based_on(cls, widget: QtWidgets.QWidget) -> Self: 11 | opt = cls() 12 | opt.initFrom(widget) 13 | return opt 14 | 15 | 16 | class StyleOption(StyleOptionMixin, QtWidgets.QStyleOption): 17 | pass 18 | -------------------------------------------------------------------------------- /prettyqt/widgets/styleoptionbutton.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | from prettyqt.utils import bidict 5 | 6 | 7 | BUTTON_FEATURES = bidict( 8 | none=widgets.QStyleOptionButton.ButtonFeature.None_, 9 | flat=widgets.QStyleOptionButton.ButtonFeature.Flat, 10 | has_menu=widgets.QStyleOptionButton.ButtonFeature.HasMenu, 11 | default_button=widgets.QStyleOptionButton.ButtonFeature.DefaultButton, 12 | auto_default_button=widgets.QStyleOptionButton.ButtonFeature.AutoDefaultButton, 13 | command_link_button=widgets.QStyleOptionButton.ButtonFeature.CommandLinkButton, 14 | ) 15 | 16 | 17 | class StyleOptionButton(widgets.StyleOptionMixin, widgets.QStyleOptionButton): 18 | pass 19 | -------------------------------------------------------------------------------- /prettyqt/widgets/styleoptioncombobox.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | 5 | 6 | class StyleOptionComboBox(widgets.StyleOptionComplexMixin, widgets.QStyleOptionComboBox): 7 | pass 8 | -------------------------------------------------------------------------------- /prettyqt/widgets/styleoptioncomplex.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | 5 | 6 | class StyleOptionComplexMixin(widgets.StyleOptionMixin): 7 | pass 8 | 9 | 10 | class StyleOptionComplex(StyleOptionComplexMixin, widgets.QStyleOptionComplex): 11 | pass 12 | -------------------------------------------------------------------------------- /prettyqt/widgets/styleoptiondockwidget.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | 5 | 6 | class StyleOptionDockWidget(widgets.StyleOptionMixin, widgets.QStyleOptionDockWidget): 7 | pass 8 | -------------------------------------------------------------------------------- /prettyqt/widgets/styleoptionfocusrect.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | 5 | 6 | class StyleOptionFocusRect(widgets.StyleOptionMixin, widgets.QStyleOptionFocusRect): 7 | pass 8 | -------------------------------------------------------------------------------- /prettyqt/widgets/styleoptionframe.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | 5 | 6 | class StyleOptionFrame(widgets.StyleOptionMixin, widgets.QStyleOptionFrame): 7 | pass 8 | -------------------------------------------------------------------------------- /prettyqt/widgets/styleoptiongraphicsitem.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | 5 | 6 | class StyleOptionGraphicsItem(widgets.StyleOptionMixin, widgets.QStyleOptionGraphicsItem): 7 | pass 8 | -------------------------------------------------------------------------------- /prettyqt/widgets/styleoptiongroupbox.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | 5 | 6 | class StyleOptionGroupBox(widgets.StyleOptionComplex, widgets.QStyleOptionGroupBox): 7 | pass 8 | -------------------------------------------------------------------------------- /prettyqt/widgets/styleoptionprogressbar.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | 5 | 6 | class StyleOptionProgressBar(widgets.StyleOptionMixin, widgets.QStyleOptionProgressBar): 7 | pass 8 | -------------------------------------------------------------------------------- /prettyqt/widgets/styleoptionrubberband.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | 5 | 6 | class StyleOptionRubberBand(widgets.StyleOptionMixin, widgets.QStyleOptionRubberBand): 7 | pass 8 | -------------------------------------------------------------------------------- /prettyqt/widgets/styleoptionsizegrip.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | 5 | 6 | class StyleOptionSizeGrip(widgets.StyleOptionComplexMixin, widgets.QStyleOptionSizeGrip): 7 | pass 8 | -------------------------------------------------------------------------------- /prettyqt/widgets/styleoptionspinbox.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | 5 | 6 | class StyleOptionSpinBox(widgets.StyleOptionComplex, widgets.QStyleOptionSpinBox): 7 | pass 8 | -------------------------------------------------------------------------------- /prettyqt/widgets/styleoptiontabbarbase.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | 5 | 6 | class StyleOptionTabBarBase(widgets.StyleOptionMixin, widgets.QStyleOptionTabBarBase): 7 | pass 8 | -------------------------------------------------------------------------------- /prettyqt/widgets/styleoptiontabwidgetframe.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | 5 | 6 | class StyleOptionTabWidgetFrame( 7 | widgets.StyleOptionMixin, widgets.QStyleOptionTabWidgetFrame 8 | ): 9 | pass 10 | -------------------------------------------------------------------------------- /prettyqt/widgets/styleoptiontitlebar.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | 5 | 6 | class StyleOptionTitleBar(widgets.StyleOptionComplex, widgets.QStyleOptionTitleBar): 7 | pass 8 | -------------------------------------------------------------------------------- /prettyqt/widgets/styleoptiontoolbar.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from typing import Literal 4 | 5 | from prettyqt import widgets 6 | from prettyqt.utils import bidict 7 | 8 | 9 | ToolBarFeatureStr = Literal["none", "movable"] 10 | 11 | TOOLBAR_FEATURE: bidict[ToolBarFeatureStr, widgets.QStyleOptionToolBar.ToolBarFeature] = ( 12 | bidict( 13 | none=widgets.QStyleOptionToolBar.ToolBarFeature(0), # type: ignore 14 | movable=widgets.QStyleOptionToolBar.ToolBarFeature.Movable, 15 | ) 16 | ) 17 | 18 | 19 | class StyleOptionToolBar(widgets.StyleOptionMixin, widgets.QStyleOptionToolBar): 20 | pass 21 | -------------------------------------------------------------------------------- /prettyqt/widgets/styleoptiontoolbutton.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | 5 | 6 | class StyleOptionToolButton(widgets.StyleOptionComplex, widgets.QStyleOptionToolButton): 7 | pass 8 | -------------------------------------------------------------------------------- /prettyqt/widgets/stylepainter.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import gui, widgets 4 | 5 | 6 | class StylePainter(gui.PainterMixin, widgets.QStylePainter): 7 | """Convenience class for drawing QStyle elements inside a widget.""" 8 | 9 | def draw_complex_control( 10 | self, 11 | control: widgets.style.ComplexControlStr, 12 | option: widgets.QStyleOptionComplex, 13 | ): 14 | self.drawComplexControl(widgets.style.COMPLEX_CONTROL[control], option) 15 | -------------------------------------------------------------------------------- /prettyqt/widgets/tapandholdgesture.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core, widgets 4 | 5 | 6 | class TapAndHoldGesture(widgets.GestureMixin, widgets.QTapAndHoldGesture): 7 | def get_position(self) -> core.PointF: 8 | return core.PointF(self.position()) 9 | 10 | 11 | if __name__ == "__main__": 12 | from prettyqt import widgets 13 | 14 | app = widgets.app() 15 | gesture = TapAndHoldGesture() 16 | -------------------------------------------------------------------------------- /prettyqt/widgets/tapgesture.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import core, widgets 4 | 5 | 6 | class TapGesture(widgets.GestureMixin, widgets.QTapGesture): 7 | """Describes a tap gesture made by the user.""" 8 | 9 | def get_position(self) -> core.PointF: 10 | return core.PointF(self.position()) 11 | 12 | 13 | if __name__ == "__main__": 14 | from prettyqt import widgets 15 | 16 | app = widgets.app() 17 | gesture = TapGesture() 18 | -------------------------------------------------------------------------------- /prettyqt/widgets/tooltip.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt.qt import QtGui, QtWidgets 4 | from prettyqt.utils import datatypes 5 | 6 | 7 | class ToolTip(QtWidgets.QToolTip): 8 | """Tool tips (balloon help) for any widget.""" 9 | 10 | @classmethod 11 | def show_text( 12 | cls, 13 | position: datatypes.PointType | None = None, 14 | text: str = "", 15 | linebreak_px: int = 400, 16 | ): 17 | cls.showText( 18 | QtGui.QCursor.pos() if position is None else datatypes.to_point(position), 19 | f'
{text}
', 20 | ) 21 | 22 | 23 | if __name__ == "__main__": 24 | from prettyqt import widgets 25 | 26 | app = widgets.app() 27 | ToolTip.show_text(text="test") 28 | app.exec() 29 | -------------------------------------------------------------------------------- /prettyqt/widgets/vboxlayout.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | 5 | 6 | class VBoxLayout(widgets.boxlayout.BoxLayoutMixin, widgets.QVBoxLayout): 7 | """Lines up widgets vertically.""" 8 | 9 | ID = "vertical" 10 | 11 | 12 | if __name__ == "__main__": 13 | app = widgets.app() 14 | layout = VBoxLayout() 15 | widget = widgets.Widget() 16 | widget2 = widgets.RadioButton("Test") 17 | layout.add(widget2) 18 | widget.set_layout(layout) 19 | widget.show() 20 | app.exec() 21 | -------------------------------------------------------------------------------- /prettyqt/widgets/whatsthis.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | import contextlib 4 | 5 | from prettyqt.qt import QtWidgets 6 | 7 | 8 | class WhatsThis(QtWidgets.QWhatsThis): 9 | """Simple description of any widget, i.e. answering the question "What's This?".""" 10 | 11 | @classmethod 12 | @contextlib.contextmanager 13 | def enter_mode(cls): 14 | cls.enterWhatsThisMode() 15 | yield cls 16 | cls.leaveWhatsThisMode() 17 | 18 | 19 | if __name__ == "__main__": 20 | from prettyqt import widgets 21 | 22 | app = widgets.app() 23 | 24 | def test(): 25 | with WhatsThis.enter_mode() as w: 26 | print(w.inWhatsThisMode()) 27 | 28 | btn = widgets.PushButton(callback=test) 29 | btn.show() 30 | app.exec() 31 | -------------------------------------------------------------------------------- /prettyqt/widgets/widgetaction.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import gui 4 | from prettyqt.qt import QtWidgets 5 | 6 | 7 | class WidgetAction(gui.ActionMixin, QtWidgets.QWidgetAction): 8 | pass 9 | 10 | 11 | if __name__ == "__main__": 12 | w = WidgetAction() 13 | -------------------------------------------------------------------------------- /prettyqt/widgets/widgetitem.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from prettyqt import widgets 4 | 5 | 6 | class WidgetItem(widgets.LayoutItemMixin, widgets.QWidgetItem): 7 | """Layout item that represents a widget.""" 8 | 9 | 10 | if __name__ == "__main__": 11 | app = widgets.app() 12 | item = WidgetItem(widgets.QWidget()) 13 | -------------------------------------------------------------------------------- /scripts/print_repr.py: -------------------------------------------------------------------------------- 1 | # /// script 2 | # requires-python = ">=3.11" 3 | # dependencies = [ 4 | # "prettyqt", 5 | # "pyside6", 6 | # ] 7 | # /// 8 | 9 | import inspect 10 | 11 | from prettyqt import gui 12 | 13 | 14 | if __name__ == "__main__": 15 | clsmembers = inspect.getmembers(gui, inspect.isclass) 16 | clsmembers = [tpl for tpl in clsmembers if not tpl[0].startswith("Abstract")] 17 | app = gui.app() 18 | for _name, cls in clsmembers: 19 | try: 20 | item = cls() 21 | except Exception: # noqa: BLE001 22 | continue 23 | print(repr(item), str(item)) 24 | -------------------------------------------------------------------------------- /scripts/replace.py: -------------------------------------------------------------------------------- 1 | # /// script 2 | # requires-python = ">=3.11" 3 | # /// 4 | 5 | import pathlib 6 | import re 7 | import sys 8 | 9 | 10 | script_path = pathlib.Path(__file__).parent 11 | 12 | replacements = [] 13 | with (script_path / "enums.txt").open() as f: 14 | for line in f: 15 | orig, replacement = line.split() 16 | orig_re = re.compile(re.escape(orig) + r"(?=\W)") 17 | replacements.append((orig_re, replacement)) 18 | 19 | 20 | for filename in sys.argv[1:]: 21 | path = pathlib.Path(filename) 22 | if path.suffix != ".py": 23 | continue 24 | content = path.read_text() 25 | print(filename) 26 | for orig_re, replacement in replacements: 27 | content = orig_re.sub(replacement, content) 28 | path.write_text(content) 29 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests package. 2 | 3 | Dummy file for allowing exclusion from mypy 4 | """ 5 | -------------------------------------------------------------------------------- /tests/qmltest.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.3 2 | 3 | Rectangle { 4 | width: 200 5 | height: 100 6 | color: "red" 7 | 8 | Text { 9 | anchors.centerIn: parent 10 | text: "Hello, World!" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /tests/test_animations.py: -------------------------------------------------------------------------------- 1 | """Tests for `prettyqt` package.""" 2 | 3 | from prettyqt import animations, widgets 4 | 5 | 6 | def test_slideanimation(qtbot): 7 | widget = widgets.Widget() 8 | qtbot.addWidget(widget) 9 | anim = animations.SlideAnimation(parent=widget) 10 | anim.set_start_value((20, 20)) 11 | anim.set_end_value((20, 20)) 12 | anim.apply_to(widget) 13 | -------------------------------------------------------------------------------- /tests/test_bluetooth.py: -------------------------------------------------------------------------------- 1 | """Tests for `prettyqt` package.""" 2 | 3 | import pytest 4 | 5 | 6 | bluetooth = pytest.importorskip("prettyqt.bluetooth") 7 | 8 | # from prettyqt.utils import InvalidParamError 9 | 10 | 11 | def test_bluetoothaddress(): 12 | address = bluetooth.BluetoothAddress() 13 | repr(address) 14 | assert not address 15 | 16 | 17 | def test_bluetoothservicediscoveryagent(qtlog): 18 | with qtlog.disabled(): 19 | agent = bluetooth.BluetoothServiceDiscoveryAgent() 20 | assert agent.get_error() == "none" 21 | assert agent.get_discovered_services() == [] 22 | 23 | 24 | def test_bluetoothdevicediscoveryagent(qtlog): 25 | with qtlog.disabled(): 26 | agent = bluetooth.BluetoothDeviceDiscoveryAgent() 27 | assert agent.get_error() == "none" 28 | agent.get_supported_discovery_methods() 29 | -------------------------------------------------------------------------------- /tests/test_designer.py: -------------------------------------------------------------------------------- 1 | """Tests for `prettyqt` package.""" 2 | 3 | from prettyqt import designer 4 | 5 | 6 | def test_abstractextensionfactory(qtbot): 7 | designer.AbstractExtensionFactory() 8 | 9 | 10 | # Segfault with PySide6 11 | # def test_pydesignertaskmenuextension(qtbot): 12 | # parent = core.Object() 13 | # designer.PyDesignerTaskMenuExtension(parent) 14 | -------------------------------------------------------------------------------- /tests/test_helpers.py: -------------------------------------------------------------------------------- 1 | """Tests for `prettyqt` package.""" 2 | 3 | import pytest 4 | 5 | from prettyqt.utils import helpers 6 | 7 | 8 | def test_string_to_num_array(): 9 | assert helpers.string_to_num_array("1, 3, 5") == [1, 3, 5] 10 | with pytest.raises(ValueError): # noqa: PT011 11 | helpers.string_to_num_array("1, 2, f") 12 | -------------------------------------------------------------------------------- /tests/test_ipython.py: -------------------------------------------------------------------------------- 1 | """Tests for `prettyqt` package.""" 2 | 3 | import pytest 4 | 5 | 6 | ipython = pytest.importorskip("prettyqt.ipython") 7 | 8 | 9 | # TODO: this somehow interferes with AbstractItemModel.__getitem__ for whatever reason... 10 | # Need to investigate. 11 | 12 | # def test_inprocessipythonwidget(qtbot): 13 | # widget = ipython.InProcessIPythonWidget() 14 | # qtbot.addWidget(widget) 15 | # widget.push_vars(dict(a=1)) 16 | # assert widget.eval("a") == 1 17 | 18 | 19 | # def test_outofprocessipythonwidget(qapp): 20 | # widget = ipython.OutOfProcessIPythonWidget() 21 | # assert widget is not None 22 | -------------------------------------------------------------------------------- /tests/test_multimediawidgets.py: -------------------------------------------------------------------------------- 1 | """Tests for `prettyqt` package.""" 2 | 3 | import pytest 4 | 5 | from prettyqt.utils import InvalidParamError 6 | 7 | 8 | multimediawidgets = pytest.importorskip("prettyqt.multimediawidgets") 9 | 10 | 11 | def test_videowidget(qapp): 12 | multimediawidgets.VideoWidget() 13 | 14 | 15 | def test_graphicsvideoitem(qapp): 16 | item = multimediawidgets.GraphicsVideoItem() 17 | item.get_offset() 18 | item.get_native_size() 19 | item.get_size() 20 | item.set_aspect_ratio_mode("keep") 21 | with pytest.raises(InvalidParamError): 22 | item.set_aspect_ratio_mode("test") 23 | assert item.get_aspect_ratio_mode() == "keep" 24 | -------------------------------------------------------------------------------- /tests/test_openglwidgets.py: -------------------------------------------------------------------------------- 1 | """Tests for `prettyqt` package.""" 2 | 3 | from prettyqt import openglwidgets 4 | 5 | 6 | def test_openglwidget(qtbot): 7 | openglwidgets.OpenGLWidget() 8 | -------------------------------------------------------------------------------- /tests/test_pdf.py: -------------------------------------------------------------------------------- 1 | """Tests for `prettyqt` package.""" 2 | 3 | from prettyqt import pdf 4 | 5 | 6 | def test_pdfdocument(qapp): 7 | doc = pdf.PdfDocument(qapp) 8 | assert doc.get_error() == "none" 9 | assert doc.get_status() == "null" 10 | -------------------------------------------------------------------------------- /tests/test_pdfwidgets.py: -------------------------------------------------------------------------------- 1 | """Tests for `prettyqt` package.""" 2 | 3 | import sys 4 | 5 | import pytest 6 | 7 | import prettyqt 8 | from prettyqt import pdfwidgets 9 | 10 | 11 | @pytest.mark.skipif( 12 | sys.platform == "linux" and prettyqt.qt.API.startswith("pyside"), 13 | reason="Segmentation fault", 14 | ) 15 | def test_pdfview(qapp): 16 | widget = pdfwidgets.PdfView() 17 | assert widget.get_page_mode() == "single" 18 | assert widget.get_zoom_mode() == "custom" 19 | -------------------------------------------------------------------------------- /tests/test_quickwidgets.py: -------------------------------------------------------------------------------- 1 | """Tests for `prettyqt` package.""" 2 | 3 | import pathlib 4 | 5 | from prettyqt import quickwidgets 6 | 7 | 8 | def test_quickview(): 9 | view = quickwidgets.QuickWidget() 10 | path = pathlib.Path.cwd() / "tests" / "qmltest.qml" 11 | view.set_source(path) 12 | assert view.get_source() == path 13 | assert view.get_status() == "ready" 14 | -------------------------------------------------------------------------------- /tests/test_regexeditor.py: -------------------------------------------------------------------------------- 1 | """Tests for `prettyqt` package.""" 2 | 3 | import pytest 4 | 5 | from prettyqt import qt 6 | from prettyqt.custom_widgets import regexeditor 7 | 8 | 9 | @pytest.mark.skipif(qt.API == "pyside6", reason="Leads to Segfault later on in tests") 10 | def test_regexeditor(qtbot): 11 | teststring = "aa356aa356aa356aa356aa356aa356aa356aa3a356aa356" 12 | widget = regexeditor.RegexEditorWidget(regex="aa[0-9]", teststring=teststring) 13 | widget.show() 14 | widget.close() 15 | -------------------------------------------------------------------------------- /tests/test_scxml.py: -------------------------------------------------------------------------------- 1 | """Tests for `prettyqt` package.""" 2 | 3 | import pytest 4 | 5 | 6 | scxml = pytest.importorskip("prettyqt.scxml") 7 | 8 | 9 | def test_scxmlcompiler(qtbot): 10 | compiler = scxml.ScxmlCompiler() 11 | compiler.get_file_path() 12 | 13 | 14 | def test_scxmlstatemachine(qtbot): 15 | machine = scxml.ScxmlStateMachine() 16 | assert machine 17 | -------------------------------------------------------------------------------- /tests/test_svg.py: -------------------------------------------------------------------------------- 1 | """Tests for `prettyqt` package.""" 2 | 3 | import sys 4 | 5 | import pytest 6 | 7 | import prettyqt 8 | from prettyqt.utils import InvalidParamError 9 | 10 | 11 | svg = pytest.importorskip("prettyqt.svg") 12 | 13 | 14 | def test_svggenerator(): 15 | gen = svg.SvgGenerator() 16 | gen.get_size() 17 | gen.get_viewbox() 18 | gen.get_viewboxf() 19 | 20 | 21 | @pytest.mark.skipif( 22 | sys.platform == "linux" and prettyqt.qt.API.startswith("pyside"), 23 | reason="Segmentation fault", 24 | ) 25 | def test_svgrenderer(): 26 | renderer = svg.SvgRenderer() 27 | with pytest.raises(ValueError): # noqa: PT011 28 | renderer.load_file("test") 29 | renderer.set_aspect_ratio_mode("ignore") 30 | assert renderer.get_aspect_ratio_mode() == "ignore" 31 | with pytest.raises(InvalidParamError): 32 | renderer.set_aspect_ratio_mode("test") 33 | -------------------------------------------------------------------------------- /tests/test_svgwidgets.py: -------------------------------------------------------------------------------- 1 | """Tests for `prettyqt` package.""" 2 | 3 | # from prettyqt import svgwidgets 4 | 5 | 6 | # def test_svgwidget(): 7 | # widget = svgwidgets.SvgWidget() 8 | # widget.load_file("") 9 | 10 | 11 | # def test_svggraphicsitem(): 12 | # item = svgwidgets.GraphicsSvgItem() 13 | # assert item 14 | -------------------------------------------------------------------------------- /tests/test_test.py: -------------------------------------------------------------------------------- 1 | """Tests for `prettyqt` package.""" 2 | 3 | from prettyqt import gui, test, widgets 4 | 5 | 6 | def test_buttondelegate(qtbot): 7 | model = gui.StandardItemModel() 8 | test.AbstractItemModelTester(model) 9 | 10 | 11 | def test_signalspy(qtbot): 12 | widget = widgets.Widget() 13 | test.SignalSpy(widget.windowIconChanged) 14 | -------------------------------------------------------------------------------- /tests/test_texttospeech.py: -------------------------------------------------------------------------------- 1 | """Tests for `prettyqt` package.""" 2 | 3 | # import pytest 4 | 5 | import pytest 6 | 7 | 8 | texttospeech = pytest.importorskip("prettyqt.texttospeech") 9 | 10 | 11 | # from prettyqt.utils import InvalidParamError 12 | 13 | 14 | def test_texttospeech(qtlog): 15 | with qtlog.disabled(): 16 | tts = texttospeech.TextToSpeech() 17 | assert tts.get_state() in ["ready", "error"] 18 | tts.get_locale() 19 | tts.get_available_locales() 20 | tts.get_voice() 21 | tts.get_available_voices() 22 | 23 | 24 | def test_voice(): 25 | voice = texttospeech.Voice() 26 | assert voice.get_age() == "other" 27 | assert voice.get_gender() == "unknown" 28 | -------------------------------------------------------------------------------- /tests/test_webenginewidgets.py: -------------------------------------------------------------------------------- 1 | """Tests for `prettyqt` package.""" 2 | 3 | from prettyqt import webenginewidgets 4 | 5 | 6 | def test_webengineview(qapp): 7 | widget = webenginewidgets.WebEngineView() 8 | widget.set_zoom(1.5) 9 | widget.set_url("http://www.google.de") 10 | widget.load_url("http://www.google.de") 11 | widget.find_text("test", backward=True, case_sensitive=True, callback=None) 12 | widget.last_context_menu_request() 13 | --------------------------------------------------------------------------------