├── src
├── scripts
│ ├── __init__.py
│ ├── templates
│ │ └── widget.md
│ ├── blp.py
│ └── get_widget_info.py
├── data
│ ├── videos
│ │ └── video.mp4
│ ├── icons
│ │ └── icon-512x512.png
│ ├── database
│ │ ├── brazilian_states
│ │ ├── brazilian_states.csv
│ │ ├── brazilian_states.json
│ │ └── brazilian_states.sql
│ ├── images
│ │ └── thunderstorm.jpg
│ └── br.com.justcode.PyGObject.desktop
├── libadwaita-widgets
│ ├── application-window
│ │ └── ui
│ │ │ ├── MainWindow.blp
│ │ │ ├── MainWindow.ui
│ │ │ └── MainWindow.py
│ ├── navigation-split-view
│ │ └── ui
│ │ │ ├── MainWindow.blp
│ │ │ ├── Page01.blp
│ │ │ ├── Page02.blp
│ │ │ ├── Sidebar copy.blp
│ │ │ ├── Sidebar.blp
│ │ │ ├── MainWindow.ui
│ │ │ ├── Page01.ui
│ │ │ ├── Page02.ui
│ │ │ └── Sidebar.ui
│ ├── password-entry-row
│ │ └── ui
│ │ │ ├── MainWindow.blp
│ │ │ ├── MainWindow.ui
│ │ │ └── MainWindow.py
│ ├── about-dialog
│ │ └── ui
│ │ │ ├── MainWindow.blp
│ │ │ └── MainWindow.ui
│ ├── alert-dialog
│ │ └── ui
│ │ │ ├── MainWindow.blp
│ │ │ └── MainWindow.ui
│ ├── breakpoint
│ │ └── ui
│ │ │ ├── MainWindow.blp
│ │ │ ├── MainWindow.ui
│ │ │ └── MainWindow.py
│ ├── status-page
│ │ └── ui
│ │ │ ├── MainWindow.blp
│ │ │ ├── MainWindow.ui
│ │ │ └── MainWindow.py
│ ├── toast-overlay
│ │ └── ui
│ │ │ ├── MainWindow.blp
│ │ │ └── MainWindow.ui
│ ├── button-content
│ │ └── ui
│ │ │ ├── MainWindow.blp
│ │ │ └── MainWindow.ui
│ ├── clamp
│ │ └── ui
│ │ │ ├── MainWindow.blp
│ │ │ ├── MainWindow.py
│ │ │ └── MainWindow.ui
│ ├── avatar
│ │ └── ui
│ │ │ ├── MainWindow.blp
│ │ │ └── MainWindow.py
│ ├── banner
│ │ └── ui
│ │ │ └── MainWindow.blp
│ ├── sidebar
│ │ └── ui
│ │ │ ├── MainWindow.ui
│ │ │ └── MainWindow.blp
│ ├── sidebar-item
│ │ └── ui
│ │ │ ├── MainWindow.ui
│ │ │ └── MainWindow.blp
│ ├── sidebar-section
│ │ └── ui
│ │ │ ├── MainWindow.ui
│ │ │ └── MainWindow.blp
│ ├── shortcuts-dialog
│ │ └── ui
│ │ │ └── MainWindow.blp
│ ├── view-stack
│ │ └── ui
│ │ │ ├── MainWindow.blp
│ │ │ └── MainWindow.py
│ ├── view-stack-page
│ │ └── ui
│ │ │ ├── MainWindow.blp
│ │ │ └── MainWindow.py
│ ├── view-switcher-bar
│ │ └── ui
│ │ │ ├── MainWindow.blp
│ │ │ └── MainWindow.py
│ ├── view-switcher
│ │ └── ui
│ │ │ ├── MainWindow.blp
│ │ │ └── MainWindow.py
│ ├── button-row
│ │ └── ui
│ │ │ └── MainWindow.blp
│ ├── view-switcher-sidebar
│ │ └── ui
│ │ │ └── MainWindow.blp
│ ├── navigation-view
│ │ └── ui
│ │ │ ├── MainWindow.blp
│ │ │ └── MainWindow.py
│ ├── carousel
│ │ └── ui
│ │ │ └── MainWindow.blp
│ ├── carousel-indicator-dots
│ │ └── ui
│ │ │ └── MainWindow.blp
│ ├── carousel-indicator-lines
│ │ └── ui
│ │ │ └── MainWindow.blp
│ ├── preferences-page
│ │ └── ui
│ │ │ └── MainWindow.blp
│ ├── split-button
│ │ └── ui
│ │ │ └── MainWindow.blp
│ ├── expander-row
│ │ └── ui
│ │ │ └── MainWindow.py
│ └── multi-layout-view
│ │ └── ui
│ │ └── MainWindow.py
└── gtk-widgets
│ ├── window
│ └── ui
│ │ ├── NewWindow.blp
│ │ ├── MainWindow.blp
│ │ ├── NewWindow.ui
│ │ └── MainWindow.ui
│ ├── application-window
│ └── ui
│ │ ├── MainWindow.blp
│ │ └── MainWindow.ui
│ ├── picture
│ └── ui
│ │ ├── MainWindow.blp
│ │ └── MainWindow.ui
│ ├── video
│ └── ui
│ │ ├── MainWindow.blp
│ │ └── MainWindow.ui
│ ├── fixed
│ └── ui
│ │ ├── MainWindow.blp
│ │ └── MainWindow.ui
│ ├── translation-gettext
│ ├── ui
│ │ ├── MainWindow.blp
│ │ ├── locale
│ │ │ └── pt_BR
│ │ │ │ └── LC_MESSAGES
│ │ │ │ └── br.com.justcode.Gtk.po
│ │ └── MainWindow.ui
│ └── locale
│ │ └── pt_BR
│ │ └── LC_MESSAGES
│ │ └── br.com.justcode.Gtk.po
│ ├── drag-and-drop-data
│ └── ui
│ │ ├── MainWindow.blp
│ │ └── MainWindow.ui
│ ├── switch
│ └── ui
│ │ ├── MainWindow.blp
│ │ └── MainWindow.ui
│ ├── calendar
│ └── ui
│ │ ├── MainWindow.blp
│ │ └── MainWindow.ui
│ ├── check-button
│ └── ui
│ │ ├── MainWindow.blp
│ │ └── MainWindow.ui
│ ├── drag-and-drop-widget
│ └── ui
│ │ ├── MainWindow.blp
│ │ └── MainWindow.ui
│ ├── button
│ └── ui
│ │ ├── MainWindow.blp
│ │ └── MainWindow.ui
│ ├── image
│ └── ui
│ │ ├── MainWindow.blp
│ │ └── MainWindow.ui
│ ├── menu-button
│ └── ui
│ │ ├── MainWindow.blp
│ │ └── MainWindow.ui
│ ├── pango-tags
│ └── ui
│ │ ├── MainWindow.blp
│ │ └── MainWindow.ui
│ ├── css-provider
│ └── ui
│ │ ├── MainWindow.blp
│ │ └── MainWindow.ui
│ ├── file-dialog-folder
│ └── ui
│ │ ├── MainWindow.blp
│ │ └── MainWindow.ui
│ ├── entry
│ └── ui
│ │ ├── MainWindow.blp
│ │ └── MainWindow.ui
│ ├── font-dialog-button
│ └── ui
│ │ └── MainWindow.blp
│ ├── header-bar
│ └── ui
│ │ └── MainWindow.blp
│ ├── color-dialog-button
│ └── ui
│ │ └── MainWindow.blp
│ ├── overlay
│ └── ui
│ │ ├── MainWindow.blp
│ │ └── MainWindow.py
│ ├── box-horizontal
│ └── ui
│ │ └── MainWindow.blp
│ ├── box-vertical
│ └── ui
│ │ └── MainWindow.blp
│ ├── list-view
│ └── ui
│ │ └── MainWindow.blp
│ ├── flow-box
│ └── ui
│ │ ├── MainWindow.blp
│ │ └── MainWindow.py
│ ├── actionbar
│ └── ui
│ │ └── MainWindow.blp
│ ├── check-button-radio
│ └── ui
│ │ └── MainWindow.blp
│ ├── search-bar
│ └── ui
│ │ └── MainWindow.blp
│ ├── file-dialog-save
│ └── ui
│ │ └── MainWindow.blp
│ ├── print-operation
│ └── ui
│ │ └── MainWindow.blp
│ ├── drop-down
│ └── ui
│ │ └── MainWindow.blp
│ ├── file-dialog-open
│ └── ui
│ │ └── MainWindow.blp
│ ├── grid
│ └── ui
│ │ ├── MainWindow.blp
│ │ └── MainWindow.py
│ ├── stack-sidebar
│ └── ui
│ │ ├── MainWindow.blp
│ │ └── MainWindow.py
│ └── stack-switcher
│ └── ui
│ └── MainWindow.blp
├── .github
└── FUNDING.yml
├── _config.yml
├── docs
├── images
│ ├── py-gtk.png
│ ├── gtk-widgets
│ │ ├── button.png
│ │ ├── entry.png
│ │ ├── fixed.png
│ │ ├── grid.png
│ │ ├── image.png
│ │ ├── switch.png
│ │ ├── video.png
│ │ ├── window.png
│ │ ├── calendar.png
│ │ ├── flow-box.png
│ │ ├── list-box.png
│ │ ├── overlay.png
│ │ ├── picture.png
│ │ ├── actionbar.png
│ │ ├── drop-down.png
│ │ ├── header-bar.png
│ │ ├── list-view.png
│ │ ├── menu-button.png
│ │ ├── pango-tags.png
│ │ ├── search-bar.png
│ │ ├── box-vertical.png
│ │ ├── check-button.png
│ │ ├── css-provider.png
│ │ ├── stack-sidebar.png
│ │ ├── box-horizontal.png
│ │ ├── file-dialog-open.png
│ │ ├── file-dialog-save.png
│ │ ├── print-operation.png
│ │ ├── stack-switcher.png
│ │ ├── application-window.png
│ │ ├── check-button-radio.png
│ │ ├── drag-and-drop-data.png
│ │ ├── file-dialog-folder.png
│ │ ├── font-dialog-button.png
│ │ ├── color-dialog-button.png
│ │ ├── drag-and-drop-widget.png
│ │ └── translation-gettext.png
│ ├── libadwaita-widgets
│ │ ├── avatar.png
│ │ ├── banner.png
│ │ ├── clamp.png
│ │ ├── carousel.png
│ │ ├── combo-row.png
│ │ ├── entry-row.png
│ │ ├── sidebar.png
│ │ ├── action-row.png
│ │ ├── breakpoint.png
│ │ ├── button-row.png
│ │ ├── status-page.png
│ │ ├── view-stack.png
│ │ ├── about-dialog.png
│ │ ├── alert-dialog.png
│ │ ├── bottom-sheet.png
│ │ ├── button-content.png
│ │ ├── expander-row.png
│ │ ├── split-button.png
│ │ ├── toast-overlay.png
│ │ ├── navigation-view.png
│ │ ├── preferences-page.png
│ │ ├── shortcuts-dialog.png
│ │ ├── application-window.png
│ │ ├── multi-layout-view.png
│ │ ├── password-entry-row.png
│ │ ├── view-switcher-bar.png
│ │ ├── navigation-split-view.png
│ │ ├── view-switcher-sidebar.png
│ │ ├── carousel-indicator-dots.png
│ │ └── carousel-indicator-lines.png
│ ├── favicon
│ │ └── br.com.justcode.Gtk.png
│ └── gnome-builder
│ │ ├── blueprint-compiler-port.png
│ │ ├── blueprint-custom-target.png
│ │ └── blueprint-dependencies.png
├── setup-blueprint-gnome-builder-pt_BR.md
└── setup-blueprint-gnome-builder-en.md
├── .coveragerc
├── pytest.ini
├── tests
├── test_main_window.py
└── conftest.py
├── pyproject.toml
└── LICENSE
/src/scripts/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | github: natorsc
--------------------------------------------------------------------------------
/_config.yml:
--------------------------------------------------------------------------------
1 | plugins:
2 | - jekyll-sitemap
--------------------------------------------------------------------------------
/docs/images/py-gtk.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/py-gtk.png
--------------------------------------------------------------------------------
/src/data/videos/video.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/src/data/videos/video.mp4
--------------------------------------------------------------------------------
/src/data/icons/icon-512x512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/src/data/icons/icon-512x512.png
--------------------------------------------------------------------------------
/docs/images/gtk-widgets/button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gtk-widgets/button.png
--------------------------------------------------------------------------------
/docs/images/gtk-widgets/entry.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gtk-widgets/entry.png
--------------------------------------------------------------------------------
/docs/images/gtk-widgets/fixed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gtk-widgets/fixed.png
--------------------------------------------------------------------------------
/docs/images/gtk-widgets/grid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gtk-widgets/grid.png
--------------------------------------------------------------------------------
/docs/images/gtk-widgets/image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gtk-widgets/image.png
--------------------------------------------------------------------------------
/docs/images/gtk-widgets/switch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gtk-widgets/switch.png
--------------------------------------------------------------------------------
/docs/images/gtk-widgets/video.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gtk-widgets/video.png
--------------------------------------------------------------------------------
/docs/images/gtk-widgets/window.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gtk-widgets/window.png
--------------------------------------------------------------------------------
/src/data/database/brazilian_states:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/src/data/database/brazilian_states
--------------------------------------------------------------------------------
/src/data/images/thunderstorm.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/src/data/images/thunderstorm.jpg
--------------------------------------------------------------------------------
/docs/images/gtk-widgets/calendar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gtk-widgets/calendar.png
--------------------------------------------------------------------------------
/docs/images/gtk-widgets/flow-box.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gtk-widgets/flow-box.png
--------------------------------------------------------------------------------
/docs/images/gtk-widgets/list-box.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gtk-widgets/list-box.png
--------------------------------------------------------------------------------
/docs/images/gtk-widgets/overlay.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gtk-widgets/overlay.png
--------------------------------------------------------------------------------
/docs/images/gtk-widgets/picture.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gtk-widgets/picture.png
--------------------------------------------------------------------------------
/docs/images/gtk-widgets/actionbar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gtk-widgets/actionbar.png
--------------------------------------------------------------------------------
/docs/images/gtk-widgets/drop-down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gtk-widgets/drop-down.png
--------------------------------------------------------------------------------
/docs/images/gtk-widgets/header-bar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gtk-widgets/header-bar.png
--------------------------------------------------------------------------------
/docs/images/gtk-widgets/list-view.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gtk-widgets/list-view.png
--------------------------------------------------------------------------------
/docs/images/gtk-widgets/menu-button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gtk-widgets/menu-button.png
--------------------------------------------------------------------------------
/docs/images/gtk-widgets/pango-tags.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gtk-widgets/pango-tags.png
--------------------------------------------------------------------------------
/docs/images/gtk-widgets/search-bar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gtk-widgets/search-bar.png
--------------------------------------------------------------------------------
/docs/images/gtk-widgets/box-vertical.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gtk-widgets/box-vertical.png
--------------------------------------------------------------------------------
/docs/images/gtk-widgets/check-button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gtk-widgets/check-button.png
--------------------------------------------------------------------------------
/docs/images/gtk-widgets/css-provider.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gtk-widgets/css-provider.png
--------------------------------------------------------------------------------
/docs/images/gtk-widgets/stack-sidebar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gtk-widgets/stack-sidebar.png
--------------------------------------------------------------------------------
/docs/images/libadwaita-widgets/avatar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/libadwaita-widgets/avatar.png
--------------------------------------------------------------------------------
/docs/images/libadwaita-widgets/banner.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/libadwaita-widgets/banner.png
--------------------------------------------------------------------------------
/docs/images/libadwaita-widgets/clamp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/libadwaita-widgets/clamp.png
--------------------------------------------------------------------------------
/docs/images/favicon/br.com.justcode.Gtk.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/favicon/br.com.justcode.Gtk.png
--------------------------------------------------------------------------------
/docs/images/gtk-widgets/box-horizontal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gtk-widgets/box-horizontal.png
--------------------------------------------------------------------------------
/docs/images/gtk-widgets/file-dialog-open.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gtk-widgets/file-dialog-open.png
--------------------------------------------------------------------------------
/docs/images/gtk-widgets/file-dialog-save.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gtk-widgets/file-dialog-save.png
--------------------------------------------------------------------------------
/docs/images/gtk-widgets/print-operation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gtk-widgets/print-operation.png
--------------------------------------------------------------------------------
/docs/images/gtk-widgets/stack-switcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gtk-widgets/stack-switcher.png
--------------------------------------------------------------------------------
/docs/images/libadwaita-widgets/carousel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/libadwaita-widgets/carousel.png
--------------------------------------------------------------------------------
/docs/images/libadwaita-widgets/combo-row.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/libadwaita-widgets/combo-row.png
--------------------------------------------------------------------------------
/docs/images/libadwaita-widgets/entry-row.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/libadwaita-widgets/entry-row.png
--------------------------------------------------------------------------------
/docs/images/libadwaita-widgets/sidebar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/libadwaita-widgets/sidebar.png
--------------------------------------------------------------------------------
/docs/images/gtk-widgets/application-window.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gtk-widgets/application-window.png
--------------------------------------------------------------------------------
/docs/images/gtk-widgets/check-button-radio.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gtk-widgets/check-button-radio.png
--------------------------------------------------------------------------------
/docs/images/gtk-widgets/drag-and-drop-data.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gtk-widgets/drag-and-drop-data.png
--------------------------------------------------------------------------------
/docs/images/gtk-widgets/file-dialog-folder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gtk-widgets/file-dialog-folder.png
--------------------------------------------------------------------------------
/docs/images/gtk-widgets/font-dialog-button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gtk-widgets/font-dialog-button.png
--------------------------------------------------------------------------------
/docs/images/libadwaita-widgets/action-row.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/libadwaita-widgets/action-row.png
--------------------------------------------------------------------------------
/docs/images/libadwaita-widgets/breakpoint.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/libadwaita-widgets/breakpoint.png
--------------------------------------------------------------------------------
/docs/images/libadwaita-widgets/button-row.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/libadwaita-widgets/button-row.png
--------------------------------------------------------------------------------
/docs/images/libadwaita-widgets/status-page.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/libadwaita-widgets/status-page.png
--------------------------------------------------------------------------------
/docs/images/libadwaita-widgets/view-stack.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/libadwaita-widgets/view-stack.png
--------------------------------------------------------------------------------
/docs/images/gtk-widgets/color-dialog-button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gtk-widgets/color-dialog-button.png
--------------------------------------------------------------------------------
/docs/images/gtk-widgets/drag-and-drop-widget.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gtk-widgets/drag-and-drop-widget.png
--------------------------------------------------------------------------------
/docs/images/gtk-widgets/translation-gettext.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gtk-widgets/translation-gettext.png
--------------------------------------------------------------------------------
/docs/images/libadwaita-widgets/about-dialog.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/libadwaita-widgets/about-dialog.png
--------------------------------------------------------------------------------
/docs/images/libadwaita-widgets/alert-dialog.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/libadwaita-widgets/alert-dialog.png
--------------------------------------------------------------------------------
/docs/images/libadwaita-widgets/bottom-sheet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/libadwaita-widgets/bottom-sheet.png
--------------------------------------------------------------------------------
/docs/images/libadwaita-widgets/button-content.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/libadwaita-widgets/button-content.png
--------------------------------------------------------------------------------
/docs/images/libadwaita-widgets/expander-row.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/libadwaita-widgets/expander-row.png
--------------------------------------------------------------------------------
/docs/images/libadwaita-widgets/split-button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/libadwaita-widgets/split-button.png
--------------------------------------------------------------------------------
/docs/images/libadwaita-widgets/toast-overlay.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/libadwaita-widgets/toast-overlay.png
--------------------------------------------------------------------------------
/docs/images/libadwaita-widgets/navigation-view.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/libadwaita-widgets/navigation-view.png
--------------------------------------------------------------------------------
/docs/images/libadwaita-widgets/preferences-page.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/libadwaita-widgets/preferences-page.png
--------------------------------------------------------------------------------
/docs/images/libadwaita-widgets/shortcuts-dialog.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/libadwaita-widgets/shortcuts-dialog.png
--------------------------------------------------------------------------------
/docs/images/gnome-builder/blueprint-compiler-port.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gnome-builder/blueprint-compiler-port.png
--------------------------------------------------------------------------------
/docs/images/gnome-builder/blueprint-custom-target.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gnome-builder/blueprint-custom-target.png
--------------------------------------------------------------------------------
/docs/images/gnome-builder/blueprint-dependencies.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/gnome-builder/blueprint-dependencies.png
--------------------------------------------------------------------------------
/docs/images/libadwaita-widgets/application-window.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/libadwaita-widgets/application-window.png
--------------------------------------------------------------------------------
/docs/images/libadwaita-widgets/multi-layout-view.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/libadwaita-widgets/multi-layout-view.png
--------------------------------------------------------------------------------
/docs/images/libadwaita-widgets/password-entry-row.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/libadwaita-widgets/password-entry-row.png
--------------------------------------------------------------------------------
/docs/images/libadwaita-widgets/view-switcher-bar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/libadwaita-widgets/view-switcher-bar.png
--------------------------------------------------------------------------------
/docs/images/libadwaita-widgets/navigation-split-view.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/libadwaita-widgets/navigation-split-view.png
--------------------------------------------------------------------------------
/docs/images/libadwaita-widgets/view-switcher-sidebar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/libadwaita-widgets/view-switcher-sidebar.png
--------------------------------------------------------------------------------
/docs/images/libadwaita-widgets/carousel-indicator-dots.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/libadwaita-widgets/carousel-indicator-dots.png
--------------------------------------------------------------------------------
/docs/images/libadwaita-widgets/carousel-indicator-lines.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natorsc/py-gtk/HEAD/docs/images/libadwaita-widgets/carousel-indicator-lines.png
--------------------------------------------------------------------------------
/.coveragerc:
--------------------------------------------------------------------------------
1 | [run]
2 | source = src
3 | omit =
4 | */tests/*
5 | */venv/*
6 | */__pycache__/*
7 |
8 | [report]
9 | exclude_lines =
10 | pragma: no cover
11 | def __repr__
12 | raise NotImplementedError
13 | if __name__ == .__main__.:
14 | if TYPE_CHECKING:
15 | @abstractmethod
--------------------------------------------------------------------------------
/pytest.ini:
--------------------------------------------------------------------------------
1 | [pytest]
2 | testpaths = tests
3 | python_files = test_*.py
4 | python_classes = Test*
5 | python_functions = test_*
6 | addopts =
7 | -v
8 | --strict-markers
9 | --tb=short
10 | #--cov=src
11 | #--cov-report=html
12 | #--cov-report=term-missing
13 | markers =
14 | unit: Unit tests
15 | integration: Integration tests
16 | slow: Slow tests
17 | gui: GUI tests
--------------------------------------------------------------------------------
/src/libadwaita-widgets/application-window/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 | using Adw 1;
3 |
4 | template $ExampleWindow: Adw.ApplicationWindow {
5 | title: "Python - PyGObject - GTK";
6 | default-width: 683;
7 | default-height: 384;
8 |
9 | content: Adw.ToolbarView {
10 | [top]
11 | Adw.HeaderBar header_bar {}
12 |
13 | content: Adw.StatusPage {
14 | title: "Hello World!";
15 | };
16 | };
17 | }
18 |
--------------------------------------------------------------------------------
/src/data/br.com.justcode.PyGObject.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Version=1.0
3 | Type=Application
4 | Name=Exemplo
5 | Icon=/home/natorsc/.icons/br.com.justcode.Gtk/br.com.justcode.Gtk.png
6 | Path=/home/natorsc/Projetos/gui-python-gtk
7 | Exec=bash -c "poetry shell && python src/gtk4/actionbar/MainWindow.py" %f
8 | Comment=Exemplo
9 | Categories=Development;IDE;
10 | Terminal=false
11 | StartupWMClass=br.com.justcode.Gtk
12 | StartupNotify=true
--------------------------------------------------------------------------------
/src/scripts/templates/widget.md:
--------------------------------------------------------------------------------
1 | # {widget_name}
2 |
3 | - GTK versão: {gtk_version}.
4 | - Libadwaita versão: {libadwaita_version}.
5 | - PyGObject versão: {pygobject_version}.
6 |
7 | ## Propriedades:
8 |
9 | Sintaxe: `widget.props.property_name`.
10 |
11 | - {widget_props}.
12 |
13 | ## Sinais (signals):
14 |
15 | - {widget_signals}.
16 |
17 | ## Métodos GET:
18 |
19 | - {methods_get}.
20 |
21 | ## Métodos SET:
22 |
23 | - {methods_set}.
24 |
--------------------------------------------------------------------------------
/src/data/database/brazilian_states.csv:
--------------------------------------------------------------------------------
1 | state
2 | Acre
3 | Alagoas
4 | Amapá
5 | Amazonas
6 | Bahia
7 | Ceará
8 | Distrito Federal
9 | Espírito Santo
10 | Goiás
11 | Maranhão
12 | Mato Grosso
13 | Mato Grosso do Sul
14 | Minas Gerais
15 | Pará
16 | Paraíba
17 | Paraná
18 | Pernambuco
19 | Piauí
20 | Rio de Janeiro
21 | Rio Grande do Norte
22 | Rio Grande do Sul
23 | Rondônia
24 | Roraima
25 | Santa Catarina
26 | São Paulo
27 | Sergipe
28 | Tocantins
29 |
--------------------------------------------------------------------------------
/src/gtk-widgets/window/ui/NewWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 |
3 | template $NewWindow: Gtk.Window {
4 | title: "Python - PyGObject - GTK";
5 | modal: true;
6 | default-width: 600;
7 | default-height: 300;
8 |
9 | Gtk.Box {
10 | orientation: vertical;
11 | margin-top: 12;
12 | margin-end: 12;
13 | margin-bottom: 12;
14 | margin-start: 12;
15 | spacing: 12;
16 |
17 | Gtk.Button {
18 | label: "Close window";
19 | clicked => $on_button_close_clicked();
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/navigation-split-view/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 | using Adw 1;
3 |
4 | template $ExampleWindow: Adw.ApplicationWindow {
5 | title: "Python - PyGObject - GTK";
6 | default-width: 683;
7 | default-height: 384;
8 | width-request: 600;
9 | height-request: 300;
10 |
11 | Adw.Breakpoint {
12 | condition ("max-width: 680")
13 |
14 | setters {
15 | adw_navigation_split_view.collapsed: true;
16 | }
17 | }
18 |
19 | content: Adw.NavigationSplitView adw_navigation_split_view {};
20 | }
21 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/navigation-split-view/ui/Page01.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 | using Adw 1;
3 |
4 | template $Page01: Adw.NavigationPage {
5 | title: "Page 01";
6 | tag: "page-01";
7 |
8 | child: Adw.ToolbarView {
9 | [top]
10 | Adw.HeaderBar {}
11 |
12 | content: Gtk.Box {
13 | orientation: vertical;
14 | spacing: 12;
15 | margin-top: 12;
16 | margin-end: 12;
17 | margin-bottom: 12;
18 | margin-start: 12;
19 |
20 | Gtk.Label {
21 | label: "Page 01";
22 | }
23 | };
24 | };
25 | }
26 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/navigation-split-view/ui/Page02.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 | using Adw 1;
3 |
4 | template $Page02: Adw.NavigationPage {
5 | title: "Page 02";
6 | tag: "page-02";
7 |
8 | child: Adw.ToolbarView {
9 | [top]
10 | Adw.HeaderBar {}
11 |
12 | content: Gtk.Box {
13 | orientation: vertical;
14 | spacing: 12;
15 | margin-top: 12;
16 | margin-end: 12;
17 | margin-bottom: 12;
18 | margin-start: 12;
19 |
20 | Gtk.Label {
21 | label: "Page 02";
22 | }
23 | };
24 | };
25 | }
26 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/password-entry-row/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 | using Adw 1;
3 |
4 | template $ExampleWindow: Adw.ApplicationWindow {
5 | title: "Python - PyGObject - GTK";
6 | default-width: 683;
7 | default-height: 384;
8 |
9 | content: Adw.ToolbarView {
10 | [top]
11 | Adw.HeaderBar header_bar {}
12 |
13 | content: Gtk.Box {
14 | orientation: vertical;
15 | spacing: 12;
16 | margin-top: 12;
17 | margin-end: 12;
18 | margin-bottom: 12;
19 | margin-start: 12;
20 |
21 | Adw.PasswordEntryRow {}
22 | };
23 | };
24 | }
25 |
--------------------------------------------------------------------------------
/src/gtk-widgets/application-window/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 |
3 | template $ExampleWindow: Gtk.ApplicationWindow {
4 | title: "Python - PyGObject - GTK";
5 | default-width: 683;
6 | default-height: 384;
7 |
8 | [titlebar]
9 | Gtk.HeaderBar header_bar {
10 | [end]
11 | Gtk.MenuButton {
12 | icon-name: "open-menu-symbolic";
13 | menu-model: primary_menu;
14 | }
15 | }
16 | }
17 |
18 | menu primary_menu {
19 | section {
20 | item {
21 | label: _("Preferences");
22 | action: "app.preferences";
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/about-dialog/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 | using Adw 1;
3 |
4 | template $ExampleWindow: Adw.ApplicationWindow {
5 | title: "Python - PyGObject - GTK";
6 | default-width: 683;
7 | default-height: 384;
8 |
9 | content: Adw.ToolbarView {
10 | [top]
11 | Adw.HeaderBar {}
12 |
13 | content: Gtk.Box {
14 | orientation: vertical;
15 | spacing: 12;
16 | margin-top: 12;
17 | margin-end: 12;
18 | margin-bottom: 12;
19 | margin-start: 12;
20 |
21 | Gtk.Button {
22 | label: "Click me";
23 | clicked => $on_button_clicked();
24 | }
25 | };
26 | };
27 | }
28 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/alert-dialog/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 | using Adw 1;
3 |
4 | template $ExampleWindow: Adw.ApplicationWindow {
5 | title: "Python - PyGObject - GTK";
6 | default-width: 683;
7 | default-height: 384;
8 |
9 | content: Adw.ToolbarView {
10 | [top]
11 | Adw.HeaderBar header_bar {}
12 |
13 | content: Gtk.Box {
14 | orientation: vertical;
15 | spacing: 12;
16 | margin-top: 12;
17 | margin-end: 12;
18 | margin-bottom: 12;
19 | margin-start: 12;
20 |
21 | Gtk.Button {
22 | label: "Click here";
23 | clicked => $on_button_clicked();
24 | }
25 | };
26 | };
27 | }
28 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/breakpoint/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 | using Adw 1;
3 |
4 | template $ExampleWindow: Adw.ApplicationWindow {
5 | title: "Python - PyGObject - GTK";
6 | default-width: 683;
7 | default-height: 384;
8 |
9 | content: Adw.ToolbarView {
10 | [top]
11 | Adw.HeaderBar header_bar {}
12 |
13 | content: Adw.StatusPage adw_status_page {
14 | icon-name: "audio-volume-high-symbolic";
15 | title: "Adw.Breakpoint";
16 | };
17 | };
18 |
19 | Adw.Breakpoint {
20 | condition ("max-width: 700")
21 |
22 | setters {
23 | adw_status_page.icon-name: "audio-volume-muted-symbolic";
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/tests/test_main_window.py:
--------------------------------------------------------------------------------
1 | """Testes para janelas."""
2 |
3 | import pytest
4 | from MainWindow import ExampleWindow
5 |
6 |
7 | @pytest.mark.unit
8 | def test_window_creation(app):
9 | window = ExampleWindow(application=app)
10 | assert window is not None
11 | assert window.get_title() == 'Python - PyGObject - GTK'
12 |
13 |
14 | @pytest.mark.unit
15 | def test_window_size(app):
16 | window = ExampleWindow(application=app)
17 | assert window.get_default_size() == (683, 384)
18 |
19 |
20 | @pytest.mark.gui
21 | def test_window_widgets(app):
22 | """Tests if widgets were created (self.widget)."""
23 | window = ExampleWindow(application=app)
24 | assert hasattr(window, 'adw_status_page')
25 |
--------------------------------------------------------------------------------
/src/gtk-widgets/picture/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 |
3 | template $ExampleWindow: Gtk.ApplicationWindow {
4 | title: "Python - PyGObject - GTK";
5 | default-width: 683;
6 | default-height: 384;
7 |
8 | [titlebar]
9 | Gtk.HeaderBar header_bar {
10 | [end]
11 | Gtk.MenuButton {
12 | icon-name: "open-menu-symbolic";
13 | menu-model: primary_menu;
14 | }
15 | }
16 |
17 | Gtk.Box {
18 | orientation: vertical;
19 |
20 | Gtk.Picture picture {
21 | content-fit: fill;
22 | }
23 | }
24 | }
25 |
26 | menu primary_menu {
27 | section {
28 | item {
29 | label: _("Preferences");
30 | action: "app.preferences";
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/status-page/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 | using Adw 1;
3 |
4 | template $ExampleWindow: Adw.ApplicationWindow {
5 | title: "Python - PyGObject - GTK";
6 | default-width: 683;
7 | default-height: 384;
8 |
9 | content: Adw.ToolbarView {
10 | [top]
11 | Adw.HeaderBar header_bar {}
12 |
13 | content: Box {
14 | orientation: vertical;
15 | spacing: 12;
16 | margin-top: 12;
17 | margin-end: 12;
18 | margin-bottom: 12;
19 | margin-start: 12;
20 |
21 | Adw.StatusPage {
22 | description: "Status page description.";
23 | icon-name: "face-smile-big-symbolic";
24 | title: "Status page title.";
25 | }
26 | };
27 | };
28 | }
29 |
--------------------------------------------------------------------------------
/src/gtk-widgets/video/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 |
3 | template $ExampleWindow: Gtk.ApplicationWindow {
4 | title: "Python - PyGObject - GTK";
5 | default-width: 683;
6 | default-height: 384;
7 |
8 | [titlebar]
9 | Gtk.HeaderBar header_bar {
10 | [end]
11 | Gtk.MenuButton {
12 | icon-name: "open-menu-symbolic";
13 | menu-model: primary_menu;
14 | }
15 | }
16 |
17 | Gtk.Box {
18 | orientation: vertical;
19 | homogeneous: true;
20 | margin-top: 12;
21 | margin-end: 12;
22 | margin-bottom: 12;
23 | margin-start: 12;
24 | spacing: 12;
25 |
26 | Gtk.Video video {}
27 | }
28 | }
29 |
30 | menu primary_menu {
31 | section {
32 | item {
33 | label: _("Preferences");
34 | action: "app.preferences";
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/toast-overlay/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 | using Adw 1;
3 |
4 | template $ExampleWindow: Adw.ApplicationWindow {
5 | title: "Python - PyGObject - GTK";
6 | default-width: 683;
7 | default-height: 384;
8 |
9 | content: Adw.ToolbarView {
10 | [top]
11 | Adw.HeaderBar header_bar {}
12 |
13 | content: Adw.ToastOverlay adw_toast_overlay {
14 | child: Gtk.Box {
15 | orientation: vertical;
16 | spacing: 12;
17 | margin-top: 12;
18 | margin-end: 12;
19 | margin-bottom: 12;
20 | margin-start: 12;
21 |
22 | Gtk.Button button {
23 | label: "Click here";
24 | vexpand: true;
25 | valign: center;
26 | clicked => $on_button_clicked();
27 | }
28 | };
29 | };
30 | };
31 | }
32 |
--------------------------------------------------------------------------------
/pyproject.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | name = "py-gtk"
3 | version = "0.1.0"
4 | description = "Creating graphical interfaces with Python (PyGObject) and GTK"
5 | readme = "README.md"
6 | requires-python = ">=3.12,<3.15"
7 | dependencies = [
8 | "pygobject>=3.54.3",
9 | ]
10 |
11 | [dependency-groups]
12 | dev = [
13 | "pygobject-stubs>=2.13.0",
14 | "pytest>=8.4.2",
15 | "ruff>=0.13.2",
16 | "taskipy>=1.14.1",
17 | ]
18 |
19 | [tool.ruff]
20 | line-length = 79
21 | extend-exclude = ["docs", ".venv"]
22 |
23 | [tool.ruff.lint]
24 | select = ["I", "F", "E", "W", "PL", "PT"]
25 |
26 | [tool.ruff.format]
27 | quote-style = "single"
28 |
29 | [tool.taskipy.tasks]
30 | format = "ruff check . --select I --fix && ruff format ."
31 | format-blp = "blueprint-compiler format -f -n src"
32 | outdated = "uv tree --outdated --depth=1"
33 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/navigation-split-view/ui/Sidebar copy.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 | using Adw 1;
3 |
4 | template $Sidebar: Adw.NavigationPage {
5 | title: "Sidebar";
6 | tag: "sidebar";
7 |
8 | [top]
9 | Adw.HeaderBar {
10 | [start]
11 | MenuButton {
12 | icon-name: "system-search";
13 | }
14 |
15 | [end]
16 | MenuButton {
17 | icon-name: "open-menu-symbolic";
18 | menu-model: primary_menu;
19 | }
20 | }
21 |
22 | content: Gtk.ListBox list_box {
23 | selection-mode: none;
24 | row-activated => $on_row_clicked_change_page();
25 |
26 | styles [
27 | "navigation-sidebar",
28 | ]
29 | };
30 | }
31 |
32 | menu primary_menu {
33 | section {
34 | item {
35 | label: _("Preferences");
36 | action: "app.preferences";
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/gtk-widgets/fixed/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 |
3 | template $ExampleWindow: Gtk.ApplicationWindow {
4 | title: "Python - PyGObject - GTK";
5 | default-width: 683;
6 | default-height: 384;
7 |
8 | [titlebar]
9 | Gtk.HeaderBar header_bar {
10 | [end]
11 | Gtk.MenuButton {
12 | icon-name: "open-menu-symbolic";
13 | menu-model: primary_menu;
14 | }
15 | }
16 |
17 | Gtk.Fixed fixed {
18 | margin-top: 12;
19 | margin-end: 12;
20 | margin-bottom: 12;
21 | margin-start: 12;
22 |
23 | Gtk.Button {
24 | label: "Click here";
25 | clicked => $on_button_clicked();
26 | }
27 | }
28 | }
29 |
30 | menu primary_menu {
31 | section {
32 | item {
33 | label: _("Preferences");
34 | action: "app.preferences";
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/gtk-widgets/window/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 |
3 | template $ExampleWindow: Gtk.ApplicationWindow {
4 | title: "Python - PyGObject - GTK";
5 | default-width: 683;
6 | default-height: 384;
7 |
8 | [titlebar]
9 | Gtk.HeaderBar header_bar {
10 | [end]
11 | Gtk.MenuButton {
12 | icon-name: "open-menu-symbolic";
13 | menu-model: primary_menu;
14 | }
15 | }
16 |
17 | Gtk.Box {
18 | orientation: vertical;
19 | margin-top: 12;
20 | margin-end: 12;
21 | margin-bottom: 12;
22 | margin-start: 12;
23 | spacing: 12;
24 |
25 | Gtk.Button {
26 | label: "Open window";
27 | clicked => $on_button_clicked();
28 | }
29 | }
30 | }
31 |
32 | menu primary_menu {
33 | section {
34 | item {
35 | label: _("Preferences");
36 | action: "app.preferences";
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/gtk-widgets/translation-gettext/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 |
3 | template $ExampleWindow: Gtk.ApplicationWindow {
4 | title: "Python - PyGObject - GTK";
5 | default-width: 683;
6 | default-height: 384;
7 |
8 | [titlebar]
9 | Gtk.HeaderBar header_bar {
10 | [end]
11 | Gtk.MenuButton {
12 | icon-name: "open-menu-symbolic";
13 | menu-model: primary_menu;
14 | }
15 | }
16 |
17 | Gtk.Box {
18 | orientation: vertical;
19 | margin-top: 12;
20 | margin-end: 12;
21 | margin-bottom: 12;
22 | margin-start: 12;
23 | spacing: 12;
24 |
25 | Gtk.Label label {
26 | label: _("Hello World!");
27 | vexpand: true;
28 | }
29 | }
30 | }
31 |
32 | menu primary_menu {
33 | section {
34 | item {
35 | label: _("Preferences");
36 | action: "app.preferences";
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/button-content/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 | using Adw 1;
3 |
4 | template $ExampleWindow: Adw.ApplicationWindow {
5 | title: "Python - PyGObject - GTK";
6 | default-width: 683;
7 | default-height: 384;
8 |
9 | content: Adw.ToolbarView {
10 | [top]
11 | Adw.HeaderBar header_bar {}
12 |
13 | content: Gtk.Box {
14 | orientation: vertical;
15 | spacing: 12;
16 | margin-top: 12;
17 | margin-end: 12;
18 | margin-bottom: 12;
19 | margin-start: 12;
20 |
21 | Gtk.Button {
22 | margin-start: 12;
23 | margin-end: 12;
24 | clicked => $on_button_clicked();
25 |
26 | child: Adw.ButtonContent {
27 | icon-name: "document-open-symbolic";
28 | label: "_Open";
29 | use-underline: true;
30 | };
31 | }
32 | };
33 | };
34 | }
35 |
--------------------------------------------------------------------------------
/src/gtk-widgets/drag-and-drop-data/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 |
3 | template $ExampleWindow: Gtk.ApplicationWindow {
4 | title: "Python - PyGObject - GTK";
5 | default-width: 683;
6 | default-height: 384;
7 |
8 | [titlebar]
9 | Gtk.HeaderBar header_bar {
10 | [end]
11 | Gtk.MenuButton {
12 | icon-name: "open-menu-symbolic";
13 | menu-model: primary_menu;
14 | }
15 | }
16 |
17 | Gtk.Box {
18 | orientation: vertical;
19 | margin-top: 12;
20 | margin-end: 12;
21 | margin-bottom: 12;
22 | margin-start: 12;
23 | spacing: 12;
24 |
25 | Gtk.Label label {
26 | label: "Drag and drop the file here.";
27 | vexpand: true;
28 | }
29 | }
30 | }
31 |
32 | menu primary_menu {
33 | section {
34 | item {
35 | label: _("Preferences");
36 | action: "app.preferences";
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/gtk-widgets/switch/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 |
3 | template $ExampleWindow: Gtk.ApplicationWindow {
4 | title: "Python - PyGObject - GTK";
5 | default-width: 683;
6 | default-height: 384;
7 |
8 | [titlebar]
9 | Gtk.HeaderBar header_bar {
10 | [end]
11 | Gtk.MenuButton {
12 | icon-name: "open-menu-symbolic";
13 | menu-model: primary_menu;
14 | }
15 | }
16 |
17 | Gtk.Box {
18 | orientation: vertical;
19 | margin-top: 12;
20 | margin-end: 12;
21 | margin-bottom: 12;
22 | margin-start: 12;
23 | spacing: 12;
24 |
25 | Gtk.Switch switch {
26 | halign: start;
27 | notify::active => $on_switch_button_clicked();
28 | }
29 | }
30 | }
31 |
32 | menu primary_menu {
33 | section {
34 | item {
35 | label: _("Preferences");
36 | action: "app.preferences";
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/gtk-widgets/calendar/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 |
3 | template $ExampleWindow: Gtk.ApplicationWindow {
4 | title: "Python - PyGObject - GTK";
5 | default-width: 683;
6 | default-height: 384;
7 |
8 | [titlebar]
9 | Gtk.HeaderBar header_bar {
10 | [end]
11 | Gtk.MenuButton {
12 | icon-name: "open-menu-symbolic";
13 | menu-model: primary_menu;
14 | }
15 | }
16 |
17 | Gtk.Box {
18 | orientation: vertical;
19 | homogeneous: true;
20 | margin-top: 12;
21 | margin-end: 12;
22 | margin-bottom: 12;
23 | margin-start: 12;
24 | spacing: 12;
25 |
26 | Gtk.Calendar {
27 | day-selected => $on_day_selected();
28 | }
29 | }
30 | }
31 |
32 | menu primary_menu {
33 | section {
34 | item {
35 | label: _("Preferences");
36 | action: "app.preferences";
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/gtk-widgets/check-button/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 |
3 | template $ExampleWindow: Gtk.ApplicationWindow {
4 | title: "Python - PyGObject - GTK";
5 | default-width: 683;
6 | default-height: 384;
7 |
8 | [titlebar]
9 | Gtk.HeaderBar header_bar {
10 | [end]
11 | Gtk.MenuButton {
12 | icon-name: "open-menu-symbolic";
13 | menu-model: primary_menu;
14 | }
15 | }
16 |
17 | Gtk.Box {
18 | orientation: vertical;
19 | margin-top: 12;
20 | margin-end: 12;
21 | margin-bottom: 12;
22 | margin-start: 12;
23 | spacing: 12;
24 |
25 | Gtk.CheckButton {
26 | label: "Accept?";
27 | toggled => $on_check_button_toggled();
28 | }
29 | }
30 | }
31 |
32 | menu primary_menu {
33 | section {
34 | item {
35 | label: _("Preferences");
36 | action: "app.preferences";
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/gtk-widgets/drag-and-drop-widget/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 |
3 | template $ExampleWindow: Gtk.ApplicationWindow {
4 | title: "Python - PyGObject - GTK";
5 | default-width: 683;
6 | default-height: 384;
7 |
8 | [titlebar]
9 | Gtk.HeaderBar header_bar {
10 | [end]
11 | Gtk.MenuButton {
12 | icon-name: "open-menu-symbolic";
13 | menu-model: primary_menu;
14 | }
15 | }
16 |
17 | Gtk.Box {
18 | orientation: vertical;
19 | homogeneous: true;
20 | margin-top: 12;
21 | margin-end: 12;
22 | margin-bottom: 12;
23 | margin-start: 12;
24 | spacing: 12;
25 |
26 | Gtk.ScrolledWindow {
27 | Gtk.ListBox list_box {
28 | selection-mode: none;
29 | }
30 | }
31 | }
32 | }
33 |
34 | menu primary_menu {
35 | section {
36 | item {
37 | label: _("Preferences");
38 | action: "app.preferences";
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/tests/conftest.py:
--------------------------------------------------------------------------------
1 | """Configurações e fixtures globais para pytest."""
2 |
3 | import gi
4 | import pytest
5 |
6 | gi.require_version('Gtk', version='4.0')
7 | gi.require_version('Adw', version='1')
8 |
9 | from gi.repository import Adw, Gio
10 |
11 |
12 | @pytest.fixture(scope='session', autouse=True)
13 | def gtk_init():
14 | """Initialize GTK once per testing session."""
15 | Adw.init()
16 | yield
17 |
18 |
19 | @pytest.fixture
20 | def app():
21 | """Create a GTK application for testing."""
22 | application = Adw.Application(
23 | application_id='br.com.test.App',
24 | flags=Gio.ApplicationFlags.DEFAULT_FLAGS,
25 | )
26 | yield application
27 | # Cleanup
28 | application.quit()
29 |
30 |
31 | @pytest.fixture
32 | def main_loop():
33 | """Provides access to the GLib MainLoop."""
34 | from gi.repository import GLib
35 |
36 | loop = GLib.MainLoop()
37 | yield loop
38 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/clamp/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 | using Adw 1;
3 |
4 | template $ExampleWindow: Adw.ApplicationWindow {
5 | title: "Python - PyGObject - GTK";
6 | default-width: 683;
7 | default-height: 384;
8 |
9 | content: Adw.ToolbarView {
10 | [top]
11 | Adw.HeaderBar header_bar {}
12 |
13 | content: Adw.Clamp {
14 | child: Gtk.Box {
15 | orientation: vertical;
16 | spacing: 12;
17 |
18 | ListBox {
19 | selection-mode: none;
20 |
21 | styles [
22 | "boxed-list",
23 | ]
24 |
25 | Adw.ActionRow {
26 | title: "Python - PyGObject - GTK";
27 | }
28 |
29 | Adw.ActionRow {
30 | title: "Python - PyGObject - GTK";
31 | }
32 |
33 | Adw.ActionRow {
34 | title: "Python - PyGObject - GTK";
35 | }
36 | }
37 | };
38 | };
39 | };
40 | }
41 |
--------------------------------------------------------------------------------
/src/gtk-widgets/button/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 |
3 | template $ExampleWindow: Gtk.ApplicationWindow {
4 | title: "Python - PyGObject - GTK";
5 | default-width: 683;
6 | default-height: 384;
7 |
8 | [titlebar]
9 | Gtk.HeaderBar header_bar {
10 | [end]
11 | Gtk.MenuButton {
12 | icon-name: "open-menu-symbolic";
13 | menu-model: primary_menu;
14 | }
15 | }
16 |
17 | Gtk.Box {
18 | orientation: vertical;
19 | margin-top: 12;
20 | margin-end: 12;
21 | margin-bottom: 12;
22 | margin-start: 12;
23 | spacing: 12;
24 |
25 | Gtk.Button {
26 | label: "Click here";
27 | valign: center;
28 | vexpand: true;
29 | clicked => $on_button_clicked();
30 | }
31 | }
32 | }
33 |
34 | menu primary_menu {
35 | section {
36 | item {
37 | label: _("Preferences");
38 | action: "app.preferences";
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/navigation-split-view/ui/Sidebar.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 | using Adw 1;
3 |
4 | template $Sidebar: Adw.NavigationPage {
5 | title: "Sidebar";
6 | tag: "sidebar";
7 |
8 | child: Adw.ToolbarView {
9 | [top]
10 | Adw.HeaderBar {
11 | [start]
12 | Gtk.MenuButton {
13 | icon-name: "system-search";
14 | }
15 |
16 | [end]
17 | Gtk.MenuButton {
18 | icon-name: "open-menu-symbolic";
19 | menu-model: primary_menu;
20 | }
21 | }
22 |
23 | content: Gtk.ScrolledWindow {
24 | Gtk.ListBox list_box {
25 | selection-mode: none;
26 | row-activated => $on_row_clicked_change_page();
27 |
28 | styles [
29 | "navigation-sidebar",
30 | ]
31 | }
32 | };
33 | };
34 | }
35 |
36 | menu primary_menu {
37 | section {
38 | item {
39 | label: _("Preferences");
40 | action: "app.preferences";
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/gtk-widgets/image/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 |
3 | template $ExampleWindow: Gtk.ApplicationWindow {
4 | title: "Python - PyGObject - GTK";
5 | default-width: 683;
6 | default-height: 384;
7 |
8 | [titlebar]
9 | Gtk.HeaderBar header_bar {
10 | [end]
11 | Gtk.MenuButton {
12 | icon-name: "open-menu-symbolic";
13 | menu-model: primary_menu;
14 | }
15 | }
16 |
17 | Gtk.Box {
18 | orientation: vertical;
19 | homogeneous: true;
20 | margin-top: 12;
21 | margin-end: 12;
22 | margin-bottom: 12;
23 | margin-start: 12;
24 | spacing: 12;
25 |
26 | Gtk.Button {
27 | label: "Button 02";
28 |
29 | child: Gtk.Image image {
30 | styles [
31 | "lowres-icon",
32 | ]
33 | };
34 | }
35 | }
36 | }
37 |
38 | menu primary_menu {
39 | section {
40 | item {
41 | label: _("Preferences");
42 | action: "app.preferences";
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/gtk-widgets/menu-button/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 |
3 | template $ExampleWindow: Gtk.ApplicationWindow {
4 | title: "Python - PyGObject - GTK";
5 | default-width: 683;
6 | default-height: 384;
7 |
8 | [titlebar]
9 | Gtk.HeaderBar header_bar {
10 | [end]
11 | Gtk.MenuButton menu_button {
12 | icon-name: "open-menu-symbolic";
13 | menu-model: primary_menu;
14 | }
15 | }
16 | }
17 |
18 | menu primary_menu {
19 | section {
20 | item {
21 | label: _("Preferences");
22 | action: "app.preferences";
23 | }
24 | }
25 |
26 | section {
27 | label: _("Section title");
28 | // Shorthand (forma abreviada).
29 | item ("Item 01", "win.item1")
30 | item ("Item 02", "win.item2")
31 | }
32 |
33 | submenu {
34 | label: _("Sub-menu title");
35 |
36 | item {
37 | label: _("Item 03");
38 | action: "win.item3";
39 | }
40 |
41 | item ("Item 04", "win.item4")
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/gtk-widgets/pango-tags/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 |
3 | template $ExampleWindow: Gtk.ApplicationWindow {
4 | title: "Python - PyGObject - GTK";
5 | default-width: 683;
6 | default-height: 384;
7 |
8 | [titlebar]
9 | Gtk.HeaderBar header_bar {
10 | [end]
11 | Gtk.MenuButton {
12 | icon-name: "open-menu-symbolic";
13 | menu-model: primary_menu;
14 | }
15 | }
16 |
17 | Gtk.Box {
18 | orientation: vertical;
19 | homogeneous: true;
20 | margin-top: 12;
21 | margin-end: 12;
22 | margin-bottom: 12;
23 | margin-start: 12;
24 | spacing: 12;
25 |
26 | Gtk.ScrolledWindow {
27 | Gtk.TextView {
28 | buffer: text_buffer;
29 | }
30 | }
31 | }
32 | }
33 |
34 | Gtk.TextBuffer text_buffer {}
35 |
36 | menu primary_menu {
37 | section {
38 | item {
39 | label: _("Preferences");
40 | action: "app.preferences";
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/gtk-widgets/css-provider/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 |
3 | template $ExampleWindow: Gtk.ApplicationWindow {
4 | title: "Python - PyGObject - GTK";
5 | default-width: 683;
6 | default-height: 384;
7 |
8 | [titlebar]
9 | Gtk.HeaderBar header_bar {
10 | [end]
11 | Gtk.MenuButton {
12 | icon-name: "open-menu-symbolic";
13 | menu-model: primary_menu;
14 | }
15 | }
16 |
17 | Gtk.Box {
18 | orientation: vertical;
19 | margin-top: 12;
20 | margin-end: 12;
21 | margin-bottom: 12;
22 | margin-start: 12;
23 | spacing: 12;
24 |
25 | Gtk.Button {
26 | label: "Click here";
27 | valign: center;
28 | vexpand: true;
29 |
30 | styles [
31 | "custom-button",
32 | ]
33 |
34 | clicked => $on_button_clicked();
35 | }
36 | }
37 | }
38 |
39 | menu primary_menu {
40 | section {
41 | item {
42 | label: _("Preferences");
43 | action: "app.preferences";
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/avatar/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 | using Adw 1;
3 |
4 | template $ExampleWindow: Adw.ApplicationWindow {
5 | title: "Python - PyGObject - GTK";
6 | default-width: 683;
7 | default-height: 384;
8 |
9 | content: Adw.ToolbarView {
10 | [top]
11 | Adw.HeaderBar header_bar {}
12 |
13 | content: Gtk.Box {
14 | orientation: horizontal;
15 | homogeneous: true;
16 | spacing: 12;
17 | margin-top: 12;
18 | margin-end: 12;
19 | margin-bottom: 12;
20 | margin-start: 12;
21 |
22 | Adw.Avatar {
23 | size: 100;
24 | text: "Renato Cruz";
25 | show-initials: false;
26 | }
27 |
28 | Adw.Avatar {
29 | size: 100;
30 | text: "Renato Cruz";
31 | show-initials: true;
32 | }
33 |
34 | Adw.Avatar {
35 | size: 100;
36 | text: "Renato Cruz";
37 | show-initials: false;
38 | icon-name: "contact-new-symbolic";
39 | }
40 | };
41 | };
42 | }
43 |
--------------------------------------------------------------------------------
/src/gtk-widgets/file-dialog-folder/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 |
3 | template $ExampleWindow: Gtk.ApplicationWindow {
4 | title: "Python - PyGObject - GTK";
5 | default-width: 683;
6 | default-height: 384;
7 |
8 | [titlebar]
9 | Gtk.HeaderBar header_bar {
10 | [end]
11 | Gtk.MenuButton {
12 | icon-name: "open-menu-symbolic";
13 | menu-model: primary_menu;
14 | }
15 | }
16 |
17 | Gtk.Box {
18 | orientation: vertical;
19 | margin-top: 12;
20 | margin-end: 12;
21 | margin-bottom: 12;
22 | margin-start: 12;
23 | spacing: 12;
24 |
25 | Gtk.Button {
26 | label: "Select folder";
27 | clicked => $on_button_select_folder_clicked();
28 | }
29 |
30 | Gtk.Button {
31 | label: "Select folders";
32 | clicked => $on_button_select_folders_clicked();
33 | }
34 | }
35 | }
36 |
37 | menu primary_menu {
38 | section {
39 | item {
40 | label: _("Preferences");
41 | action: "app.preferences";
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/banner/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 | using Adw 1;
3 |
4 | template $ExampleWindow: Adw.ApplicationWindow {
5 | title: "Python - PyGObject - GTK";
6 | default-width: 683;
7 | default-height: 384;
8 |
9 | content: Adw.ToolbarView {
10 | [top]
11 | Adw.HeaderBar header_bar {}
12 |
13 | content: Gtk.Overlay overlay {
14 | [overlay]
15 | Adw.Banner banner {
16 | title: "Python - PyGObject - GTK";
17 | button-label: "Close";
18 | valign: start;
19 | button-clicked => $on_button_banner_clicked();
20 | }
21 |
22 | Gtk.Box {
23 | orientation: vertical;
24 | spacing: 12;
25 | margin-top: 12;
26 | margin-end: 12;
27 | margin-bottom: 12;
28 | margin-start: 12;
29 |
30 | Gtk.Button {
31 | label: "Open Banner";
32 | vexpand: true;
33 | valign: center;
34 | clicked => $on_button_clicked();
35 | }
36 | }
37 | };
38 | };
39 | }
40 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/sidebar/ui/MainWindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | Python - PyGObject - GTK
11 | 683
12 | 384
13 |
14 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/sidebar-item/ui/MainWindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | Python - PyGObject - GTK
11 | 683
12 | 384
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | Hello World!
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/application-window/ui/MainWindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | Python - PyGObject - GTK
11 | 683
12 | 384
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | Hello World!
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/sidebar-section/ui/MainWindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | Python - PyGObject - GTK
11 | 683
12 | 384
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | Hello World!
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/shortcuts-dialog/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 | using Adw 1;
3 |
4 | template $ExampleWindow: Adw.ApplicationWindow {
5 | title: "Python - PyGObject - GTK";
6 | default-width: 683;
7 | default-height: 384;
8 |
9 | content: Adw.ToolbarView {
10 | [top]
11 | Adw.HeaderBar header_bar {}
12 |
13 | content: Gtk.Box {
14 | orientation: vertical;
15 | margin-top: 12;
16 | margin-end: 12;
17 | margin-bottom: 12;
18 | margin-start: 12;
19 | spacing: 12;
20 |
21 | Gtk.Button {
22 | label: "Click here";
23 | clicked => $on_open_button_open_shortcuts_clicked();
24 | }
25 | };
26 | };
27 | }
28 |
29 | Adw.ShortcutsDialog adw_shortcuts_dialog {
30 | Adw.ShortcutsSection {
31 | title: _("Section 01");
32 |
33 | Adw.ShortcutsItem {
34 | title: _("Item 01");
35 | accelerator: "A";
36 | }
37 |
38 | Adw.ShortcutsItem {
39 | title: _("Quit");
40 | action-name: "app.quit";
41 | accelerator: "q";
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/navigation-split-view/ui/MainWindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | Python - PyGObject - GTK
11 | 683
12 | 384
13 | 600
14 | 300
15 |
16 |
17 | max-width: 680
18 | true
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/src/gtk-widgets/translation-gettext/locale/pt_BR/LC_MESSAGES/br.com.justcode.Gtk.po:
--------------------------------------------------------------------------------
1 | # Portuguese translations for PACKAGE package
2 | # Tradu��es em portugu�s brasileiro para o pacote PACKAGE.
3 | # Copyright (C) 2025 THE PACKAGE'S COPYRIGHT HOLDER
4 | # This file is distributed under the same license as the PACKAGE package.
5 | # Automatically generated, 2025.
6 | #
7 | msgid ""
8 | msgstr ""
9 | "Project-Id-Version: PACKAGE VERSION\n"
10 | "Report-Msgid-Bugs-To: \n"
11 | "POT-Creation-Date: 2025-05-24 07:10-0300\n"
12 | "PO-Revision-Date: 2025-05-24 07:10-0300\n"
13 | "Last-Translator: Automatically generated\n"
14 | "Language-Team: none\n"
15 | "Language: pt_BR\n"
16 | "MIME-Version: 1.0\n"
17 | "Content-Type: text/plain; charset=UTF-8\n"
18 | "Content-Transfer-Encoding: 8bit\n"
19 | "Plural-Forms: nplurals=2; plural=(n > 1);\n"
20 |
21 | #: /home/natorsc/Projetos/py-gtk/src/gtk-widgets/translator-gettext/MainWindow.py:44
22 | msgid "Preferences"
23 | msgstr "Preferências"
24 |
25 | #: /home/natorsc/Projetos/py-gtk/src/gtk-widgets/translator-gettext/MainWindow.py:61
26 | msgid "Hello World!"
27 | msgstr "Olá Mundo!"
28 |
--------------------------------------------------------------------------------
/src/gtk-widgets/entry/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 |
3 | template $ExampleWindow: Gtk.ApplicationWindow {
4 | title: "Python - PyGObject - GTK";
5 | default-width: 683;
6 | default-height: 384;
7 |
8 | [titlebar]
9 | Gtk.HeaderBar header_bar {
10 | [end]
11 | Gtk.MenuButton {
12 | icon-name: "open-menu-symbolic";
13 | menu-model: primary_menu;
14 | }
15 | }
16 |
17 | Gtk.Box {
18 | orientation: vertical;
19 | margin-top: 12;
20 | margin-end: 12;
21 | margin-bottom: 12;
22 | margin-start: 12;
23 | spacing: 12;
24 |
25 | Gtk.Label {
26 | label: "Type something and click on the icon or press Enter:";
27 | }
28 |
29 | Gtk.Entry {
30 | // primary-icon-name: "system-search-symbolic";
31 | secondary-icon-name: "system-search-symbolic";
32 | activate => $on_key_enter_pressed();
33 | icon-press => $on_icon_pressed();
34 | }
35 | }
36 | }
37 |
38 | menu primary_menu {
39 | section {
40 | item {
41 | label: _("Preferences");
42 | action: "app.preferences";
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) [2025] Renato Cruz (natorsc)
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/src/gtk-widgets/font-dialog-button/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 |
3 | template $ExampleWindow: Gtk.ApplicationWindow {
4 | title: "Python - PyGObject - GTK";
5 | default-width: 683;
6 | default-height: 384;
7 |
8 | [titlebar]
9 | Gtk.HeaderBar header_bar {
10 | [end]
11 | Gtk.MenuButton {
12 | icon-name: "open-menu-symbolic";
13 | menu-model: primary_menu;
14 | }
15 | }
16 |
17 | Gtk.Box {
18 | orientation: vertical;
19 | homogeneous: true;
20 | margin-top: 12;
21 | margin-end: 12;
22 | margin-bottom: 12;
23 | margin-start: 12;
24 | spacing: 12;
25 |
26 | Gtk.Label {
27 | label: "Click on the Button to select a font.";
28 | }
29 |
30 | Gtk.FontDialogButton {
31 | dialog: font_dialog;
32 | halign: center;
33 | valign: center;
34 | notify::font-desc => $on_font_selected();
35 | }
36 | }
37 | }
38 |
39 | Gtk.FontDialog font_dialog {
40 | title: "Python - PyGObject - GTK";
41 | modal: true;
42 | }
43 |
44 | menu primary_menu {
45 | section {
46 | item {
47 | label: _("Preferences");
48 | action: "app.preferences";
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/gtk-widgets/header-bar/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 |
3 | template $ExampleWindow: Gtk.ApplicationWindow {
4 | title: "Python - PyGObject - GTK";
5 | default-width: 683;
6 | default-height: 384;
7 |
8 | [titlebar]
9 | Gtk.HeaderBar header_bar {
10 | [start]
11 | Gtk.Box {
12 | orientation: horizontal;
13 |
14 | Gtk.Button {
15 | icon-name: "go-previous-symbolic";
16 | clicked => $on_button_left_arrow_cliqued();
17 | }
18 |
19 | Gtk.Button {
20 | icon-name: "go-previous-symbolic-rtl";
21 | clicked => $on_button_right_arrow_cliqued();
22 | }
23 | }
24 |
25 | [end]
26 | Gtk.MenuButton {
27 | icon-name: "open-menu-symbolic";
28 | menu-model: primary_menu;
29 | }
30 | }
31 |
32 | Gtk.Box {
33 | orientation: vertical;
34 | homogeneous: true;
35 | margin-top: 12;
36 | margin-end: 12;
37 | margin-bottom: 12;
38 | margin-start: 12;
39 | spacing: 12;
40 | }
41 | }
42 |
43 | menu primary_menu {
44 | section {
45 | item {
46 | label: _("Preferences");
47 | action: "app.preferences";
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/scripts/blp.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """."""
3 |
4 | import pathlib
5 | import subprocess
6 | import sys
7 |
8 | BASE_DIR = pathlib.Path(__file__).resolve().parent
9 | SRC_DIR = BASE_DIR.parent
10 |
11 | compiler = 'blueprint-compiler'
12 |
13 | platform = sys.platform
14 | if platform == 'win32':
15 | compiler = 'python3 C:\\msys64\\mingw64\\bin\\blueprint-compiler'
16 |
17 |
18 | def blp_to_ui(file):
19 | print('[[!] Converting (blp -> ui), please wait... [!]')
20 | output = file.parent.joinpath(f'{file.stem}.ui')
21 | # try:
22 | # subprocess.call(args=[compiler, 'compile', '--output', output, file])
23 | # except Exception as error:
24 | # print(f'[X] Fail: {error}')
25 |
26 | result = subprocess.run(
27 | args=[compiler, 'compile', '--output', output, file],
28 | capture_output=True,
29 | check=True,
30 | text=True,
31 | )
32 |
33 | print(f'Return Code: {result.returncode}.')
34 | # print(f'Standard Output: {result.stdout}.')
35 | # print(f'Standard Error: {result.stderr}.')
36 | print('[!] Conversion finished [!]')
37 |
38 |
39 | if __name__ == '__main__':
40 | pass
41 |
--------------------------------------------------------------------------------
/src/gtk-widgets/color-dialog-button/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 |
3 | template $ExampleWindow: Gtk.ApplicationWindow {
4 | title: "Python - PyGObject - GTK";
5 | default-width: 683;
6 | default-height: 384;
7 |
8 | [titlebar]
9 | Gtk.HeaderBar header_bar {
10 | [end]
11 | Gtk.MenuButton {
12 | icon-name: "open-menu-symbolic";
13 | menu-model: primary_menu;
14 | }
15 | }
16 |
17 | Gtk.Box {
18 | orientation: vertical;
19 | homogeneous: true;
20 | margin-top: 12;
21 | margin-end: 12;
22 | margin-bottom: 12;
23 | margin-start: 12;
24 | spacing: 12;
25 |
26 | Gtk.Label {
27 | label: "Click on the Button to select a color.";
28 | }
29 |
30 | Gtk.ColorDialogButton {
31 | dialog: color_dialog;
32 | halign: center;
33 | valign: center;
34 | notify::rgba => $on_color_selected();
35 | }
36 | }
37 | }
38 |
39 | Gtk.ColorDialog color_dialog {
40 | title: "Python - PyGObject - GTK";
41 | modal: true;
42 | }
43 |
44 | menu primary_menu {
45 | section {
46 | item {
47 | label: _("Preferences");
48 | action: "app.preferences";
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/gtk-widgets/overlay/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 |
3 | template $ExampleWindow: Gtk.ApplicationWindow {
4 | title: "Python - PyGObject - GTK";
5 | default-width: 683;
6 | default-height: 384;
7 |
8 | [titlebar]
9 | Gtk.HeaderBar header_bar {
10 | [end]
11 | Gtk.MenuButton {
12 | icon-name: "open-menu-symbolic";
13 | menu-model: primary_menu;
14 | }
15 | }
16 |
17 | Gtk.Overlay overlay {
18 | [overlay]
19 | Gtk.Box {
20 | orientation: vertical;
21 | homogeneous: true;
22 | margin-top: 12;
23 | margin-end: 12;
24 | margin-bottom: 12;
25 | margin-start: 12;
26 | spacing: 12;
27 |
28 | Gtk.Button {
29 | label: "This Button is below the others";
30 | }
31 | }
32 |
33 | [overlay]
34 | Gtk.Button {
35 | icon-name: "go-previous";
36 | halign: start;
37 | valign: center;
38 | }
39 |
40 | [overlay]
41 | Gtk.Button {
42 | icon-name: "go-next";
43 | halign: end;
44 | valign: center;
45 | }
46 | }
47 | }
48 |
49 | menu primary_menu {
50 | section {
51 | item {
52 | label: _("Preferences");
53 | action: "app.preferences";
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/gtk-widgets/application-window/ui/MainWindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | Python - PyGObject - GTK
11 | 683
12 | 384
13 |
14 |
22 |
23 |
24 |
32 |
--------------------------------------------------------------------------------
/src/gtk-widgets/box-horizontal/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 |
3 | template $ExampleWindow: Gtk.ApplicationWindow {
4 | title: "Python - PyGObject - GTK";
5 | default-width: 683;
6 | default-height: 384;
7 |
8 | [titlebar]
9 | Gtk.HeaderBar header_bar {
10 | [end]
11 | Gtk.MenuButton {
12 | icon-name: "open-menu-symbolic";
13 | menu-model: primary_menu;
14 | }
15 | }
16 |
17 | Gtk.Box {
18 | orientation: horizontal;
19 | homogeneous: true;
20 | margin-top: 12;
21 | margin-end: 12;
22 | margin-bottom: 12;
23 | margin-start: 12;
24 | spacing: 12;
25 |
26 | Gtk.Button {
27 | label: "Button 03";
28 | }
29 |
30 | Gtk.Button {
31 | label: "Button 02";
32 | }
33 |
34 | Gtk.Button {
35 | label: "Button 01";
36 | }
37 |
38 | Gtk.Button {
39 | label: "Button 01";
40 | }
41 |
42 | Gtk.Button {
43 | label: "Button 02";
44 | }
45 |
46 | Gtk.Button {
47 | label: "Button 03";
48 | }
49 | }
50 | }
51 |
52 | menu primary_menu {
53 | section {
54 | item {
55 | label: _("Preferences");
56 | action: "app.preferences";
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/gtk-widgets/box-vertical/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 |
3 | template $ExampleWindow: Gtk.ApplicationWindow {
4 | title: "Python - PyGObject - GTK";
5 | default-width: 683;
6 | default-height: 384;
7 |
8 | [titlebar]
9 | Gtk.HeaderBar header_bar {
10 | [end]
11 | Gtk.MenuButton {
12 | icon-name: "open-menu-symbolic";
13 | menu-model: primary_menu;
14 | }
15 | }
16 |
17 | Gtk.Box {
18 | orientation: vertical;
19 | homogeneous: true;
20 | margin-top: 12;
21 | margin-end: 12;
22 | margin-bottom: 12;
23 | margin-start: 12;
24 | spacing: 12;
25 |
26 | Gtk.Button {
27 | label: "Button 03";
28 | }
29 |
30 | Gtk.Button {
31 | label: "Button 02";
32 | }
33 |
34 | Gtk.Button {
35 | label: "Button 01";
36 | }
37 |
38 | Gtk.Button {
39 | label: "Button 01";
40 | }
41 |
42 | Gtk.Button {
43 | label: "Button 02";
44 | }
45 |
46 | Gtk.Button {
47 | label: "Button 03";
48 | }
49 | }
50 | }
51 |
52 | menu primary_menu {
53 | section {
54 | item {
55 | label: _("Preferences");
56 | action: "app.preferences";
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/gtk-widgets/window/ui/NewWindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | Python - PyGObject - GTK
11 | true
12 | 600
13 | 300
14 |
15 |
16 | 1
17 | 12
18 | 12
19 | 12
20 | 12
21 | 12
22 |
23 |
24 | Close window
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/view-stack/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 | using Adw 1;
3 |
4 | template $ExampleWindow: Adw.ApplicationWindow {
5 | title: "Python - PyGObject - GTK";
6 | default-width: 683;
7 | default-height: 384;
8 |
9 | Adw.Breakpoint {
10 | condition ("max-width: 550sp")
11 |
12 | setters {
13 | switcher_bar.reveal: true;
14 | header_bar.title-widget: null;
15 | }
16 | }
17 |
18 | content: Adw.ToolbarView {
19 | [top]
20 | Adw.HeaderBar header_bar {
21 | title-widget: Adw.ViewSwitcher {
22 | stack: stack;
23 | policy: wide;
24 | };
25 | }
26 |
27 | [bottom]
28 | Adw.ViewSwitcherBar switcher_bar {
29 | stack: stack;
30 | }
31 |
32 | content: Adw.ViewStack stack {
33 | Adw.ViewStackPage {
34 | name: "page1";
35 | title: "Page 01";
36 | icon-name: "user-desktop-symbolic";
37 |
38 | child: Adw.StatusPage {
39 | title: "Page 01";
40 | };
41 | }
42 |
43 | Adw.ViewStackPage {
44 | name: "page2";
45 | title: "Page 02";
46 | icon-name: "user-home-symbolic";
47 |
48 | child: Adw.StatusPage {
49 | title: "Page 02";
50 | };
51 | }
52 | };
53 | };
54 | }
55 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/view-stack-page/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 | using Adw 1;
3 |
4 | template $ExampleWindow: Adw.ApplicationWindow {
5 | title: "Python - PyGObject - GTK";
6 | default-width: 683;
7 | default-height: 384;
8 |
9 | Adw.Breakpoint {
10 | condition ("max-width: 550sp")
11 |
12 | setters {
13 | switcher_bar.reveal: true;
14 | header_bar.title-widget: null;
15 | }
16 | }
17 |
18 | content: Adw.ToolbarView {
19 | [top]
20 | Adw.HeaderBar header_bar {
21 | title-widget: Adw.ViewSwitcher {
22 | stack: stack;
23 | policy: wide;
24 | };
25 | }
26 |
27 | [bottom]
28 | Adw.ViewSwitcherBar switcher_bar {
29 | stack: stack;
30 | }
31 |
32 | content: Adw.ViewStack stack {
33 | Adw.ViewStackPage {
34 | name: "page1";
35 | title: "Page 01";
36 | icon-name: "user-desktop-symbolic";
37 |
38 | child: Adw.StatusPage {
39 | title: "Page 01";
40 | };
41 | }
42 |
43 | Adw.ViewStackPage {
44 | name: "page2";
45 | title: "Page 02";
46 | icon-name: "user-home-symbolic";
47 |
48 | child: Adw.StatusPage {
49 | title: "Page 02";
50 | };
51 | }
52 | };
53 | };
54 | }
55 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/view-switcher-bar/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 | using Adw 1;
3 |
4 | template $ExampleWindow: Adw.ApplicationWindow {
5 | title: "Python - PyGObject - GTK";
6 | default-width: 683;
7 | default-height: 384;
8 |
9 | Adw.Breakpoint {
10 | condition ("max-width: 550sp")
11 |
12 | setters {
13 | switcher_bar.reveal: true;
14 | header_bar.title-widget: null;
15 | }
16 | }
17 |
18 | content: Adw.ToolbarView {
19 | [top]
20 | Adw.HeaderBar header_bar {
21 | title-widget: Adw.ViewSwitcher {
22 | stack: stack;
23 | policy: wide;
24 | };
25 | }
26 |
27 | [bottom]
28 | Adw.ViewSwitcherBar switcher_bar {
29 | stack: stack;
30 | }
31 |
32 | content: Adw.ViewStack stack {
33 | Adw.ViewStackPage {
34 | name: "page1";
35 | title: "Page 01";
36 | icon-name: "user-desktop-symbolic";
37 |
38 | child: Adw.StatusPage {
39 | title: "Page 01";
40 | };
41 | }
42 |
43 | Adw.ViewStackPage {
44 | name: "page2";
45 | title: "Page 02";
46 | icon-name: "user-home-symbolic";
47 |
48 | child: Adw.StatusPage {
49 | title: "Page 02";
50 | };
51 | }
52 | };
53 | };
54 | }
55 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/view-switcher/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 | using Adw 1;
3 |
4 | template $ExampleWindow: Adw.ApplicationWindow {
5 | title: "Python - PyGObject - GTK";
6 | default-width: 683;
7 | default-height: 384;
8 |
9 | Adw.Breakpoint {
10 | condition ("max-width: 550sp")
11 |
12 | setters {
13 | switcher_bar.reveal: true;
14 | header_bar.title-widget: null;
15 | }
16 | }
17 |
18 | content: Adw.ToolbarView {
19 | [top]
20 | Adw.HeaderBar header_bar {
21 | title-widget: Adw.ViewSwitcher {
22 | stack: stack;
23 | policy: wide;
24 | };
25 | }
26 |
27 | [bottom]
28 | Adw.ViewSwitcherBar switcher_bar {
29 | stack: stack;
30 | }
31 |
32 | content: Adw.ViewStack stack {
33 | Adw.ViewStackPage {
34 | name: "page1";
35 | title: "Page 01";
36 | icon-name: "user-desktop-symbolic";
37 |
38 | child: Adw.StatusPage {
39 | title: "Page 01";
40 | };
41 | }
42 |
43 | Adw.ViewStackPage {
44 | name: "page2";
45 | title: "Page 02";
46 | icon-name: "user-home-symbolic";
47 |
48 | child: Adw.StatusPage {
49 | title: "Page 02";
50 | };
51 | }
52 | };
53 | };
54 | }
55 |
--------------------------------------------------------------------------------
/src/gtk-widgets/list-view/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 |
3 | template $ExampleWindow: Gtk.ApplicationWindow {
4 | title: "Python - PyGObject - GTK";
5 | default-width: 683;
6 | default-height: 384;
7 |
8 | [titlebar]
9 | Gtk.HeaderBar header_bar {
10 | [end]
11 | Gtk.MenuButton {
12 | icon-name: "open-menu-symbolic";
13 | menu-model: primary_menu;
14 | }
15 | }
16 |
17 | Gtk.Box {
18 | orientation: vertical;
19 | margin-top: 12;
20 | margin-end: 12;
21 | margin-bottom: 12;
22 | margin-start: 12;
23 | spacing: 12;
24 |
25 | Gtk.ListView {
26 | activate => $on_list_view_row_activate();
27 |
28 | factory: Gtk.BuilderListItemFactory {
29 | template Gtk.ListItem {
30 | child: Gtk.Label {
31 | label: bind template.item as .string;
32 | };
33 | }
34 | };
35 |
36 | model: Gtk.SingleSelection {
37 | model: Gtk.StringList {
38 | strings [
39 | "Item 01",
40 | "Item 02",
41 | "Item 03",
42 | ]
43 | };
44 | };
45 | }
46 | }
47 | }
48 |
49 | menu primary_menu {
50 | section {
51 | item {
52 | label: _("Preferences");
53 | action: "app.preferences";
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/sidebar/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 | using Adw 1;
3 |
4 | template $ExampleWindow: Adw.ApplicationWindow {
5 | title: "Python - PyGObject - GTK";
6 | default-width: 683;
7 | default-height: 384;
8 |
9 | Adw.Breakpoint {
10 | condition ("max-width: 600sp")
11 |
12 | setters {
13 | adw_navigation_split_view.collapsed: true;
14 | }
15 | }
16 |
17 | content: Adw.NavigationSplitView adw_navigation_split_view {
18 | sidebar: Adw.NavigationPage {
19 | tag: "sidebar";
20 | title: _("Sidebar");
21 | Adw.ToolbarView {
22 | [top]
23 | Adw.HeaderBar {}
24 |
25 | content: Adw.Sidebar {
26 | activated => $on_sidebar_activated_cb();
27 | Adw.SidebarSection {
28 | title: "Section 01";
29 | Adw.SidebarItem {
30 | title: "Item 01";
31 | }
32 | Adw.SidebarItem {
33 | title: "Item 02";
34 | }
35 | }
36 | };
37 | }
38 | };
39 | content: Adw.NavigationPage {
40 | tag: "content";
41 | title: _("Content");
42 |
43 | Adw.ToolbarView {
44 | [top]
45 | Adw.HeaderBar {}
46 | // Content added by Python code: Page01().
47 | // content: {};
48 | }
49 | };
50 | };
51 | }
52 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/sidebar-item/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 | using Adw 1;
3 |
4 | template $ExampleWindow: Adw.ApplicationWindow {
5 | title: "Python - PyGObject - GTK";
6 | default-width: 683;
7 | default-height: 384;
8 |
9 | Adw.Breakpoint {
10 | condition ("max-width: 600sp")
11 |
12 | setters {
13 | adw_navigation_split_view.collapsed: true;
14 | }
15 | }
16 |
17 | content: Adw.NavigationSplitView adw_navigation_split_view {
18 | sidebar: Adw.NavigationPage {
19 | tag: "sidebar";
20 | title: _("Sidebar");
21 | Adw.ToolbarView {
22 | [top]
23 | Adw.HeaderBar {}
24 |
25 | content: Adw.Sidebar {
26 | activated => $on_sidebar_activated_cb();
27 | Adw.SidebarSection {
28 | title: "Section 01";
29 | Adw.SidebarItem {
30 | title: "Item 01";
31 | }
32 | Adw.SidebarItem {
33 | title: "Item 02";
34 | }
35 | }
36 | };
37 | }
38 | };
39 | content: Adw.NavigationPage {
40 | tag: "content";
41 | title: _("Content");
42 |
43 | Adw.ToolbarView {
44 | [top]
45 | Adw.HeaderBar {}
46 | // Content added by Python code: Page01().
47 | // content: {};
48 | }
49 | };
50 | };
51 | }
52 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/sidebar-section/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 | using Adw 1;
3 |
4 | template $ExampleWindow: Adw.ApplicationWindow {
5 | title: "Python - PyGObject - GTK";
6 | default-width: 683;
7 | default-height: 384;
8 |
9 | Adw.Breakpoint {
10 | condition ("max-width: 600sp")
11 |
12 | setters {
13 | adw_navigation_split_view.collapsed: true;
14 | }
15 | }
16 |
17 | content: Adw.NavigationSplitView adw_navigation_split_view {
18 | sidebar: Adw.NavigationPage {
19 | tag: "sidebar";
20 | title: _("Sidebar");
21 | Adw.ToolbarView {
22 | [top]
23 | Adw.HeaderBar {}
24 |
25 | content: Adw.Sidebar {
26 | activated => $on_sidebar_activated_cb();
27 | Adw.SidebarSection {
28 | title: "Section 01";
29 | Adw.SidebarItem {
30 | title: "Item 01";
31 | }
32 | Adw.SidebarItem {
33 | title: "Item 02";
34 | }
35 | }
36 | };
37 | }
38 | };
39 | content: Adw.NavigationPage {
40 | tag: "content";
41 | title: _("Content");
42 |
43 | Adw.ToolbarView {
44 | [top]
45 | Adw.HeaderBar {}
46 | // Content added by Python code: Page01().
47 | // content: {};
48 | }
49 | };
50 | };
51 | }
52 |
--------------------------------------------------------------------------------
/src/gtk-widgets/flow-box/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 |
3 | template $ExampleWindow: Gtk.ApplicationWindow {
4 | title: "Python - PyGObject - GTK";
5 | default-width: 683;
6 | default-height: 384;
7 |
8 | [titlebar]
9 | Gtk.HeaderBar header_bar {
10 | [end]
11 | Gtk.MenuButton {
12 | icon-name: "open-menu-symbolic";
13 | menu-model: primary_menu;
14 | }
15 | }
16 |
17 | Gtk.ScrolledWindow {
18 | Gtk.FlowBox {
19 | margin-top: 12;
20 | margin-end: 12;
21 | margin-bottom: 12;
22 | margin-start: 12;
23 | valign: start;
24 | max-children-per-line: 5;
25 | selection-mode: none;
26 |
27 | Gtk.Button {
28 | label: "Button 01";
29 | }
30 |
31 | Gtk.Button {
32 | label: "Button 02";
33 | }
34 |
35 | Gtk.Button {
36 | label: "Button 03";
37 | }
38 |
39 | Gtk.Button {
40 | label: "Button 04";
41 | }
42 |
43 | Gtk.Button {
44 | label: "Button 05";
45 | }
46 |
47 | Gtk.Button {
48 | label: "Button 06";
49 | }
50 | }
51 | }
52 | }
53 |
54 | menu primary_menu {
55 | section {
56 | item {
57 | label: _("Preferences");
58 | action: "app.preferences";
59 | }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/breakpoint/ui/MainWindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | Python - PyGObject - GTK
11 | 683
12 | 384
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | audio-volume-high-symbolic
21 | Adw.Breakpoint
22 |
23 |
24 |
25 |
26 |
27 |
28 | max-width: 700
29 | audio-volume-muted-symbolic
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/src/gtk-widgets/actionbar/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 |
3 | template $ExampleWindow: Gtk.ApplicationWindow {
4 | title: "Python - PyGObject - GTK";
5 | default-width: 683;
6 | default-height: 384;
7 |
8 | [titlebar]
9 | Gtk.HeaderBar header_bar {
10 | [end]
11 | Gtk.MenuButton {
12 | icon-name: "open-menu-symbolic";
13 | menu-model: primary_menu;
14 | }
15 | }
16 |
17 | Gtk.Box {
18 | orientation: vertical;
19 | margin-top: 12;
20 | margin-end: 12;
21 | margin-bottom: 12;
22 | margin-start: 12;
23 | spacing: 12;
24 |
25 | Gtk.ActionBar {
26 | valign: end;
27 | vexpand: true;
28 |
29 | Gtk.Button {
30 | icon-name: "call-start-symbolic";
31 | clicked => $on_button_clicked();
32 | }
33 |
34 | Gtk.Button {
35 | icon-name: "call-stop-symbolic";
36 | clicked => $on_button_clicked();
37 | }
38 |
39 | Gtk.Button {
40 | icon-name: "contact-new-symbolic";
41 | clicked => $on_button_clicked();
42 | }
43 |
44 | Gtk.Button {
45 | icon-name: "address-book-new-symbolic";
46 | clicked => $on_button_clicked();
47 | }
48 | }
49 | }
50 | }
51 |
52 | menu primary_menu {
53 | section {
54 | item {
55 | label: _("Preferences");
56 | action: "app.preferences";
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/navigation-split-view/ui/Page01.ui:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | Page 01
11 | page-01
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | 1
20 | 12
21 | 12
22 | 12
23 | 12
24 | 12
25 |
26 |
27 | Page 01
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/navigation-split-view/ui/Page02.ui:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | Page 02
11 | page-02
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | 1
20 | 12
21 | 12
22 | 12
23 | 12
24 | 12
25 |
26 |
27 | Page 02
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/password-entry-row/ui/MainWindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | Python - PyGObject - GTK
11 | 683
12 | 384
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | 1
21 | 12
22 | 12
23 | 12
24 | 12
25 | 12
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/src/gtk-widgets/check-button-radio/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 |
3 | template $ExampleWindow: Gtk.ApplicationWindow {
4 | title: "Python - PyGObject - GTK";
5 | default-width: 683;
6 | default-height: 384;
7 |
8 | [titlebar]
9 | Gtk.HeaderBar header_bar {
10 | [end]
11 | Gtk.MenuButton {
12 | icon-name: "open-menu-symbolic";
13 | menu-model: primary_menu;
14 | }
15 | }
16 |
17 | Gtk.Box {
18 | orientation: vertical;
19 | margin-top: 12;
20 | margin-end: 12;
21 | margin-bottom: 12;
22 | margin-start: 12;
23 | spacing: 12;
24 |
25 | Gtk.CheckButton check_button_01 {
26 | name: "check_button_01";
27 | label: "Item 01";
28 | active: true;
29 | group: check_button_group;
30 | toggled => $on_radio_button_toggled();
31 | }
32 |
33 | Gtk.CheckButton check_button_02 {
34 | name: "check_button_02";
35 | label: "Item 02";
36 | group: check_button_group;
37 | toggled => $on_radio_button_toggled();
38 | }
39 |
40 | Gtk.CheckButton check_button_03 {
41 | name: "check_button_03";
42 | label: "Item 03";
43 | group: check_button_group;
44 | toggled => $on_radio_button_toggled();
45 | }
46 | }
47 | }
48 |
49 | Gtk.CheckButton check_button_group {}
50 |
51 | menu primary_menu {
52 | section {
53 | item {
54 | label: _("Preferences");
55 | action: "app.preferences";
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/button-row/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 | using Adw 1;
3 |
4 | template $ExampleWindow: Adw.ApplicationWindow {
5 | title: "Python - PyGObject - GTK";
6 | default-width: 683;
7 | default-height: 384;
8 |
9 | content: Adw.ToolbarView {
10 | [top]
11 | Adw.HeaderBar header_bar {}
12 |
13 | content: Gtk.Box {
14 | orientation: vertical;
15 | margin-top: 12;
16 | margin-end: 12;
17 | margin-bottom: 12;
18 | margin-start: 12;
19 | spacing: 12;
20 |
21 | Gtk.ListBox {
22 | // selection-mode: none;
23 | styles [
24 | "boxed-list",
25 | // "navigation-sidebar",
26 | ,
27 | ]
28 |
29 | Adw.ButtonRow {
30 | title: "Adw.ButtonRow 1";
31 | start-icon-name: "go-previous-symbolic";
32 | end-icon-name: "go-next-symbolic";
33 | activated => $on_button_activated();
34 | }
35 |
36 | Adw.ButtonRow {
37 | title: "Adw.ButtonRow 2";
38 | start-icon-name: "go-previous-symbolic";
39 | end-icon-name: "go-next-symbolic";
40 | activated => $on_button_activated();
41 | }
42 |
43 | Adw.ButtonRow {
44 | title: "Adw.ButtonRow 3";
45 | start-icon-name: "go-previous-symbolic";
46 | end-icon-name: "go-next-symbolic";
47 | activated => $on_button_activated();
48 | }
49 | }
50 | };
51 | };
52 | }
53 |
--------------------------------------------------------------------------------
/src/gtk-widgets/translation-gettext/ui/locale/pt_BR/LC_MESSAGES/br.com.justcode.Gtk.po:
--------------------------------------------------------------------------------
1 | # Portuguese translations for PACKAGE package
2 | # Tradu��es em portugu�s brasileiro para o pacote PACKAGE.
3 | # Copyright (C) 2025 THE PACKAGE'S COPYRIGHT HOLDER
4 | # This file is distributed under the same license as the PACKAGE package.
5 | # Automatically generated, 2025.
6 | #
7 | msgid ""
8 | msgstr ""
9 | "Project-Id-Version: PACKAGE VERSION\n"
10 | "Report-Msgid-Bugs-To: \n"
11 | "POT-Creation-Date: 2025-05-24 07:21-0300\n"
12 | "PO-Revision-Date: 2025-05-24 07:11-0300\n"
13 | "Last-Translator: Automatically generated\n"
14 | "Language-Team: none\n"
15 | "Language: pt_BR\n"
16 | "MIME-Version: 1.0\n"
17 | "Content-Type: text/plain; charset=UTF-8\n"
18 | "Content-Transfer-Encoding: 8bit\n"
19 | "Plural-Forms: nplurals=2; plural=(n > 1);\n"
20 |
21 | #: /home/natorsc/Projetos/py-gtk/src/gtk-widgets/translator-gettext/ui/MainWindow.blp:26
22 | #: /home/natorsc/Projetos/py-gtk/src/gtk-widgets/translator-gettext/ui/MainWindow.py:41
23 | msgid "Hello World!"
24 | msgstr "Olá Mundo!"
25 |
26 | #. Testando a tradução e está OK.
27 | #: /home/natorsc/Projetos/py-gtk/src/gtk-widgets/translator-gettext/ui/MainWindow.blp:35
28 | #: /home/natorsc/Projetos/py-gtk/src/gtk-widgets/translator-gettext/ui/MainWindow.py:40
29 | msgid "Preferences"
30 | msgstr "Preferências"
31 |
32 | #: /home/natorsc/Projetos/py-gtk/src/gtk-widgets/translator-gettext/ui/MainWindow.py:50
33 | msgid "Text test"
34 | msgstr "Teste de texto"
35 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/view-switcher-sidebar/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 | using Adw 1;
3 |
4 | template $ExampleWindow: Adw.ApplicationWindow {
5 | title: "Python - PyGObject - GTK";
6 | default-width: 683;
7 | default-height: 384;
8 |
9 | Adw.Breakpoint {
10 | condition ("max-width: 600sp")
11 |
12 | setters {
13 | adw_navigation_split_view.collapsed: true;
14 | }
15 | }
16 |
17 | content: Adw.NavigationSplitView adw_navigation_split_view {
18 | sidebar: Adw.NavigationPage {
19 | tag: "sidebar";
20 | title: _("Sidebar");
21 | Adw.ToolbarView {
22 | [top]
23 | Adw.HeaderBar {}
24 | content: Adw.ViewSwitcherSidebar {
25 | stack: stack;
26 | activated => $on_view_switcher_sidebar_activated_cb();
27 | };
28 | }
29 | };
30 | content: Adw.NavigationPage {
31 | tag: "content";
32 | title: _("Content");
33 | Adw.ToolbarView {
34 | [top]
35 | Adw.HeaderBar {}
36 | content: Adw.ViewStack stack {
37 | Adw.ViewStackPage {
38 | name: "page-01";
39 | title: "Page 01";
40 | child: Adw.StatusPage {
41 | title: "Page 01";
42 | };
43 | }
44 | Adw.ViewStackPage {
45 | name: "page-02";
46 | title: "Page 02";
47 | child: Adw.StatusPage {
48 | title: "Page 02";
49 | };
50 | }
51 | };
52 | }
53 | };
54 | };
55 | }
56 |
--------------------------------------------------------------------------------
/src/gtk-widgets/search-bar/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 |
3 | template $ExampleWindow: Gtk.ApplicationWindow {
4 | title: "Python - PyGObject - GTK";
5 | default-width: 683;
6 | default-height: 384;
7 |
8 | [titlebar]
9 | Gtk.HeaderBar header_bar {
10 | [start]
11 | Gtk.ToggleButton {
12 | icon-name: "system-search-symbolic";
13 | clicked => $on_button_show_searchbar_clicked();
14 | }
15 |
16 | [end]
17 | Gtk.MenuButton {
18 | icon-name: "open-menu-symbolic";
19 | menu-model: primary_menu;
20 | }
21 | }
22 |
23 | Gtk.Overlay overlay {
24 | [overlay]
25 | Gtk.SearchBar search_bar {
26 | child: entry;
27 | halign: start;
28 | valign: start;
29 |
30 | styles [
31 | "inline",
32 | ]
33 | }
34 |
35 | [overlay]
36 | Gtk.Box {
37 | orientation: vertical;
38 | margin-top: 12;
39 | margin-end: 12;
40 | margin-bottom: 12;
41 | margin-start: 12;
42 | spacing: 12;
43 |
44 | Gtk.Label {
45 | label: "Click on the search icon.";
46 | vexpand: true;
47 | }
48 | }
49 | }
50 | }
51 |
52 | Gtk.Entry entry {
53 | // primary-icon-name: "system-search-symbolic";
54 | secondary-icon-name: "system-search-symbolic";
55 | activate => $on_key_enter_pressed();
56 | icon-press => $on_icon_pressed();
57 | }
58 |
59 | menu primary_menu {
60 | section {
61 | item {
62 | label: _("Preferences");
63 | action: "app.preferences";
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/src/gtk-widgets/file-dialog-save/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 | using Gio 2.0;
3 |
4 | template $ExampleWindow: Gtk.ApplicationWindow {
5 | title: "Python - PyGObject - GTK";
6 | default-width: 683;
7 | default-height: 384;
8 |
9 | [titlebar]
10 | Gtk.HeaderBar header_bar {
11 | [end]
12 | Gtk.MenuButton {
13 | icon-name: "open-menu-symbolic";
14 | menu-model: primary_menu;
15 | }
16 | }
17 |
18 | Gtk.Box {
19 | orientation: vertical;
20 | margin-top: 12;
21 | margin-end: 12;
22 | margin-bottom: 12;
23 | margin-start: 12;
24 | spacing: 12;
25 |
26 | Gtk.Button {
27 | label: "Save";
28 | clicked => $on_button_save_clicked();
29 | }
30 | }
31 | }
32 |
33 | Gtk.FileFilter filter_all_files {
34 | name: "All";
35 |
36 | patterns [
37 | "*",
38 | ]
39 |
40 | suffixes [
41 | "*",
42 | ]
43 | }
44 |
45 | Gtk.FileFilter filter_py_files {
46 | mime-types [
47 | "text/x-python",
48 | ]
49 |
50 | patterns [
51 | "*.py",
52 | ]
53 |
54 | suffixes [
55 | "py",
56 | ]
57 | }
58 |
59 | Gtk.FileFilter filter_txt_files {
60 | mime-types [
61 | "text/plain",
62 | ]
63 |
64 | patterns [
65 | "*.txt",
66 | ]
67 |
68 | suffixes [
69 | "txt",
70 | ]
71 | }
72 |
73 | Gio.ListStore gio_list_store {
74 | item-type: typeof;
75 | }
76 |
77 | menu primary_menu {
78 | section {
79 | item {
80 | label: _("Preferences");
81 | action: "app.preferences";
82 | }
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/about-dialog/ui/MainWindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | Python - PyGObject - GTK
11 | 683
12 | 384
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | 1
21 | 12
22 | 12
23 | 12
24 | 12
25 | 12
26 |
27 |
28 | Click me
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/src/gtk-widgets/picture/ui/MainWindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | Python - PyGObject - GTK
11 | 683
12 | 384
13 |
14 |
22 |
23 |
24 |
25 | 1
26 |
27 |
28 | 0
29 |
30 |
31 |
32 |
33 |
34 |
42 |
--------------------------------------------------------------------------------
/src/gtk-widgets/print-operation/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 |
3 | template $ExampleWindow: Gtk.ApplicationWindow {
4 | title: "Python - PyGObject - GTK";
5 | default-width: 683;
6 | default-height: 384;
7 |
8 | [titlebar]
9 | Gtk.HeaderBar header_bar {
10 | [end]
11 | Gtk.MenuButton {
12 | icon-name: "open-menu-symbolic";
13 | menu-model: primary_menu;
14 | }
15 | }
16 |
17 | Gtk.Box {
18 | orientation: vertical;
19 | margin-top: 12;
20 | margin-end: 12;
21 | margin-bottom: 12;
22 | margin-start: 12;
23 | spacing: 12;
24 |
25 | Gtk.TextView {
26 | buffer: text_buffer;
27 | vexpand: true;
28 | }
29 |
30 | Gtk.Box {
31 | orientation: horizontal;
32 | halign: center;
33 | spacing: 12;
34 |
35 | Gtk.Button {
36 | label: "Print";
37 | clicked => $on_button_open_print_dialog_clicked();
38 | }
39 |
40 | Gtk.Button {
41 | label: "View";
42 | clicked => $on_button_open_preview_clicked();
43 | }
44 |
45 | Gtk.Button {
46 | label: "Page setup";
47 | clicked => $on_button_open_page_setup_dialog_clicked();
48 | }
49 |
50 | Gtk.Button {
51 | label: "Export to PDF";
52 | clicked => $on_button_export_to_pdf_clicked();
53 | }
54 | }
55 | }
56 | }
57 |
58 | Gtk.TextBuffer text_buffer {}
59 |
60 | menu primary_menu {
61 | section {
62 | item {
63 | label: _("Preferences");
64 | action: "app.preferences";
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/alert-dialog/ui/MainWindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | Python - PyGObject - GTK
11 | 683
12 | 384
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | 1
21 | 12
22 | 12
23 | 12
24 | 12
25 | 12
26 |
27 |
28 | Click here
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/navigation-view/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 | using Adw 1;
3 |
4 | template $ExampleWindow: Adw.ApplicationWindow {
5 | title: "Python - PyGObject - GTK";
6 | default-width: 683;
7 | default-height: 384;
8 |
9 | content: Adw.NavigationView adw_navigation_view {
10 | Adw.NavigationPage {
11 | title: "Page 01";
12 | tag: "page-01";
13 |
14 | child: Adw.ToolbarView {
15 | [top]
16 | Adw.HeaderBar {}
17 |
18 | content: Box {
19 | orientation: vertical;
20 | spacing: 12;
21 | margin-top: 12;
22 | margin-end: 12;
23 | margin-bottom: 12;
24 | margin-start: 12;
25 |
26 | Label {
27 | label: "Page 01";
28 | vexpand: true;
29 | }
30 |
31 | Button {
32 | label: "Go to page 02";
33 | action-name: "navigation.push";
34 | action-target: "'page-02'";
35 | }
36 | };
37 | };
38 | }
39 |
40 | Adw.NavigationPage {
41 | title: "Page 02";
42 | tag: "page-02";
43 |
44 | child: Adw.ToolbarView {
45 | [top]
46 | Adw.HeaderBar {}
47 |
48 | content: Box {
49 | orientation: vertical;
50 | spacing: 12;
51 | margin-top: 12;
52 | margin-end: 12;
53 | margin-bottom: 12;
54 | margin-start: 12;
55 |
56 | Label {
57 | label: "Page 02";
58 | vexpand: true;
59 | }
60 | };
61 | };
62 | }
63 | };
64 | }
65 |
--------------------------------------------------------------------------------
/src/gtk-widgets/drop-down/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 |
3 | template $ExampleWindow: Gtk.ApplicationWindow {
4 | title: "Python - PyGObject - GTK";
5 | default-width: 683;
6 | default-height: 384;
7 |
8 | [titlebar]
9 | Gtk.HeaderBar header_bar {
10 | [end]
11 | Gtk.MenuButton {
12 | icon-name: "open-menu-symbolic";
13 | menu-model: primary_menu;
14 | }
15 | }
16 |
17 | Gtk.Box {
18 | orientation: vertical;
19 | margin-top: 12;
20 | margin-end: 12;
21 | margin-bottom: 12;
22 | margin-start: 12;
23 | spacing: 12;
24 |
25 | Gtk.DropDown {
26 | model: brazilian_states;
27 | selected: 1;
28 | notify::selected-item => $on_selected_item();
29 | }
30 | }
31 | }
32 |
33 | Gtk.StringList brazilian_states {
34 | strings [
35 | "Select",
36 | "Acre",
37 | "Alagoas",
38 | "Amapá",
39 | "Amazonas",
40 | "Bahia",
41 | "Ceará",
42 | "Distrito Federal",
43 | "Espírito Santo",
44 | "Goiás",
45 | "Maranhão",
46 | "Mato Grosso",
47 | "Mato Grosso do Sul",
48 | "Minas Gerais",
49 | "Pará",
50 | "Paraíba",
51 | "Paraná",
52 | "Pernambuco",
53 | "Piauí",
54 | "Rio de Janeiro",
55 | "Rio Grande do Norte",
56 | "Rio Grande do Sul",
57 | "Rondônia",
58 | "Roraima",
59 | "Santa Catarina",
60 | "São Paulo",
61 | "Sergipe",
62 | "Tocantins",
63 | ]
64 | }
65 |
66 | menu primary_menu {
67 | section {
68 | item {
69 | label: _("Preferences");
70 | action: "app.preferences";
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/carousel/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 | using Adw 1;
3 |
4 | template $ExampleWindow: Adw.ApplicationWindow {
5 | title: "Python - PyGObject - GTK";
6 | default-width: 683;
7 | default-height: 384;
8 |
9 | content: Adw.ToolbarView {
10 | [top]
11 | Adw.HeaderBar header_bar {}
12 |
13 | content: Gtk.Box {
14 | orientation: vertical;
15 | spacing: 12;
16 | margin-top: 12;
17 | margin-end: 12;
18 | margin-bottom: 12;
19 | margin-start: 12;
20 |
21 | Gtk.Label {
22 | label: "Drag or use the mouse scroller to change pages.";
23 | }
24 |
25 | Separator {
26 | orientation: horizontal;
27 | }
28 |
29 | Adw.Carousel {
30 | vexpand: true;
31 | hexpand: true;
32 | spacing: 24;
33 | page-changed => $on_carousel_page_changed();
34 |
35 | Gtk.Box {
36 | orientation: vertical;
37 |
38 | Gtk.Label {
39 | label: "Page 01.";
40 | vexpand: true;
41 | hexpand: true;
42 | }
43 | }
44 |
45 | Gtk.Box {
46 | orientation: vertical;
47 |
48 | Gtk.Label {
49 | label: "Page 02.";
50 | vexpand: true;
51 | hexpand: true;
52 | }
53 | }
54 |
55 | Gtk.Box {
56 | orientation: vertical;
57 |
58 | Gtk.Label {
59 | label: "Page 03.";
60 | vexpand: true;
61 | hexpand: true;
62 | }
63 | }
64 | }
65 | };
66 | };
67 | }
68 |
--------------------------------------------------------------------------------
/src/data/database/brazilian_states.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "state": "Acre"
4 | },
5 | {
6 | "state": "Alagoas"
7 | },
8 | {
9 | "state": "Amapá"
10 | },
11 | {
12 | "state": "Amazonas"
13 | },
14 | {
15 | "state": "Bahia"
16 | },
17 | {
18 | "state": "Ceará"
19 | },
20 | {
21 | "state": "Distrito Federal"
22 | },
23 | {
24 | "state": "Espírito Santo"
25 | },
26 | {
27 | "state": "Goiás"
28 | },
29 | {
30 | "state": "Maranhão"
31 | },
32 | {
33 | "state": "Mato Grosso"
34 | },
35 | {
36 | "state": "Mato Grosso do Sul"
37 | },
38 | {
39 | "state": "Minas Gerais"
40 | },
41 | {
42 | "state": "Pará"
43 | },
44 | {
45 | "state": "Paraíba"
46 | },
47 | {
48 | "state": "Paraná"
49 | },
50 | {
51 | "state": "Pernambuco"
52 | },
53 | {
54 | "state": "Piauí"
55 | },
56 | {
57 | "state": "Rio de Janeiro"
58 | },
59 | {
60 | "state": "Rio Grande do Norte"
61 | },
62 | {
63 | "state": "Rio Grande do Sul"
64 | },
65 | {
66 | "state": "Rondônia"
67 | },
68 | {
69 | "state": "Roraima"
70 | },
71 | {
72 | "state": "Santa Catarina"
73 | },
74 | {
75 | "state": "São Paulo"
76 | },
77 | {
78 | "state": "Sergipe"
79 | },
80 | {
81 | "state": "Tocantins"
82 | }
83 | ]
84 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/status-page/ui/MainWindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | Python - PyGObject - GTK
11 | 683
12 | 384
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | 1
21 | 12
22 | 12
23 | 12
24 | 12
25 | 12
26 |
27 |
28 | Status page description.
29 | face-smile-big-symbolic
30 | Status page title.
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/setup-blueprint-gnome-builder-pt_BR.md:
--------------------------------------------------------------------------------
1 | # Como configurar a linguagem de marcação Blueprint no Gnome Builder
2 |
3 | Abrar o terminal do Gnome Builder na raíz do projeto e execute o comando `blueprint-compiler port`:
4 |
5 | 
6 |
7 | No arquivo `./src/meson.build` crie a variável `blueprints`:
8 |
9 | ```bash
10 | blueprints = custom_target('blueprints',
11 | input: files(
12 | 'shortcuts-dialog.blp',
13 | 'window.blp',
14 | ),
15 | output: '.',
16 | command: [find_program('blueprint-compiler'), 'batch-compile', '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'],
17 | )
18 | ```
19 |
20 | 
21 |
22 | > Ao finalizar a configuração salve o arquivo e pressione enter no terminal para continuar com as configuração.
23 |
24 | Agora na variável `gnome.compile_resources()` adicione `dependencies: blueprints`:
25 |
26 | 
27 |
28 | > Novamente salve o arquivo e pressione enter no terminal.
29 |
30 | Para os proximos passos analise o que é exibido no terminal e avance conforme as suas necessidades:
31 |
32 | ```bash
33 | STEP 5: Update POTFILES.in
34 | Will make the following changes to po/POTFILES.in
35 | ---
36 | +++
37 | @@ -5,4 +5,4 @@
38 | data/com.github.natorsc.HelloWorld.gschema.xml
39 | src/main.py
40 | src/window.py
41 | -src/window.ui
42 | +src/window.blp
43 |
44 | Is this ok? [y/n] y
45 | ```
46 |
47 | ```
48 | STEP 6: Clean up
49 | Delete old XML files? [y/n] y
50 | ```
51 |
--------------------------------------------------------------------------------
/src/gtk-widgets/file-dialog-open/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 | using Gio 2.0;
3 |
4 | template $ExampleWindow: Gtk.ApplicationWindow {
5 | title: "Python - PyGObject - GTK";
6 | default-width: 683;
7 | default-height: 384;
8 |
9 | [titlebar]
10 | Gtk.HeaderBar header_bar {
11 | [end]
12 | Gtk.MenuButton {
13 | icon-name: "open-menu-symbolic";
14 | menu-model: primary_menu;
15 | }
16 | }
17 |
18 | Gtk.Box {
19 | orientation: vertical;
20 | margin-top: 12;
21 | margin-end: 12;
22 | margin-bottom: 12;
23 | margin-start: 12;
24 | spacing: 12;
25 |
26 | Gtk.Button {
27 | label: "Select file";
28 | clicked => $on_button_select_file_clicked();
29 | }
30 |
31 | Gtk.Button {
32 | label: "Select files";
33 | clicked => $on_button_select_files_clicked();
34 | }
35 | }
36 | }
37 |
38 | Gtk.FileFilter filter_all_files {
39 | name: "All";
40 |
41 | patterns [
42 | "*",
43 | ]
44 |
45 | suffixes [
46 | "*",
47 | ]
48 | }
49 |
50 | Gtk.FileFilter filter_py_files {
51 | mime-types [
52 | "text/x-python",
53 | ]
54 |
55 | patterns [
56 | "*.py",
57 | ]
58 |
59 | suffixes [
60 | "py",
61 | ]
62 | }
63 |
64 | Gtk.FileFilter filter_txt_files {
65 | mime-types [
66 | "text/plain",
67 | ]
68 |
69 | patterns [
70 | "*.txt",
71 | ]
72 |
73 | suffixes [
74 | "txt",
75 | ]
76 | }
77 |
78 | Gio.ListStore gio_list_store {
79 | item-type: typeof;
80 | }
81 |
82 | menu primary_menu {
83 | section {
84 | item {
85 | label: _("Preferences");
86 | action: "app.preferences";
87 | }
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/docs/setup-blueprint-gnome-builder-en.md:
--------------------------------------------------------------------------------
1 |
2 | # How to Set Up the Blueprint Markup Language in Gnome Builder
3 |
4 | Open the Gnome Builder terminal at the root of your project and run the command `blueprint-compiler port`:
5 |
6 | 
7 |
8 | In the `./src/meson.build` file, create the variable `blueprints`:
9 |
10 | ```bash
11 | blueprints = custom_target('blueprints',
12 | input: files(
13 | 'shortcuts-dialog.blp',
14 | 'window.blp',
15 | ),
16 | output: '.',
17 | command: [find_program('blueprint-compiler'), 'batch-compile', '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'],
18 | )
19 | ```
20 |
21 | 
22 |
23 | > After completing this configuration, save the file and press **Enter** in the terminal to continue the setup process.
24 |
25 | Now, in the `gnome.compile_resources()` variable, add `dependencies: blueprints`:
26 |
27 | 
28 |
29 | > Again, save the file and press **Enter** in the terminal.
30 |
31 | For the next steps, review what’s displayed in the terminal and proceed according to your project’s needs:
32 |
33 | ```bash
34 | STEP 5: Update POTFILES.in
35 | Will make the following changes to po/POTFILES.in
36 | ---
37 | +++
38 | @@ -5,4 +5,4 @@
39 | data/com.github.natorsc.HelloWorld.gschema.xml
40 | src/main.py
41 | src/window.py
42 | -src/window.ui
43 | +src/window.blp
44 |
45 | Is this ok? [y/n] y
46 | ```
47 |
48 | ```
49 | STEP 6: Clean up
50 | Delete old XML files? [y/n] y
51 | ```
52 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/carousel-indicator-dots/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 | using Adw 1;
3 |
4 | template $ExampleWindow: Adw.ApplicationWindow {
5 | title: "Python - PyGObject - GTK";
6 | default-width: 683;
7 | default-height: 384;
8 |
9 | content: Adw.ToolbarView {
10 | [top]
11 | Adw.HeaderBar header_bar {}
12 |
13 | content: Gtk.Box {
14 | orientation: vertical;
15 | spacing: 12;
16 | margin-top: 12;
17 | margin-end: 12;
18 | margin-bottom: 12;
19 | margin-start: 12;
20 |
21 | Gtk.Label {
22 | label: "Drag or use the mouse scroller to change pages.";
23 | }
24 |
25 | Separator {
26 | orientation: horizontal;
27 | }
28 |
29 | Adw.Carousel carousel {
30 | vexpand: true;
31 | hexpand: true;
32 | spacing: 24;
33 | page-changed => $on_carousel_page_changed();
34 |
35 | Gtk.Box {
36 | orientation: vertical;
37 |
38 | Gtk.Label {
39 | label: "Page 01.";
40 | vexpand: true;
41 | hexpand: true;
42 | }
43 | }
44 |
45 | Gtk.Box {
46 | orientation: vertical;
47 |
48 | Gtk.Label {
49 | label: "Page 02.";
50 | vexpand: true;
51 | hexpand: true;
52 | }
53 | }
54 |
55 | Gtk.Box {
56 | orientation: vertical;
57 |
58 | Gtk.Label {
59 | label: "Page 03.";
60 | vexpand: true;
61 | hexpand: true;
62 | }
63 | }
64 | }
65 |
66 | Adw.CarouselIndicatorDots {
67 | carousel: carousel;
68 | }
69 | };
70 | };
71 | }
72 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/carousel-indicator-lines/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 | using Adw 1;
3 |
4 | template $ExampleWindow: Adw.ApplicationWindow {
5 | title: "Python - PyGObject - GTK";
6 | default-width: 683;
7 | default-height: 384;
8 |
9 | content: Adw.ToolbarView {
10 | [top]
11 | Adw.HeaderBar header_bar {}
12 |
13 | content: Gtk.Box {
14 | orientation: vertical;
15 | spacing: 12;
16 | margin-top: 12;
17 | margin-end: 12;
18 | margin-bottom: 12;
19 | margin-start: 12;
20 |
21 | Gtk.Label {
22 | label: "Drag or use the mouse scroller to change pages.";
23 | }
24 |
25 | Separator {
26 | orientation: horizontal;
27 | }
28 |
29 | Adw.Carousel carousel {
30 | vexpand: true;
31 | hexpand: true;
32 | spacing: 24;
33 | page-changed => $on_carousel_page_changed();
34 |
35 | Gtk.Box {
36 | orientation: vertical;
37 |
38 | Gtk.Label {
39 | label: "Page 01.";
40 | vexpand: true;
41 | hexpand: true;
42 | }
43 | }
44 |
45 | Gtk.Box {
46 | orientation: vertical;
47 |
48 | Gtk.Label {
49 | label: "Page 02.";
50 | vexpand: true;
51 | hexpand: true;
52 | }
53 | }
54 |
55 | Gtk.Box {
56 | orientation: vertical;
57 |
58 | Gtk.Label {
59 | label: "Page 03.";
60 | vexpand: true;
61 | hexpand: true;
62 | }
63 | }
64 | }
65 |
66 | Adw.CarouselIndicatorLines {
67 | carousel: carousel;
68 | }
69 | };
70 | };
71 | }
72 |
--------------------------------------------------------------------------------
/src/data/database/brazilian_states.sql:
--------------------------------------------------------------------------------
1 | BEGIN TRANSACTION;
2 | CREATE TABLE IF NOT EXISTS "brazilian_states" (
3 | "state" TEXT
4 | );
5 | INSERT INTO "brazilian_states" VALUES ('Acre');
6 | INSERT INTO "brazilian_states" VALUES ('Alagoas');
7 | INSERT INTO "brazilian_states" VALUES ('Amapá');
8 | INSERT INTO "brazilian_states" VALUES ('Amazonas');
9 | INSERT INTO "brazilian_states" VALUES ('Bahia');
10 | INSERT INTO "brazilian_states" VALUES ('Ceará');
11 | INSERT INTO "brazilian_states" VALUES ('Distrito Federal');
12 | INSERT INTO "brazilian_states" VALUES ('Espírito Santo');
13 | INSERT INTO "brazilian_states" VALUES ('Goiás');
14 | INSERT INTO "brazilian_states" VALUES ('Maranhão');
15 | INSERT INTO "brazilian_states" VALUES ('Mato Grosso');
16 | INSERT INTO "brazilian_states" VALUES ('Mato Grosso do Sul');
17 | INSERT INTO "brazilian_states" VALUES ('Minas Gerais');
18 | INSERT INTO "brazilian_states" VALUES ('Pará');
19 | INSERT INTO "brazilian_states" VALUES ('Paraíba');
20 | INSERT INTO "brazilian_states" VALUES ('Paraná');
21 | INSERT INTO "brazilian_states" VALUES ('Pernambuco');
22 | INSERT INTO "brazilian_states" VALUES ('Piauí');
23 | INSERT INTO "brazilian_states" VALUES ('Rio de Janeiro');
24 | INSERT INTO "brazilian_states" VALUES ('Rio Grande do Norte');
25 | INSERT INTO "brazilian_states" VALUES ('Rio Grande do Sul');
26 | INSERT INTO "brazilian_states" VALUES ('Rondônia');
27 | INSERT INTO "brazilian_states" VALUES ('Roraima');
28 | INSERT INTO "brazilian_states" VALUES ('Santa Catarina');
29 | INSERT INTO "brazilian_states" VALUES ('São Paulo');
30 | INSERT INTO "brazilian_states" VALUES ('Sergipe');
31 | INSERT INTO "brazilian_states" VALUES ('Tocantins');
32 | COMMIT;
33 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/preferences-page/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 | using Adw 1;
3 |
4 | template $ExampleWindow: Adw.ApplicationWindow {
5 | title: "Python - PyGObject - GTK";
6 | default-width: 683;
7 | default-height: 384;
8 |
9 | content: Adw.ToolbarView {
10 | [top]
11 | Adw.HeaderBar header_bar {}
12 |
13 | content: Gtk.Box {
14 | orientation: vertical;
15 | spacing: 12;
16 | margin-top: 12;
17 | margin-end: 12;
18 | margin-bottom: 12;
19 | margin-start: 12;
20 |
21 | Adw.PreferencesPage {
22 | Adw.PreferencesGroup {
23 | title: "Python - PyGObject - GTK";
24 | description: "AdwPreferencesGroup";
25 | header-suffix: header_suffix;
26 |
27 | Adw.ActionRow {
28 | icon-name: "edit-find-symbolic";
29 | title: "Python - PyGObject - GTK";
30 | subtitle: "Python - PyGObject - GTK";
31 |
32 | Switch {
33 | valign: center;
34 | notify::active => $on_switch_button_clicked();
35 | }
36 | }
37 |
38 | Adw.ActionRow {
39 | icon-name: "edit-find-symbolic";
40 | title: "Python - PyGObject - GTK";
41 | subtitle: "Python - PyGObject - GTK";
42 | activatable-widget: switch;
43 |
44 | Switch switch {
45 | valign: center;
46 | notify::active => $on_switch_button_clicked();
47 | }
48 | }
49 | }
50 | }
51 | };
52 | };
53 | }
54 |
55 | Button header_suffix {
56 | icon-name: "list-add-symbolic";
57 | clicked => $on_button_clicked();
58 |
59 | styles [
60 | "flat",
61 | ]
62 | }
63 |
--------------------------------------------------------------------------------
/src/gtk-widgets/grid/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 |
3 | template $ExampleWindow: Gtk.ApplicationWindow {
4 | title: "Python - PyGObject - GTK";
5 | default-width: 683;
6 | default-height: 384;
7 |
8 | [titlebar]
9 | Gtk.HeaderBar header_bar {
10 | [end]
11 | Gtk.MenuButton {
12 | icon-name: "open-menu-symbolic";
13 | menu-model: primary_menu;
14 | }
15 | }
16 |
17 | Gtk.Grid {
18 | margin-top: 12;
19 | margin-end: 12;
20 | margin-bottom: 12;
21 | margin-start: 12;
22 | row-spacing: 12;
23 | column-spacing: 12;
24 |
25 | Gtk.Button {
26 | label: "Button 01";
27 |
28 | layout {
29 | column: "0";
30 | row: "0";
31 | }
32 | }
33 |
34 | Gtk.Button {
35 | label: "Button 02";
36 |
37 | layout {
38 | column: "1";
39 | row: "0";
40 | column-span: "2";
41 | }
42 | }
43 |
44 | Gtk.Button {
45 | label: "Button 03";
46 |
47 | layout {
48 | column: "0";
49 | row: "1";
50 | row-span: "2";
51 | }
52 | }
53 |
54 | Gtk.Button {
55 | label: "Button 04";
56 |
57 | layout {
58 | column: "1";
59 | row: "1";
60 | column-span: "2";
61 | }
62 | }
63 |
64 | Gtk.Button {
65 | label: "Button 05";
66 |
67 | layout {
68 | column: "1";
69 | row: "2";
70 | }
71 | }
72 |
73 | Gtk.Button {
74 | label: "Button 06";
75 |
76 | layout {
77 | column: "2";
78 | row: "2";
79 | }
80 | }
81 | }
82 | }
83 |
84 | menu primary_menu {
85 | section {
86 | item {
87 | label: _("Preferences");
88 | action: "app.preferences";
89 | }
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/split-button/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 | using Adw 1;
3 |
4 | template $ExampleWindow: Adw.ApplicationWindow {
5 | title: "Python - PyGObject - GTK";
6 | default-width: 683;
7 | default-height: 384;
8 |
9 | content: Adw.ToolbarView {
10 | [top]
11 | Adw.HeaderBar header_bar {}
12 |
13 | content: Gtk.Box {
14 | orientation: vertical;
15 | spacing: 12;
16 | margin-top: 12;
17 | margin-end: 12;
18 | margin-bottom: 12;
19 | margin-start: 12;
20 |
21 | Adw.SplitButton {
22 | halign: center;
23 | popover: popover_menu;
24 | clicked => $on_split_button_clicked();
25 |
26 | child: Adw.ButtonContent {
27 | icon-name: "document-open-symbolic";
28 | label: _("_Open");
29 | use-underline: true;
30 | };
31 | }
32 | };
33 | };
34 | }
35 |
36 | PopoverMenu popover_menu {
37 | menu-model: adw_split_button_menu;
38 | }
39 |
40 | menu adw_split_button_menu {
41 | section {
42 | item {
43 | label: _("Item 01");
44 | action: "app.split-button-menu-item-activate";
45 | }
46 |
47 | submenu {
48 | label: _("Submenu");
49 |
50 | item {
51 | label: _("Item 02");
52 | action: "app.split-button-menu-item-activate";
53 | }
54 | }
55 |
56 | section {
57 | label: _("Edit");
58 |
59 | item {
60 | label: _("Item 03");
61 | action: "app.split-button-menu-item-activate";
62 | }
63 |
64 | item {
65 | label: _("Item 04");
66 | action: "app.split-button-menu-item-activate";
67 | }
68 | }
69 |
70 | item {
71 | label: _("Exit");
72 | action: "app.quit";
73 | }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/src/gtk-widgets/fixed/ui/MainWindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | Python - PyGObject - GTK
11 | 683
12 | 384
13 |
14 |
22 |
23 |
24 |
25 | 12
26 | 12
27 | 12
28 | 12
29 |
30 |
31 | Click here
32 |
33 |
34 |
35 |
36 |
37 |
38 |
46 |
--------------------------------------------------------------------------------
/src/gtk-widgets/stack-sidebar/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 |
3 | template $ExampleWindow: Gtk.ApplicationWindow {
4 | title: "Python - PyGObject - GTK";
5 | default-width: 683;
6 | default-height: 384;
7 |
8 | [titlebar]
9 | Gtk.HeaderBar header_bar {
10 | [end]
11 | Gtk.MenuButton {
12 | icon-name: "open-menu-symbolic";
13 | menu-model: primary_menu;
14 | }
15 | }
16 |
17 | Gtk.Box {
18 | orientation: horizontal;
19 | margin-top: 12;
20 | margin-end: 12;
21 | margin-bottom: 12;
22 | margin-start: 12;
23 | spacing: 12;
24 |
25 | Gtk.StackSidebar {
26 | stack: stack;
27 | }
28 |
29 | Gtk.Stack stack {
30 | Gtk.StackPage {
31 | name: "page1";
32 | title: "Page 1";
33 |
34 | child: Gtk.Box {
35 | orientation: vertical;
36 | spacing: 6;
37 |
38 | Gtk.Button {
39 | label: "Button 01";
40 | }
41 |
42 | Gtk.Button {
43 | label: "Button 02";
44 | }
45 |
46 | Gtk.Button {
47 | label: "Button 03";
48 | }
49 | };
50 | }
51 |
52 | Gtk.StackPage {
53 | name: "page2";
54 | title: "Page 1";
55 |
56 | child: Gtk.Box {
57 | orientation: vertical;
58 | spacing: 6;
59 |
60 | Gtk.Label {
61 | label: "Line 01";
62 | }
63 |
64 | Gtk.Label {
65 | label: "Line 02";
66 | }
67 |
68 | Gtk.Label {
69 | label: "Line 03";
70 | }
71 | };
72 | }
73 | }
74 | }
75 | }
76 |
77 | menu primary_menu {
78 | section {
79 | item {
80 | label: _("Preferences");
81 | action: "app.preferences";
82 | }
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/src/gtk-widgets/video/ui/MainWindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | Python - PyGObject - GTK
11 | 683
12 | 384
13 |
14 |
22 |
23 |
24 |
25 | 1
26 | true
27 | 12
28 | 12
29 | 12
30 | 12
31 | 12
32 |
33 |
34 |
35 |
36 |
37 |
38 |
46 |
--------------------------------------------------------------------------------
/src/gtk-widgets/stack-switcher/ui/MainWindow.blp:
--------------------------------------------------------------------------------
1 | using Gtk 4.0;
2 |
3 | template $ExampleWindow: Gtk.ApplicationWindow {
4 | title: "Python - PyGObject - GTK";
5 | default-width: 683;
6 | default-height: 384;
7 |
8 | [titlebar]
9 | Gtk.HeaderBar {
10 | title-widget: Gtk.StackSwitcher {
11 | stack: stack;
12 | };
13 |
14 | [end]
15 | Gtk.MenuButton {
16 | icon-name: "open-menu-symbolic";
17 | menu-model: primary_menu;
18 | }
19 | }
20 |
21 | Gtk.Box {
22 | orientation: vertical;
23 | homogeneous: true;
24 | margin-top: 12;
25 | margin-end: 12;
26 | margin-bottom: 12;
27 | margin-start: 12;
28 | spacing: 12;
29 |
30 | Gtk.Stack stack {
31 | vexpand: true;
32 |
33 | Gtk.StackPage {
34 | name: "page1";
35 | title: "Page 1";
36 |
37 | child: Gtk.Box {
38 | orientation: vertical;
39 | spacing: 6;
40 |
41 | Gtk.Button {
42 | label: "Button 01";
43 | }
44 |
45 | Gtk.Button {
46 | label: "Button 02";
47 | }
48 |
49 | Gtk.Button {
50 | label: "Button 03";
51 | }
52 | };
53 | }
54 |
55 | Gtk.StackPage {
56 | name: "page2";
57 | title: "Page 2";
58 |
59 | child: Gtk.Box {
60 | orientation: vertical;
61 | spacing: 6;
62 |
63 | Gtk.Label {
64 | label: "Line 01";
65 | }
66 |
67 | Gtk.Label {
68 | label: "Line 02";
69 | }
70 |
71 | Gtk.Label {
72 | label: "Line 03";
73 | }
74 | };
75 | }
76 | }
77 | }
78 | }
79 |
80 | menu primary_menu {
81 | section {
82 | item {
83 | label: _("Preferences");
84 | action: "app.preferences";
85 | }
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/src/gtk-widgets/window/ui/MainWindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | Python - PyGObject - GTK
11 | 683
12 | 384
13 |
14 |
22 |
23 |
24 |
25 | 1
26 | 12
27 | 12
28 | 12
29 | 12
30 | 12
31 |
32 |
33 | Open window
34 |
35 |
36 |
37 |
38 |
39 |
40 |
48 |
--------------------------------------------------------------------------------
/src/gtk-widgets/calendar/ui/MainWindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | Python - PyGObject - GTK
11 | 683
12 | 384
13 |
14 |
22 |
23 |
24 |
25 | 1
26 | true
27 | 12
28 | 12
29 | 12
30 | 12
31 | 12
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
48 |
--------------------------------------------------------------------------------
/src/gtk-widgets/check-button/ui/MainWindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | Python - PyGObject - GTK
11 | 683
12 | 384
13 |
14 |
22 |
23 |
24 |
25 | 1
26 | 12
27 | 12
28 | 12
29 | 12
30 | 12
31 |
32 |
33 | Accept?
34 |
35 |
36 |
37 |
38 |
39 |
40 |
48 |
--------------------------------------------------------------------------------
/src/gtk-widgets/switch/ui/MainWindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | Python - PyGObject - GTK
11 | 683
12 | 384
13 |
14 |
22 |
23 |
24 |
25 | 1
26 | 12
27 | 12
28 | 12
29 | 12
30 | 12
31 |
32 |
33 | 1
34 |
35 |
36 |
37 |
38 |
39 |
40 |
48 |
--------------------------------------------------------------------------------
/src/gtk-widgets/drag-and-drop-data/ui/MainWindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | Python - PyGObject - GTK
11 | 683
12 | 384
13 |
14 |
22 |
23 |
24 |
25 | 1
26 | 12
27 | 12
28 | 12
29 | 12
30 | 12
31 |
32 |
33 | Drag and drop the file here.
34 | true
35 |
36 |
37 |
38 |
39 |
40 |
48 |
--------------------------------------------------------------------------------
/src/gtk-widgets/translation-gettext/ui/MainWindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | Python - PyGObject - GTK
11 | 683
12 | 384
13 |
14 |
22 |
23 |
24 |
25 | 1
26 | 12
27 | 12
28 | 12
29 | 12
30 | 12
31 |
32 |
33 | Hello World!
34 | true
35 |
36 |
37 |
38 |
39 |
40 |
48 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/toast-overlay/ui/MainWindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | Python - PyGObject - GTK
11 | 683
12 | 384
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | 1
23 | 12
24 | 12
25 | 12
26 | 12
27 | 12
28 |
29 |
30 | Click here
31 | true
32 | 3
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/src/gtk-widgets/button/ui/MainWindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | Python - PyGObject - GTK
11 | 683
12 | 384
13 |
14 |
22 |
23 |
24 |
25 | 1
26 | 12
27 | 12
28 | 12
29 | 12
30 | 12
31 |
32 |
33 | Click here
34 | 3
35 | true
36 |
37 |
38 |
39 |
40 |
41 |
42 |
50 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/button-content/ui/MainWindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | Python - PyGObject - GTK
11 | 683
12 | 384
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | 1
21 | 12
22 | 12
23 | 12
24 | 12
25 | 12
26 |
27 |
28 | 12
29 | 12
30 |
31 |
32 |
33 | document-open-symbolic
34 | _Open
35 | true
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/src/gtk-widgets/drag-and-drop-widget/ui/MainWindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | Python - PyGObject - GTK
11 | 683
12 | 384
13 |
14 |
22 |
23 |
24 |
25 | 1
26 | true
27 | 12
28 | 12
29 | 12
30 | 12
31 | 12
32 |
33 |
34 |
35 |
36 | 0
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
52 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/navigation-split-view/ui/Sidebar.ui:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
45 |
53 |
--------------------------------------------------------------------------------
/src/gtk-widgets/pango-tags/ui/MainWindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | Python - PyGObject - GTK
11 | 683
12 | 384
13 |
14 |
22 |
23 |
24 |
25 | 1
26 | true
27 | 12
28 | 12
29 | 12
30 | 12
31 | 12
32 |
33 |
34 |
35 |
36 | text_buffer
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
53 |
--------------------------------------------------------------------------------
/src/gtk-widgets/css-provider/ui/MainWindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | Python - PyGObject - GTK
11 | 683
12 | 384
13 |
14 |
22 |
23 |
24 |
25 | 1
26 | 12
27 | 12
28 | 12
29 | 12
30 | 12
31 |
32 |
33 | Click here
34 | 3
35 | true
36 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
53 |
--------------------------------------------------------------------------------
/src/gtk-widgets/menu-button/ui/MainWindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | Python - PyGObject - GTK
11 | 683
12 | 384
13 |
14 |
22 |
23 |
24 |
54 |
--------------------------------------------------------------------------------
/src/gtk-widgets/image/ui/MainWindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | Python - PyGObject - GTK
11 | 683
12 | 384
13 |
14 |
22 |
23 |
24 |
25 | 1
26 | true
27 | 12
28 | 12
29 | 12
30 | 12
31 | 12
32 |
33 |
34 | Button 02
35 |
36 |
37 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
55 |
--------------------------------------------------------------------------------
/src/scripts/get_widget_info.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """Collecting widget information."""
3 |
4 | import pathlib
5 |
6 | import gi
7 |
8 | gi.require_version(namespace='Gtk', version='4.0')
9 | gi.require_version(namespace='Adw', version='1')
10 |
11 | from gi.repository import Adw, GObject, Gtk
12 |
13 | BASE_DIR = pathlib.Path(__file__).resolve().parent
14 | TEMPLATE_FILE = BASE_DIR / 'templates' / 'widget.md'
15 | OUTPUT_DIR = BASE_DIR / 'widgets-info'
16 | if not OUTPUT_DIR.exists():
17 | OUTPUT_DIR.mkdir()
18 |
19 | PYGOBJECT_VERSION = GObject.pygobject_version
20 | GTK_VERSION = (
21 | Gtk.get_major_version(),
22 | Gtk.get_minor_version(),
23 | Gtk.get_micro_version(),
24 | )
25 | LIBADWAITA_VERSION = (
26 | Adw.get_major_version(),
27 | Adw.get_minor_version(),
28 | Adw.get_micro_version(),
29 | )
30 |
31 |
32 | data = open(file=TEMPLATE_FILE, mode='r', encoding='utf-8')
33 | template = data.read()
34 |
35 | print('[!] Collecting information, please wait... [!]')
36 | WIDGETS = [Adw.MultiLayoutView(), Adw.Layout(), Adw.LayoutSlot(id='renato')]
37 | for widget in WIDGETS:
38 | widget_name = widget.get_name()
39 | methods_get = [
40 | method for method in dir(widget) if method.startswith('get_')
41 | ]
42 | methods_set = [
43 | method for method in dir(widget) if method.startswith('set_')
44 | ]
45 |
46 | output = OUTPUT_DIR.joinpath(f'{widget_name}.md')
47 | output.write_text(
48 | encoding='utf-8',
49 | data=template.format(
50 | widget_name=widget_name,
51 | gtk_version=GTK_VERSION,
52 | libadwaita_version=LIBADWAITA_VERSION,
53 | pygobject_version=PYGOBJECT_VERSION,
54 | widget_props='\n- '.join(sorted(dir(widget.props))),
55 | widget_signals='\n- '.join(
56 | sorted(GObject.signal_list_names(widget))
57 | ),
58 | methods_get='\n- '.join(sorted(methods_get)),
59 | methods_set='\n- '.join(sorted(methods_set)),
60 | ),
61 | )
62 | print('[!] Finished [!]')
63 |
--------------------------------------------------------------------------------
/src/gtk-widgets/file-dialog-folder/ui/MainWindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | Python - PyGObject - GTK
11 | 683
12 | 384
13 |
14 |
22 |
23 |
24 |
25 | 1
26 | 12
27 | 12
28 | 12
29 | 12
30 | 12
31 |
32 |
33 | Select folder
34 |
35 |
36 |
37 |
38 |
39 | Select folders
40 |
41 |
42 |
43 |
44 |
45 |
46 |
54 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/avatar/ui/MainWindow.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """Python - PyGObject - GTK."""
3 |
4 | import pathlib
5 | import sys
6 |
7 | import gi
8 |
9 | gi.require_version(namespace='Gtk', version='4.0')
10 | gi.require_version(namespace='Adw', version='1')
11 |
12 | from gi.repository import Adw, Gio, Gtk
13 |
14 | BASE_DIR = pathlib.Path(__file__).resolve().parent
15 | sys.path.append(str(BASE_DIR.parent.parent.parent / 'scripts'))
16 |
17 | from blp import blp_to_ui
18 |
19 | UI_FILE = BASE_DIR / 'MainWindow.ui'
20 | BLP_FILE = BASE_DIR / 'MainWindow.blp'
21 | blp_to_ui(file=BLP_FILE)
22 |
23 |
24 | Adw.init()
25 |
26 |
27 | @Gtk.Template(filename=UI_FILE)
28 | class ExampleWindow(Adw.ApplicationWindow):
29 | __gtype_name__ = 'ExampleWindow'
30 |
31 | def __init__(self, **kwargs):
32 | super().__init__(**kwargs)
33 |
34 |
35 | class ExampleApplication(Adw.Application):
36 | def __init__(self):
37 | super().__init__(
38 | application_id='br.com.justcode.Gtk',
39 | flags=Gio.ApplicationFlags.DEFAULT_FLAGS,
40 | )
41 |
42 | self.create_action('quit', self.exit_app, ['q'])
43 |
44 | def do_activate(self):
45 | win = self.props.active_window
46 | if not win:
47 | win = ExampleWindow(application=self)
48 | win.present()
49 |
50 | def do_startup(self):
51 | Gtk.Application.do_startup(self)
52 |
53 | def do_shutdown(self):
54 | Gtk.Application.do_shutdown(self)
55 |
56 | def exit_app(self, action, param):
57 | self.quit()
58 |
59 | def create_action(self, name, callback, shortcuts=None):
60 | action = Gio.SimpleAction.new(name=name, parameter_type=None)
61 | action.connect('activate', callback)
62 | self.add_action(action=action)
63 | if shortcuts:
64 | self.set_accels_for_action(
65 | detailed_action_name=f'app.{name}',
66 | accels=shortcuts,
67 | )
68 |
69 |
70 | if __name__ == '__main__':
71 | app = ExampleApplication()
72 | app.run(sys.argv)
73 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/clamp/ui/MainWindow.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """Python - PyGObject - GTK."""
3 |
4 | import pathlib
5 | import sys
6 |
7 | import gi
8 |
9 | gi.require_version(namespace='Gtk', version='4.0')
10 | gi.require_version(namespace='Adw', version='1')
11 |
12 | from gi.repository import Adw, Gio, Gtk
13 |
14 | BASE_DIR = pathlib.Path(__file__).resolve().parent
15 | sys.path.append(str(BASE_DIR.parent.parent.parent / 'scripts'))
16 |
17 | from blp import blp_to_ui
18 |
19 | UI_FILE = BASE_DIR / 'MainWindow.ui'
20 | BLP_FILE = BASE_DIR / 'MainWindow.blp'
21 | blp_to_ui(file=BLP_FILE)
22 |
23 |
24 | Adw.init()
25 |
26 |
27 | @Gtk.Template(filename=UI_FILE)
28 | class ExampleWindow(Adw.ApplicationWindow):
29 | __gtype_name__ = 'ExampleWindow'
30 |
31 | def __init__(self, **kwargs):
32 | super().__init__(**kwargs)
33 |
34 |
35 | class ExampleApplication(Adw.Application):
36 | def __init__(self):
37 | super().__init__(
38 | application_id='br.com.justcode.Gtk',
39 | flags=Gio.ApplicationFlags.DEFAULT_FLAGS,
40 | )
41 |
42 | self.create_action('quit', self.exit_app, ['q'])
43 |
44 | def do_activate(self):
45 | win = self.props.active_window
46 | if not win:
47 | win = ExampleWindow(application=self)
48 | win.present()
49 |
50 | def do_startup(self):
51 | Gtk.Application.do_startup(self)
52 |
53 | def do_shutdown(self):
54 | Gtk.Application.do_shutdown(self)
55 |
56 | def exit_app(self, action, param):
57 | self.quit()
58 |
59 | def create_action(self, name, callback, shortcuts=None):
60 | action = Gio.SimpleAction.new(name=name, parameter_type=None)
61 | action.connect('activate', callback)
62 | self.add_action(action=action)
63 | if shortcuts:
64 | self.set_accels_for_action(
65 | detailed_action_name=f'app.{name}',
66 | accels=shortcuts,
67 | )
68 |
69 |
70 | if __name__ == '__main__':
71 | app = ExampleApplication()
72 | app.run(sys.argv)
73 |
--------------------------------------------------------------------------------
/src/gtk-widgets/entry/ui/MainWindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | Python - PyGObject - GTK
11 | 683
12 | 384
13 |
14 |
22 |
23 |
24 |
25 | 1
26 | 12
27 | 12
28 | 12
29 | 12
30 | 12
31 |
32 |
33 | Type something and click on the icon or press Enter:
34 |
35 |
36 |
37 |
38 | system-search-symbolic
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
54 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/breakpoint/ui/MainWindow.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """Python - PyGObject - GTK."""
3 |
4 | import pathlib
5 | import sys
6 |
7 | import gi
8 |
9 | gi.require_version(namespace='Gtk', version='4.0')
10 | gi.require_version(namespace='Adw', version='1')
11 |
12 | from gi.repository import Adw, Gio, Gtk
13 |
14 | BASE_DIR = pathlib.Path(__file__).resolve().parent
15 | sys.path.append(str(BASE_DIR.parent.parent.parent / 'scripts'))
16 |
17 | from blp import blp_to_ui
18 |
19 | UI_FILE = BASE_DIR / 'MainWindow.ui'
20 | BLP_FILE = BASE_DIR / 'MainWindow.blp'
21 | blp_to_ui(file=BLP_FILE)
22 |
23 |
24 | Adw.init()
25 |
26 |
27 | @Gtk.Template(filename=UI_FILE)
28 | class ExampleWindow(Adw.ApplicationWindow):
29 | __gtype_name__ = 'ExampleWindow'
30 |
31 | def __init__(self, **kwargs):
32 | super().__init__(**kwargs)
33 |
34 |
35 | class ExampleApplication(Adw.Application):
36 | def __init__(self):
37 | super().__init__(
38 | application_id='br.com.justcode.Gtk',
39 | flags=Gio.ApplicationFlags.DEFAULT_FLAGS,
40 | )
41 |
42 | self.create_action('quit', self.exit_app, ['q'])
43 |
44 | def do_activate(self):
45 | win = self.props.active_window
46 | if not win:
47 | win = ExampleWindow(application=self)
48 | win.present()
49 |
50 | def do_startup(self):
51 | Gtk.Application.do_startup(self)
52 |
53 | def do_shutdown(self):
54 | Gtk.Application.do_shutdown(self)
55 |
56 | def exit_app(self, action, param):
57 | self.quit()
58 |
59 | def create_action(self, name, callback, shortcuts=None):
60 | action = Gio.SimpleAction.new(name=name, parameter_type=None)
61 | action.connect('activate', callback)
62 | self.add_action(action=action)
63 | if shortcuts:
64 | self.set_accels_for_action(
65 | detailed_action_name=f'app.{name}',
66 | accels=shortcuts,
67 | )
68 |
69 |
70 | if __name__ == '__main__':
71 | app = ExampleApplication()
72 | app.run(sys.argv)
73 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/expander-row/ui/MainWindow.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """Python - PyGObject - GTK."""
3 |
4 | import pathlib
5 | import sys
6 |
7 | import gi
8 |
9 | gi.require_version(namespace='Gtk', version='4.0')
10 | gi.require_version(namespace='Adw', version='1')
11 |
12 | from gi.repository import Adw, Gio, Gtk
13 |
14 | BASE_DIR = pathlib.Path(__file__).resolve().parent
15 | sys.path.append(str(BASE_DIR.parent.parent.parent / 'scripts'))
16 |
17 | from blp import blp_to_ui
18 |
19 | UI_FILE = BASE_DIR / 'MainWindow.ui'
20 | BLP_FILE = BASE_DIR / 'MainWindow.blp'
21 | blp_to_ui(file=BLP_FILE)
22 |
23 |
24 | Adw.init()
25 |
26 |
27 | @Gtk.Template(filename=UI_FILE)
28 | class ExampleWindow(Adw.ApplicationWindow):
29 | __gtype_name__ = 'ExampleWindow'
30 |
31 | def __init__(self, **kwargs):
32 | super().__init__(**kwargs)
33 |
34 |
35 | class ExampleApplication(Adw.Application):
36 | def __init__(self):
37 | super().__init__(
38 | application_id='br.com.justcode.Gtk',
39 | flags=Gio.ApplicationFlags.DEFAULT_FLAGS,
40 | )
41 |
42 | self.create_action('quit', self.exit_app, ['q'])
43 |
44 | def do_activate(self):
45 | win = self.props.active_window
46 | if not win:
47 | win = ExampleWindow(application=self)
48 | win.present()
49 |
50 | def do_startup(self):
51 | Gtk.Application.do_startup(self)
52 |
53 | def do_shutdown(self):
54 | Gtk.Application.do_shutdown(self)
55 |
56 | def exit_app(self, action, param):
57 | self.quit()
58 |
59 | def create_action(self, name, callback, shortcuts=None):
60 | action = Gio.SimpleAction.new(name=name, parameter_type=None)
61 | action.connect('activate', callback)
62 | self.add_action(action=action)
63 | if shortcuts:
64 | self.set_accels_for_action(
65 | detailed_action_name=f'app.{name}',
66 | accels=shortcuts,
67 | )
68 |
69 |
70 | if __name__ == '__main__':
71 | app = ExampleApplication()
72 | app.run(sys.argv)
73 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/status-page/ui/MainWindow.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """Python - PyGObject - GTK."""
3 |
4 | import pathlib
5 | import sys
6 |
7 | import gi
8 |
9 | gi.require_version(namespace='Gtk', version='4.0')
10 | gi.require_version(namespace='Adw', version='1')
11 |
12 | from gi.repository import Adw, Gio, Gtk
13 |
14 | BASE_DIR = pathlib.Path(__file__).resolve().parent
15 | sys.path.append(str(BASE_DIR.parent.parent.parent / 'scripts'))
16 |
17 | from blp import blp_to_ui
18 |
19 | UI_FILE = BASE_DIR / 'MainWindow.ui'
20 | BLP_FILE = BASE_DIR / 'MainWindow.blp'
21 | blp_to_ui(file=BLP_FILE)
22 |
23 |
24 | Adw.init()
25 |
26 |
27 | @Gtk.Template(filename=UI_FILE)
28 | class ExampleWindow(Adw.ApplicationWindow):
29 | __gtype_name__ = 'ExampleWindow'
30 |
31 | def __init__(self, **kwargs):
32 | super().__init__(**kwargs)
33 |
34 |
35 | class ExampleApplication(Adw.Application):
36 | def __init__(self):
37 | super().__init__(
38 | application_id='br.com.justcode.Gtk',
39 | flags=Gio.ApplicationFlags.DEFAULT_FLAGS,
40 | )
41 |
42 | self.create_action('quit', self.exit_app, ['q'])
43 |
44 | def do_activate(self):
45 | win = self.props.active_window
46 | if not win:
47 | win = ExampleWindow(application=self)
48 | win.present()
49 |
50 | def do_startup(self):
51 | Gtk.Application.do_startup(self)
52 |
53 | def do_shutdown(self):
54 | Gtk.Application.do_shutdown(self)
55 |
56 | def exit_app(self, action, param):
57 | self.quit()
58 |
59 | def create_action(self, name, callback, shortcuts=None):
60 | action = Gio.SimpleAction.new(name=name, parameter_type=None)
61 | action.connect('activate', callback)
62 | self.add_action(action=action)
63 | if shortcuts:
64 | self.set_accels_for_action(
65 | detailed_action_name=f'app.{name}',
66 | accels=shortcuts,
67 | )
68 |
69 |
70 | if __name__ == '__main__':
71 | app = ExampleApplication()
72 | app.run(sys.argv)
73 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/view-stack/ui/MainWindow.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """Python - PyGObject - GTK."""
3 |
4 | import pathlib
5 | import sys
6 |
7 | import gi
8 |
9 | gi.require_version(namespace='Gtk', version='4.0')
10 | gi.require_version(namespace='Adw', version='1')
11 |
12 | from gi.repository import Adw, Gio, Gtk
13 |
14 | BASE_DIR = pathlib.Path(__file__).resolve().parent
15 | sys.path.append(str(BASE_DIR.parent.parent.parent / 'scripts'))
16 |
17 | from blp import blp_to_ui
18 |
19 | UI_FILE = BASE_DIR / 'MainWindow.ui'
20 | BLP_FILE = BASE_DIR / 'MainWindow.blp'
21 | blp_to_ui(file=BLP_FILE)
22 |
23 |
24 | Adw.init()
25 |
26 |
27 | @Gtk.Template(filename=UI_FILE)
28 | class ExampleWindow(Adw.ApplicationWindow):
29 | __gtype_name__ = 'ExampleWindow'
30 |
31 | def __init__(self, **kwargs):
32 | super().__init__(**kwargs)
33 |
34 |
35 | class ExampleApplication(Adw.Application):
36 | def __init__(self):
37 | super().__init__(
38 | application_id='br.com.justcode.Gtk',
39 | flags=Gio.ApplicationFlags.DEFAULT_FLAGS,
40 | )
41 |
42 | self.create_action('quit', self.exit_app, ['q'])
43 |
44 | def do_activate(self):
45 | win = self.props.active_window
46 | if not win:
47 | win = ExampleWindow(application=self)
48 | win.present()
49 |
50 | def do_startup(self):
51 | Gtk.Application.do_startup(self)
52 |
53 | def do_shutdown(self):
54 | Gtk.Application.do_shutdown(self)
55 |
56 | def exit_app(self, action, param):
57 | self.quit()
58 |
59 | def create_action(self, name, callback, shortcuts=None):
60 | action = Gio.SimpleAction.new(name=name, parameter_type=None)
61 | action.connect('activate', callback)
62 | self.add_action(action=action)
63 | if shortcuts:
64 | self.set_accels_for_action(
65 | detailed_action_name=f'app.{name}',
66 | accels=shortcuts,
67 | )
68 |
69 |
70 | if __name__ == '__main__':
71 | app = ExampleApplication()
72 | app.run(sys.argv)
73 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/view-switcher/ui/MainWindow.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """Python - PyGObject - GTK."""
3 |
4 | import pathlib
5 | import sys
6 |
7 | import gi
8 |
9 | gi.require_version(namespace='Gtk', version='4.0')
10 | gi.require_version(namespace='Adw', version='1')
11 |
12 | from gi.repository import Adw, Gio, Gtk
13 |
14 | BASE_DIR = pathlib.Path(__file__).resolve().parent
15 | sys.path.append(str(BASE_DIR.parent.parent.parent / 'scripts'))
16 |
17 | from blp import blp_to_ui
18 |
19 | UI_FILE = BASE_DIR / 'MainWindow.ui'
20 | BLP_FILE = BASE_DIR / 'MainWindow.blp'
21 | blp_to_ui(file=BLP_FILE)
22 |
23 |
24 | Adw.init()
25 |
26 |
27 | @Gtk.Template(filename=UI_FILE)
28 | class ExampleWindow(Adw.ApplicationWindow):
29 | __gtype_name__ = 'ExampleWindow'
30 |
31 | def __init__(self, **kwargs):
32 | super().__init__(**kwargs)
33 |
34 |
35 | class ExampleApplication(Adw.Application):
36 | def __init__(self):
37 | super().__init__(
38 | application_id='br.com.justcode.Gtk',
39 | flags=Gio.ApplicationFlags.DEFAULT_FLAGS,
40 | )
41 |
42 | self.create_action('quit', self.exit_app, ['q'])
43 |
44 | def do_activate(self):
45 | win = self.props.active_window
46 | if not win:
47 | win = ExampleWindow(application=self)
48 | win.present()
49 |
50 | def do_startup(self):
51 | Gtk.Application.do_startup(self)
52 |
53 | def do_shutdown(self):
54 | Gtk.Application.do_shutdown(self)
55 |
56 | def exit_app(self, action, param):
57 | self.quit()
58 |
59 | def create_action(self, name, callback, shortcuts=None):
60 | action = Gio.SimpleAction.new(name=name, parameter_type=None)
61 | action.connect('activate', callback)
62 | self.add_action(action=action)
63 | if shortcuts:
64 | self.set_accels_for_action(
65 | detailed_action_name=f'app.{name}',
66 | accels=shortcuts,
67 | )
68 |
69 |
70 | if __name__ == '__main__':
71 | app = ExampleApplication()
72 | app.run(sys.argv)
73 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/application-window/ui/MainWindow.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """Python - PyGObject - GTK."""
3 |
4 | import pathlib
5 | import sys
6 |
7 | import gi
8 |
9 | gi.require_version(namespace='Gtk', version='4.0')
10 | gi.require_version(namespace='Adw', version='1')
11 |
12 | from gi.repository import Adw, Gio, Gtk
13 |
14 | BASE_DIR = pathlib.Path(__file__).resolve().parent
15 | sys.path.append(str(BASE_DIR.parent.parent.parent / 'scripts'))
16 |
17 | from blp import blp_to_ui
18 |
19 | UI_FILE = BASE_DIR / 'MainWindow.ui'
20 | BLP_FILE = BASE_DIR / 'MainWindow.blp'
21 | blp_to_ui(file=BLP_FILE)
22 |
23 |
24 | Adw.init()
25 |
26 |
27 | @Gtk.Template(filename=UI_FILE)
28 | class ExampleWindow(Adw.ApplicationWindow):
29 | __gtype_name__ = 'ExampleWindow'
30 |
31 | def __init__(self, **kwargs):
32 | super().__init__(**kwargs)
33 |
34 |
35 | class ExampleApplication(Adw.Application):
36 | def __init__(self):
37 | super().__init__(
38 | application_id='br.com.justcode.Gtk',
39 | flags=Gio.ApplicationFlags.DEFAULT_FLAGS,
40 | )
41 |
42 | self.create_action('quit', self.exit_app, ['q'])
43 |
44 | def do_activate(self):
45 | win = self.props.active_window
46 | if not win:
47 | win = ExampleWindow(application=self)
48 | win.present()
49 |
50 | def do_startup(self):
51 | Gtk.Application.do_startup(self)
52 |
53 | def do_shutdown(self):
54 | Gtk.Application.do_shutdown(self)
55 |
56 | def exit_app(self, action, param):
57 | self.quit()
58 |
59 | def create_action(self, name, callback, shortcuts=None):
60 | action = Gio.SimpleAction.new(name=name, parameter_type=None)
61 | action.connect('activate', callback)
62 | self.add_action(action=action)
63 | if shortcuts:
64 | self.set_accels_for_action(
65 | detailed_action_name=f'app.{name}',
66 | accels=shortcuts,
67 | )
68 |
69 |
70 | if __name__ == '__main__':
71 | app = ExampleApplication()
72 | app.run(sys.argv)
73 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/multi-layout-view/ui/MainWindow.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """Python - PyGObject - GTK."""
3 |
4 | import pathlib
5 | import sys
6 |
7 | import gi
8 |
9 | gi.require_version(namespace='Gtk', version='4.0')
10 | gi.require_version(namespace='Adw', version='1')
11 |
12 | from gi.repository import Adw, Gio, Gtk
13 |
14 | BASE_DIR = pathlib.Path(__file__).resolve().parent
15 | sys.path.append(str(BASE_DIR.parent.parent.parent / 'scripts'))
16 |
17 | from blp import blp_to_ui
18 |
19 | UI_FILE = BASE_DIR / 'MainWindow.ui'
20 | BLP_FILE = BASE_DIR / 'MainWindow.blp'
21 | blp_to_ui(file=BLP_FILE)
22 |
23 |
24 | Adw.init()
25 |
26 |
27 | @Gtk.Template(filename=UI_FILE)
28 | class ExampleWindow(Adw.ApplicationWindow):
29 | __gtype_name__ = 'ExampleWindow'
30 |
31 | def __init__(self, **kwargs):
32 | super().__init__(**kwargs)
33 |
34 |
35 | class ExampleApplication(Adw.Application):
36 | def __init__(self):
37 | super().__init__(
38 | application_id='br.com.justcode.Gtk',
39 | flags=Gio.ApplicationFlags.DEFAULT_FLAGS,
40 | )
41 |
42 | self.create_action('quit', self.exit_app, ['q'])
43 |
44 | def do_activate(self):
45 | win = self.props.active_window
46 | if not win:
47 | win = ExampleWindow(application=self)
48 | win.present()
49 |
50 | def do_startup(self):
51 | Gtk.Application.do_startup(self)
52 |
53 | def do_shutdown(self):
54 | Gtk.Application.do_shutdown(self)
55 |
56 | def exit_app(self, action, param):
57 | self.quit()
58 |
59 | def create_action(self, name, callback, shortcuts=None):
60 | action = Gio.SimpleAction.new(name=name, parameter_type=None)
61 | action.connect('activate', callback)
62 | self.add_action(action=action)
63 | if shortcuts:
64 | self.set_accels_for_action(
65 | detailed_action_name=f'app.{name}',
66 | accels=shortcuts,
67 | )
68 |
69 |
70 | if __name__ == '__main__':
71 | app = ExampleApplication()
72 | app.run(sys.argv)
73 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/navigation-view/ui/MainWindow.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """Python - PyGObject - GTK."""
3 |
4 | import pathlib
5 | import sys
6 |
7 | import gi
8 |
9 | gi.require_version(namespace='Gtk', version='4.0')
10 | gi.require_version(namespace='Adw', version='1')
11 |
12 | from gi.repository import Adw, Gio, Gtk
13 |
14 | BASE_DIR = pathlib.Path(__file__).resolve().parent
15 | sys.path.append(str(BASE_DIR.parent.parent.parent / 'scripts'))
16 |
17 | from blp import blp_to_ui
18 |
19 | UI_FILE = BASE_DIR / 'MainWindow.ui'
20 | BLP_FILE = BASE_DIR / 'MainWindow.blp'
21 | blp_to_ui(file=BLP_FILE)
22 |
23 |
24 | Adw.init()
25 |
26 |
27 | @Gtk.Template(filename=UI_FILE)
28 | class ExampleWindow(Adw.ApplicationWindow):
29 | __gtype_name__ = 'ExampleWindow'
30 |
31 | def __init__(self, **kwargs):
32 | super().__init__(**kwargs)
33 |
34 |
35 | class ExampleApplication(Adw.Application):
36 | def __init__(self):
37 | super().__init__(
38 | application_id='br.com.justcode.Gtk',
39 | flags=Gio.ApplicationFlags.DEFAULT_FLAGS,
40 | )
41 |
42 | self.create_action('quit', self.exit_app, ['q'])
43 |
44 | def do_activate(self):
45 | win = self.props.active_window
46 | if not win:
47 | win = ExampleWindow(application=self)
48 | win.present()
49 |
50 | def do_startup(self):
51 | Gtk.Application.do_startup(self)
52 |
53 | def do_shutdown(self):
54 | Gtk.Application.do_shutdown(self)
55 |
56 | def exit_app(self, action, param):
57 | self.quit()
58 |
59 | def create_action(self, name, callback, shortcuts=None):
60 | action = Gio.SimpleAction.new(name=name, parameter_type=None)
61 | action.connect('activate', callback)
62 | self.add_action(action=action)
63 | if shortcuts:
64 | self.set_accels_for_action(
65 | detailed_action_name=f'app.{name}',
66 | accels=shortcuts,
67 | )
68 |
69 |
70 | if __name__ == '__main__':
71 | app = ExampleApplication()
72 | app.run(sys.argv)
73 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/password-entry-row/ui/MainWindow.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """Python - PyGObject - GTK."""
3 |
4 | import pathlib
5 | import sys
6 |
7 | import gi
8 |
9 | gi.require_version(namespace='Gtk', version='4.0')
10 | gi.require_version(namespace='Adw', version='1')
11 |
12 | from gi.repository import Adw, Gio, Gtk
13 |
14 | BASE_DIR = pathlib.Path(__file__).resolve().parent
15 | sys.path.append(str(BASE_DIR.parent.parent.parent / 'scripts'))
16 |
17 | from blp import blp_to_ui
18 |
19 | UI_FILE = BASE_DIR / 'MainWindow.ui'
20 | BLP_FILE = BASE_DIR / 'MainWindow.blp'
21 | blp_to_ui(file=BLP_FILE)
22 |
23 |
24 | Adw.init()
25 |
26 |
27 | @Gtk.Template(filename=UI_FILE)
28 | class ExampleWindow(Adw.ApplicationWindow):
29 | __gtype_name__ = 'ExampleWindow'
30 |
31 | def __init__(self, **kwargs):
32 | super().__init__(**kwargs)
33 |
34 |
35 | class ExampleApplication(Adw.Application):
36 | def __init__(self):
37 | super().__init__(
38 | application_id='br.com.justcode.Gtk',
39 | flags=Gio.ApplicationFlags.DEFAULT_FLAGS,
40 | )
41 |
42 | self.create_action('quit', self.exit_app, ['q'])
43 |
44 | def do_activate(self):
45 | win = self.props.active_window
46 | if not win:
47 | win = ExampleWindow(application=self)
48 | win.present()
49 |
50 | def do_startup(self):
51 | Gtk.Application.do_startup(self)
52 |
53 | def do_shutdown(self):
54 | Gtk.Application.do_shutdown(self)
55 |
56 | def exit_app(self, action, param):
57 | self.quit()
58 |
59 | def create_action(self, name, callback, shortcuts=None):
60 | action = Gio.SimpleAction.new(name=name, parameter_type=None)
61 | action.connect('activate', callback)
62 | self.add_action(action=action)
63 | if shortcuts:
64 | self.set_accels_for_action(
65 | detailed_action_name=f'app.{name}',
66 | accels=shortcuts,
67 | )
68 |
69 |
70 | if __name__ == '__main__':
71 | app = ExampleApplication()
72 | app.run(sys.argv)
73 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/view-stack-page/ui/MainWindow.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """Python - PyGObject - GTK."""
3 |
4 | import pathlib
5 | import sys
6 |
7 | import gi
8 |
9 | gi.require_version(namespace='Gtk', version='4.0')
10 | gi.require_version(namespace='Adw', version='1')
11 |
12 | from gi.repository import Adw, Gio, Gtk
13 |
14 | BASE_DIR = pathlib.Path(__file__).resolve().parent
15 | sys.path.append(str(BASE_DIR.parent.parent.parent / 'scripts'))
16 |
17 | from blp import blp_to_ui
18 |
19 | UI_FILE = BASE_DIR / 'MainWindow.ui'
20 | BLP_FILE = BASE_DIR / 'MainWindow.blp'
21 | blp_to_ui(file=BLP_FILE)
22 |
23 |
24 | Adw.init()
25 |
26 |
27 | @Gtk.Template(filename=UI_FILE)
28 | class ExampleWindow(Adw.ApplicationWindow):
29 | __gtype_name__ = 'ExampleWindow'
30 |
31 | def __init__(self, **kwargs):
32 | super().__init__(**kwargs)
33 |
34 |
35 | class ExampleApplication(Adw.Application):
36 | def __init__(self):
37 | super().__init__(
38 | application_id='br.com.justcode.Gtk',
39 | flags=Gio.ApplicationFlags.DEFAULT_FLAGS,
40 | )
41 |
42 | self.create_action('quit', self.exit_app, ['q'])
43 |
44 | def do_activate(self):
45 | win = self.props.active_window
46 | if not win:
47 | win = ExampleWindow(application=self)
48 | win.present()
49 |
50 | def do_startup(self):
51 | Gtk.Application.do_startup(self)
52 |
53 | def do_shutdown(self):
54 | Gtk.Application.do_shutdown(self)
55 |
56 | def exit_app(self, action, param):
57 | self.quit()
58 |
59 | def create_action(self, name, callback, shortcuts=None):
60 | action = Gio.SimpleAction.new(name=name, parameter_type=None)
61 | action.connect('activate', callback)
62 | self.add_action(action=action)
63 | if shortcuts:
64 | self.set_accels_for_action(
65 | detailed_action_name=f'app.{name}',
66 | accels=shortcuts,
67 | )
68 |
69 |
70 | if __name__ == '__main__':
71 | app = ExampleApplication()
72 | app.run(sys.argv)
73 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/view-switcher-bar/ui/MainWindow.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """Python - PyGObject - GTK."""
3 |
4 | import pathlib
5 | import sys
6 |
7 | import gi
8 |
9 | gi.require_version(namespace='Gtk', version='4.0')
10 | gi.require_version(namespace='Adw', version='1')
11 |
12 | from gi.repository import Adw, Gio, Gtk
13 |
14 | BASE_DIR = pathlib.Path(__file__).resolve().parent
15 | sys.path.append(str(BASE_DIR.parent.parent.parent / 'scripts'))
16 |
17 | from blp import blp_to_ui
18 |
19 | UI_FILE = BASE_DIR / 'MainWindow.ui'
20 | BLP_FILE = BASE_DIR / 'MainWindow.blp'
21 | blp_to_ui(file=BLP_FILE)
22 |
23 |
24 | Adw.init()
25 |
26 |
27 | @Gtk.Template(filename=UI_FILE)
28 | class ExampleWindow(Adw.ApplicationWindow):
29 | __gtype_name__ = 'ExampleWindow'
30 |
31 | def __init__(self, **kwargs):
32 | super().__init__(**kwargs)
33 |
34 |
35 | class ExampleApplication(Adw.Application):
36 | def __init__(self):
37 | super().__init__(
38 | application_id='br.com.justcode.Gtk',
39 | flags=Gio.ApplicationFlags.DEFAULT_FLAGS,
40 | )
41 |
42 | self.create_action('quit', self.exit_app, ['q'])
43 |
44 | def do_activate(self):
45 | win = self.props.active_window
46 | if not win:
47 | win = ExampleWindow(application=self)
48 | win.present()
49 |
50 | def do_startup(self):
51 | Gtk.Application.do_startup(self)
52 |
53 | def do_shutdown(self):
54 | Gtk.Application.do_shutdown(self)
55 |
56 | def exit_app(self, action, param):
57 | self.quit()
58 |
59 | def create_action(self, name, callback, shortcuts=None):
60 | action = Gio.SimpleAction.new(name=name, parameter_type=None)
61 | action.connect('activate', callback)
62 | self.add_action(action=action)
63 | if shortcuts:
64 | self.set_accels_for_action(
65 | detailed_action_name=f'app.{name}',
66 | accels=shortcuts,
67 | )
68 |
69 |
70 | if __name__ == '__main__':
71 | app = ExampleApplication()
72 | app.run(sys.argv)
73 |
--------------------------------------------------------------------------------
/src/gtk-widgets/stack-sidebar/ui/MainWindow.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """Python - PyGObject - GTK."""
3 |
4 | import pathlib
5 | import sys
6 |
7 | import gi
8 |
9 | gi.require_version(namespace='Gtk', version='4.0')
10 |
11 | from gi.repository import Gio, Gtk
12 |
13 | BASE_DIR = pathlib.Path(__file__).resolve().parent
14 | BLP_FILE = BASE_DIR / 'MainWindow.blp'
15 | UI_FILE = BASE_DIR / 'MainWindow.ui'
16 |
17 | sys.path.append(str(BASE_DIR.parent.parent.parent / 'scripts'))
18 |
19 | from blp import blp_to_ui
20 |
21 | blp_to_ui(file=BLP_FILE)
22 |
23 |
24 | @Gtk.Template(filename=UI_FILE)
25 | class ExampleWindow(Gtk.ApplicationWindow):
26 | __gtype_name__ = 'ExampleWindow'
27 |
28 | def __init__(self, **kwargs):
29 | super().__init__(**kwargs)
30 |
31 |
32 | class ExampleApplication(Gtk.Application):
33 | def __init__(self):
34 | super().__init__(
35 | application_id='br.com.justcode.Gtk',
36 | flags=Gio.ApplicationFlags.DEFAULT_FLAGS,
37 | )
38 |
39 | self.create_action('quit', self.exit_app, ['q'])
40 | self.create_action('preferences', self.on_preferences_action)
41 |
42 | def do_activate(self):
43 | win = self.props.active_window
44 | if not win:
45 | win = ExampleWindow(application=self)
46 | win.present()
47 |
48 | def do_startup(self):
49 | Gtk.Application.do_startup(self)
50 |
51 | def do_shutdown(self):
52 | Gtk.Application.do_shutdown(self)
53 |
54 | def on_preferences_action(self, action, param):
55 | print('Action `app.preferences` was active.')
56 |
57 | def exit_app(self, action, param):
58 | self.quit()
59 |
60 | def create_action(self, name, callback, shortcuts=None):
61 | action = Gio.SimpleAction.new(name=name, parameter_type=None)
62 | action.connect('activate', callback)
63 | self.add_action(action=action)
64 | if shortcuts:
65 | self.set_accels_for_action(
66 | detailed_action_name=f'app.{name}',
67 | accels=shortcuts,
68 | )
69 |
70 |
71 | if __name__ == '__main__':
72 | app = ExampleApplication()
73 | app.run(sys.argv)
74 |
--------------------------------------------------------------------------------
/src/libadwaita-widgets/clamp/ui/MainWindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | Python - PyGObject - GTK
11 | 683
12 | 384
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | 1
23 | 12
24 |
25 |
26 | 0
27 |
30 |
31 |
32 | Python - PyGObject - GTK
33 |
34 |
35 |
36 |
37 | Python - PyGObject - GTK
38 |
39 |
40 |
41 |
42 | Python - PyGObject - GTK
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/src/gtk-widgets/flow-box/ui/MainWindow.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """Python - PyGObject - GTK."""
3 |
4 | import pathlib
5 | import sys
6 |
7 | import gi
8 |
9 | gi.require_version(namespace='Gtk', version='4.0')
10 |
11 | from gi.repository import Gio, Gtk
12 |
13 | BASE_DIR = pathlib.Path(__file__).resolve().parent
14 | BLP_FILE = BASE_DIR / 'MainWindow.blp'
15 | UI_FILE = BASE_DIR / 'MainWindow.ui'
16 |
17 | sys.path.append(str(BASE_DIR.parent.parent.parent / 'scripts'))
18 |
19 | from blp import blp_to_ui
20 |
21 | blp_to_ui(file=BLP_FILE)
22 |
23 |
24 | @Gtk.Template(filename=UI_FILE)
25 | class ExampleWindow(Gtk.ApplicationWindow):
26 | __gtype_name__ = 'ExampleWindow'
27 |
28 | def __init__(self, **kwargs):
29 | super().__init__(**kwargs)
30 |
31 |
32 | class ExampleApplication(Gtk.Application):
33 | def __init__(self):
34 | super().__init__(
35 | application_id='br.com.justcode.Gtk',
36 | flags=Gio.ApplicationFlags.DEFAULT_FLAGS,
37 | )
38 |
39 | self.create_action('quit', self.exit_app, ['q'])
40 | self.create_action('preferences', self.on_preferences_action)
41 |
42 | def do_activate(self):
43 | win = self.props.active_window
44 | if not win:
45 | win = ExampleWindow(application=self)
46 | win.present()
47 |
48 | def do_startup(self):
49 | Gtk.Application.do_startup(self)
50 |
51 | def do_shutdown(self):
52 | Gtk.Application.do_shutdown(self)
53 |
54 | def on_preferences_action(self, action, param):
55 | print('Action `app.preferences` was active.')
56 |
57 | def exit_app(self, action, param):
58 | self.quit()
59 |
60 | def create_action(self, name, callback, shortcuts=None):
61 | action = Gio.SimpleAction.new(name=name, parameter_type=None)
62 | action.connect('activate', callback)
63 | self.add_action(action=action)
64 | if shortcuts:
65 | self.set_accels_for_action(
66 | detailed_action_name=f'app.{name}',
67 | accels=shortcuts,
68 | )
69 |
70 |
71 | if __name__ == '__main__':
72 | app = ExampleApplication()
73 | app.run(sys.argv)
74 |
--------------------------------------------------------------------------------
/src/gtk-widgets/grid/ui/MainWindow.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """Python - PyGObject - GTK."""
3 |
4 | import pathlib
5 | import sys
6 |
7 | import gi
8 |
9 | gi.require_version(namespace='Gtk', version='4.0')
10 |
11 | from gi.repository import Gio, Gtk
12 |
13 | BASE_DIR = pathlib.Path(__file__).resolve().parent
14 | BLP_FILE = BASE_DIR / 'MainWindow.blp'
15 | UI_FILE = BASE_DIR / 'MainWindow.ui'
16 |
17 | sys.path.append(str(BASE_DIR.parent.parent.parent / 'scripts'))
18 |
19 | from blp import blp_to_ui
20 |
21 | blp_to_ui(file=BLP_FILE)
22 |
23 |
24 | @Gtk.Template(filename=UI_FILE)
25 | class ExampleWindow(Gtk.ApplicationWindow):
26 | __gtype_name__ = 'ExampleWindow'
27 |
28 | def __init__(self, **kwargs):
29 | super().__init__(**kwargs)
30 |
31 |
32 | class ExampleApplication(Gtk.Application):
33 | def __init__(self):
34 | super().__init__(
35 | application_id='br.com.justcode.Gtk',
36 | flags=Gio.ApplicationFlags.DEFAULT_FLAGS,
37 | )
38 |
39 | self.create_action('quit', self.exit_app, ['q'])
40 | self.create_action('preferences', self.on_preferences_action)
41 |
42 | def do_activate(self):
43 | win = self.props.active_window
44 | if not win:
45 | win = ExampleWindow(application=self)
46 | win.present()
47 |
48 | def do_startup(self):
49 | Gtk.Application.do_startup(self)
50 |
51 | def do_shutdown(self):
52 | Gtk.Application.do_shutdown(self)
53 |
54 | def on_preferences_action(self, action, param):
55 | print('Action `app.preferences` was active.')
56 |
57 | def exit_app(self, action, param):
58 | self.quit()
59 |
60 | def create_action(self, name, callback, shortcuts=None):
61 | action = Gio.SimpleAction.new(name=name, parameter_type=None)
62 | action.connect('activate', callback)
63 | self.add_action(action=action)
64 | if shortcuts:
65 | self.set_accels_for_action(
66 | detailed_action_name=f'app.{name}',
67 | accels=shortcuts,
68 | )
69 |
70 |
71 | if __name__ == '__main__':
72 | app = ExampleApplication()
73 | app.run(sys.argv)
74 |
--------------------------------------------------------------------------------
/src/gtk-widgets/overlay/ui/MainWindow.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """Python - PyGObject - GTK."""
3 |
4 | import pathlib
5 | import sys
6 |
7 | import gi
8 |
9 | gi.require_version(namespace='Gtk', version='4.0')
10 |
11 | from gi.repository import Gio, Gtk
12 |
13 | BASE_DIR = pathlib.Path(__file__).resolve().parent
14 | BLP_FILE = BASE_DIR / 'MainWindow.blp'
15 | UI_FILE = BASE_DIR / 'MainWindow.ui'
16 |
17 | sys.path.append(str(BASE_DIR.parent.parent.parent / 'scripts'))
18 |
19 | from blp import blp_to_ui
20 |
21 | blp_to_ui(file=BLP_FILE)
22 |
23 |
24 | @Gtk.Template(filename=UI_FILE)
25 | class ExampleWindow(Gtk.ApplicationWindow):
26 | __gtype_name__ = 'ExampleWindow'
27 |
28 | def __init__(self, **kwargs):
29 | super().__init__(**kwargs)
30 |
31 |
32 | class ExampleApplication(Gtk.Application):
33 | def __init__(self):
34 | super().__init__(
35 | application_id='br.com.justcode.Gtk',
36 | flags=Gio.ApplicationFlags.DEFAULT_FLAGS,
37 | )
38 |
39 | self.create_action('quit', self.exit_app, ['q'])
40 | self.create_action('preferences', self.on_preferences_action)
41 |
42 | def do_activate(self):
43 | win = self.props.active_window
44 | if not win:
45 | win = ExampleWindow(application=self)
46 | win.present()
47 |
48 | def do_startup(self):
49 | Gtk.Application.do_startup(self)
50 |
51 | def do_shutdown(self):
52 | Gtk.Application.do_shutdown(self)
53 |
54 | def on_preferences_action(self, action, param):
55 | print('Action `app.preferences` was active.')
56 |
57 | def exit_app(self, action, param):
58 | self.quit()
59 |
60 | def create_action(self, name, callback, shortcuts=None):
61 | action = Gio.SimpleAction.new(name=name, parameter_type=None)
62 | action.connect('activate', callback)
63 | self.add_action(action=action)
64 | if shortcuts:
65 | self.set_accels_for_action(
66 | detailed_action_name=f'app.{name}',
67 | accels=shortcuts,
68 | )
69 |
70 |
71 | if __name__ == '__main__':
72 | app = ExampleApplication()
73 | app.run(sys.argv)
74 |
--------------------------------------------------------------------------------