commit fd73ee5bb8cb23497382a63b5063424573390f86
parent 01717494f13e40a78eddc34640df5b192eade471
Author: Nick Econopouly <wry@mm.st>
Date: Tue, 17 Mar 2020 13:51:07 -0400
Begin building mainBox() with the main UI elements
Diffstat:
M | main.go | | | 67 | +++++++++++++++++++++++++++++++++++++++++++++++++++++-------------- |
A | style.css | | | 33 | +++++++++++++++++++++++++++++++++ |
2 files changed, 86 insertions(+), 14 deletions(-)
diff --git a/main.go b/main.go
@@ -6,6 +6,7 @@ import (
"log"
"path/filepath"
"strings"
+ "bytes"
"github.com/360EntSecGroup-Skylar/excelize"
"github.com/knieriem/odf/ods"
"encoding/csv"
@@ -33,7 +34,7 @@ func windowSetup() *gtk.Window {
window.SetName("main-window") // for css selector
- // set up css stylesheet
+ // set up css stylesheet
screen, err := gdk.ScreenGetDefault()
if err != nil {
log.Fatal("can't get default screen")
@@ -209,25 +210,63 @@ func main() {
window := windowSetup()
- mergeButton, err := gtk.ButtonNewWithLabel("Merge Datasets!")
- if err != nil {
- log.Fatal("Unable to create mergeButton", err)
- }
+ window.Add(mainBox())
- _, err = mergeButton.Connect("clicked", func() {
- // export dataset
- exportDataset(&dataset, "merged.xlsx")
- })
+ window.ShowAll()
+ gtk.Main()
+}
+func mainBox() *gtk.Box {
// store everything in a grid
- mainBox, err := gtk.BoxNew(gtk.ORIENTATION_VERTICAL, 5)
+ topBox, err := gtk.BoxNew(gtk.ORIENTATION_VERTICAL, 5)
if err != nil {
log.Fatal("Unable to create grid: ", err)
}
- mainBox.PackStart(mergeButton, false, false, 0)
- window.Add(mainBox)
- window.ShowAll()
- gtk.Main()
+ // Add new datasets
+ topBox.PackStart(newHeadline("Add datasets:"), false, false, 0)
+
+ datasetList, err := gtk.ListBoxNew()
+ datasetList.Insert(newLabel("testing datasetList"), 0)
+ datasetList.Insert(newLabel("testing datasetList poop"), 0)
+
+ topBox.PackStart(datasetList,false, false, 0)
+
+
+ mergeButton, err := gtk.ButtonNewWithLabel("Merge Datasets!")
+ if err != nil {
+ log.Fatal("Unable to create mergeButton", err)
+ }
+ topBox.PackStart(mergeButton, false, false, 0)
+ // _, err = mergeButton.Connect("clicked", func() {
+ // // export dataset
+ // exportDataset(&dataset, "merged.xlsx")
+ // })
+
+ return topBox
}
+func newHeadline(s string) *gtk.Label {
+ if len(s) < 115 {
+ var b bytes.Buffer
+
+ for i := len(s); i < 115; i++ {
+ b.WriteString(" ")
+ }
+ s += b.String()
+ }
+ l := newLabel(s)
+ style, err := l.GetStyleContext()
+ if err != nil {
+ log.Fatal("error getting style context")
+ }
+ style.AddClass("section-title")
+ return l
+}
+func newLabel(s string) *gtk.Label {
+ l, err := gtk.LabelNew(s)
+ if err != nil {
+ log.Fatal("Unable to create label",s,":", err)
+ }
+ return l
+}
diff --git a/style.css b/style.css
@@ -0,0 +1,33 @@
+* {
+ /* font-size: 110%; */
+}
+
+#main-window {
+ background-color: #fffff8;
+ color: #333333;
+}
+#main-grid {
+ padding: 10px;
+ /* border-style: solid; */
+ /* border-color: #000000; */
+ /* outline-color: #000000; */
+ /* outline-style: solid; */
+ /* outline-width: 1px; */
+ border: 5px solid #1C6EA4;
+ /* margin: 5px; */
+
+}
+
+/* subsections */
+grid grid {
+ /* background-color: #dddddd; */
+}
+/* section titles */
+.section-title {
+ font-weight: bold;
+ background-color: #b3b3b3;
+}
+.subheadline {
+ font-weight: normal;
+ background-color: #dddddd
+}