Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
food-plan-hs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Felix Drees
food-plan-hs
Commits
d2c07786
Commit
d2c07786
authored
2 years ago
by
felix
Browse files
Options
Downloads
Patches
Plain Diff
add comboBox helper and updated submit button
parent
fa4a4c8c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/Main.hs
+32
-24
32 additions, 24 deletions
app/Main.hs
food-plan-hs.cabal
+3
-0
3 additions, 0 deletions
food-plan-hs.cabal
package.yaml
+1
-0
1 addition, 0 deletions
package.yaml
with
36 additions
and
24 deletions
app/Main.hs
+
32
−
24
View file @
d2c07786
...
...
@@ -11,9 +11,14 @@ module Main (main) where
import
qualified
GI.Gtk
as
Gtk
import
Data.GI.Base
()
import
Data.Text
(
Text
)
import
Data.Maybe
import
LibUniHbMensa
as
UM
mensaList
::
[
String
]
------ CONST VARS ------------------------------------------------------------
mensaList
::
[
Text
]
mensaList
=
[
"Uni Mensa"
,
"Mensa NW1"
,
"Cafeteria GW2"
,
...
...
@@ -26,14 +31,24 @@ mensaList = ["Uni Mensa",
"Interimsmensa HfK"
]
{- TODO ...
------ HELPER FUNCs ----------------------------------------------------------
comboBoxHelper :: Gtk.ComboBoxText -> [String] -> IO ()
comboBoxHelper
::
Gtk
.
ComboBoxText
->
[
Text
]
->
IO
()
comboBoxHelper
_
[]
=
return
()
comboBoxHelper
comBox
strList
=
do
Gtk
.
comboBoxTextAppendText
comBox
$
head
strList
-- TODO comboBoxHelper mit den verbleibenden strings rec aufrufen ...
comboBoxHelper
comBox
$
tail
strList
getMensaIdByText
::
Maybe
Text
->
Int
getMensaIdByText
name
|
(
isJust
name
)
=
getMensaIdByTextRec
(
fromJust
name
)
0
|
otherwise
=
0
-- default id = 0 for Uni Mensa
where
getMensaIdByTextRec
::
Text
->
Int
->
Int
getMensaIdByTextRec
eman
i
|
(
eman
==
(
mensaList
!!
i
))
=
i
|
otherwise
=
getMensaIdByTextRec
eman
(
i
+
1
)
-}
main
::
IO
()
main
=
do
...
...
@@ -58,37 +73,30 @@ main = do
-- SELECT DINING HALL -----------------------------------------------------
cb
<-
Gtk
.
comboBoxTextNew
-- TODO comboBoxHelper cb mensaList
Gtk
.
comboBoxTextAppendText
cb
"Uni Mensa"
Gtk
.
comboBoxTextAppendText
cb
"Mensa NW1"
Gtk
.
comboBoxTextAppendText
cb
"Cafeteria GW2"
Gtk
.
comboBoxTextAppendText
cb
"Cafeteria Grazer Straße"
Gtk
.
comboBoxTextAppendText
cb
"Mensa Neustadtswall"
Gtk
.
comboBoxTextAppendText
cb
"Mensa Werderstraße"
Gtk
.
comboBoxTextAppendText
cb
"Mensa Airport"
Gtk
.
comboBoxTextAppendText
cb
"Mensa Bremerhaven"
Gtk
.
comboBoxTextAppendText
cb
"Cafeteria Bremerhaven"
Gtk
.
comboBoxTextAppendText
cb
"Interimsmensa HfK"
comboBoxHelper
cb
mensaList
Gtk
.
comboBoxSetActive
cb
0
-- SUBMIT BUTTON ----------------------------------------------------------
submit_btn
<-
Gtk
.
buttonNewWithLabel
"Angebot darstellen"
-- VIEW MEAL PLAN
Gtk
.
buttonSetRelief
submit_btn
Gtk
.
ReliefStyleNone
Gtk
.
widgetSetHexpand
submit_btn
False
-- TODO show selected meal plan when button is clicked ...
-- on submit_btn #clicked $ do
_
<-
Gtk
.
on
submit_btn
#
clicked
$
do
-- TODO ...
-- currentMensaId <- getMensaIdByText $ Gtk.comboBoxTextGetActiveText cb
-- foodPlanPage <- UM.getMensaWebpage currentMensaId -- food plan webpage of selected dining hall
putStrLn
"SUBMIT BUTTON CLICKED: "
-- ++ foodPlanPage
-- TODO display food plan info
-- PLACE OBJECTS IN A GRID ON THE WINDOW ----------------------------------
grid
<-
Gtk
.
gridNew
Gtk
.
gridSetColumnSpacing
grid
1
Gtk
.
gridSetRowSpacing
grid
3
Gtk
.
gridSetColumnSpacing
grid
1
0
Gtk
.
gridSetRowSpacing
grid
20
Gtk
.
gridSetColumnHomogeneous
grid
True
#
attach
grid
heding
0
0
1
1
...
...
This diff is collapsed.
Click to expand it.
food-plan-hs.cabal
+
3
−
0
View file @
d2c07786
...
...
@@ -39,6 +39,7 @@ library
, haskell-gi-base
, http-client
, http-client-tls
, text
default-language: Haskell2010
executable food-plan-hs-exe
...
...
@@ -56,6 +57,7 @@ executable food-plan-hs-exe
, haskell-gi-base
, http-client
, http-client-tls
, text
default-language: Haskell2010
test-suite food-plan-hs-test
...
...
@@ -74,4 +76,5 @@ test-suite food-plan-hs-test
, haskell-gi-base
, http-client
, http-client-tls
, text
default-language: Haskell2010
This diff is collapsed.
Click to expand it.
package.yaml
+
1
−
0
View file @
d2c07786
...
...
@@ -26,6 +26,7 @@ dependencies:
-
haskell-gi-base
-
http-client
-
http-client-tls
-
text
ghc-options
:
-
-Wall
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment