Add GUI skeleton based on gi-gtk-declarative.

This commit is contained in:
Robbie Gleichman 2020-06-11 00:17:50 -07:00
parent 9817343f35
commit 37340ed4fe
6 changed files with 34 additions and 2 deletions

View File

@ -17,7 +17,7 @@ sudo apt install graphviz
Then build and execute glance:
```
stack build
stack build :glance-exe
stack exec glance-exe -- examples/fact.hs images/fact.svg 500
```
To see the command line options run

View File

@ -7,7 +7,7 @@ license: Apache-2.0
license-file: LICENSE
author: Robbie Gleichman
maintainer: rgleichman@gmail.com
copyright: 2018 Robbie Gleichman
copyright: 2020 Robbie Gleichman
category: Visual Programming
build-type: Simple
-- extra-source-files:
@ -57,6 +57,24 @@ executable glance-exe
, SimplifySyntax
, Constants
executable glance-gui
hs-source-dirs: gui
main-is: Main.hs
ghc-options: -threaded -rtsopts -with-rtsopts=-N
-Wall
-Wincomplete-record-updates
-Wmissing-export-lists
-Widentities
-Wpartial-fields
build-depends: base
, gi-gtk
, gi-gtk-declarative
, gi-gtk-declarative-app-simple
, text
, pipes
, pipes-extras
default-language: Haskell2010
test-suite glance-test
type: exitcode-stdio-1.0
hs-source-dirs: test, app

4
gui/Main.hs Normal file
View File

@ -0,0 +1,4 @@
module Main (main) where
main :: IO ()
main = putStrLn "Glance GUI!"

View File

@ -24,3 +24,8 @@ stack haddock --open <package-name>
To build and run in a loop
watch -n2 stack build --exec \"glance-exe examples/fact.hs examples/fact.svg 500\"
GUI:
To build the GUI, first install the system dependencies (follow the directions
here: https://github.com/haskell-gi/haskell-gi#installation)

View File

@ -10,6 +10,8 @@ packages:
# Packages to be pulled from upstream that are not in the resolver (e.g., acme-missiles-0.3)
extra-deps: [
"diagrams-graphviz-1.4.1.1"
, "gi-gtk-declarative-0.6.3"
, "gi-gtk-declarative-app-simple-0.6.3"
]
# Override default flag values for local packages and extra-deps

View File

@ -1,6 +1,9 @@
# Todo
## Todo Now
* Make a GUI. One approach is to render individual icons with diagrams using the
Cairo or GTK backend. The rendering would be in a separate process so that
interacting and dragging nodes is not slowed down by rendering.
* Redesign case icon to avoid non-locality.
* Move @ pattern circles so that they are on the same side as the variables.
* Add command line flags for color style, embedding, and whether to draw arrowheads.