Initial Commit
authorHarishankar <v.harishankar@gmail.com>
Tue, 23 Oct 2018 16:17:19 +0000 (21:47 +0530)
committerHarishankar <v.harishankar@gmail.com>
Tue, 23 Oct 2018 16:17:19 +0000 (21:47 +0530)
First commit

ResumeBuilder [new file with mode: 0755]
resumebuilder.glade [new file with mode: 0644]
resumebuilder.go [new file with mode: 0644]

diff --git a/ResumeBuilder b/ResumeBuilder
new file mode 100755 (executable)
index 0000000..c4c2cbf
Binary files /dev/null and b/ResumeBuilder differ
diff --git a/resumebuilder.glade b/resumebuilder.glade
new file mode 100644 (file)
index 0000000..1a6d5b6
--- /dev/null
@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
+<interface>
+  <requires lib="gtk+" version="3.20"/>
+  <object class="GtkWindow" id="MainWindow">
+    <property name="name">MainWindow</property>
+    <property name="can_focus">False</property>
+    <property name="window_position">center-on-parent</property>
+    <child>
+      <placeholder/>
+    </child>
+    <child>
+      <object class="GtkNotebook">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <child>
+          <object class="GtkFixed">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <child>
+              <object class="GtkEntry" id="FirstName">
+                <property name="width_request">225</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="input_purpose">name</property>
+              </object>
+              <packing>
+                <property name="x">221</property>
+                <property name="y">11</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">First name</property>
+              </object>
+              <packing>
+                <property name="x">37</property>
+                <property name="y">18</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Last name</property>
+              </object>
+              <packing>
+                <property name="x">37</property>
+                <property name="y">57</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="LastName">
+                <property name="width_request">225</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="input_purpose">name</property>
+              </object>
+              <packing>
+                <property name="x">221</property>
+                <property name="y">50</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Sex</property>
+              </object>
+              <packing>
+                <property name="x">37</property>
+                <property name="y">132</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkRadioButton" id="Male">
+                <property name="label" translatable="yes">Male</property>
+                <property name="width_request">59</property>
+                <property name="height_request">24</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="active">True</property>
+                <property name="draw_indicator">True</property>
+              </object>
+              <packing>
+                <property name="x">151</property>
+                <property name="y">131</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkRadioButton" id="Female">
+                <property name="label" translatable="yes">Female</property>
+                <property name="width_request">75</property>
+                <property name="height_request">24</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="active">True</property>
+                <property name="draw_indicator">True</property>
+                <property name="group">Male</property>
+              </object>
+              <packing>
+                <property name="x">222</property>
+                <property name="y">131</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkRadioButton">
+                <property name="label" translatable="yes">Other</property>
+                <property name="width_request">65</property>
+                <property name="height_request">25</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="active">True</property>
+                <property name="draw_indicator">True</property>
+                <property name="group">Male</property>
+              </object>
+              <packing>
+                <property name="x">303</property>
+                <property name="y">131</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Age</property>
+              </object>
+              <packing>
+                <property name="x">37</property>
+                <property name="y">97</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="Age">
+                <property name="width_request">50</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="input_purpose">digits</property>
+              </object>
+              <packing>
+                <property name="x">220</property>
+                <property name="y">89</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="SaveButton">
+                <property name="label" translatable="yes">Save</property>
+                <property name="width_request">130</property>
+                <property name="height_request">34</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+              </object>
+              <packing>
+                <property name="x">307</property>
+                <property name="y">168</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="tab_fill">False</property>
+          </packing>
+        </child>
+        <child type="tab">
+          <object class="GtkLabel">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">Basic Details</property>
+          </object>
+          <packing>
+            <property name="tab_fill">False</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkFixed">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+          </object>
+          <packing>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child type="tab">
+          <object class="GtkLabel">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">Education</property>
+          </object>
+          <packing>
+            <property name="position">1</property>
+            <property name="tab_fill">False</property>
+          </packing>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child type="tab">
+          <placeholder/>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/resumebuilder.go b/resumebuilder.go
new file mode 100644 (file)
index 0000000..cc78373
--- /dev/null
@@ -0,0 +1,97 @@
+package main
+
+import (
+       "fmt"
+       "os"
+
+       "github.com/gotk3/gotk3/gtk"
+)
+
+type Applicant struct {
+       FirstName string
+       LastName  string
+       Age       int
+       Sex       Sex
+       Education []Education
+}
+
+type Education struct {
+       SchoolName     string
+       YearOfPassing  int
+       PassPercentage float32
+}
+
+type Sex int
+
+const (
+       Male   Sex = 1
+       Female     = 2
+       Other      = 3
+)
+
+/* func SaveToJson(a *Applicant) {
+       b, err := json.Marshal(a)
+
+       if err != nil {
+               fmt.Println(err.Error())
+               os.Exit(2)
+       }
+       err = ioutil.WriteFile("test.json", b, 0644)
+       if err != nil {
+               fmt.Println(err.Error())
+               os.Exit(3)
+       }
+} */
+
+func getWindow(ui gtk.Builder) (*gtk.Window, error) {
+       obj, err := ui.GetObject("MainWindow")
+       if err != nil {
+               fmt.Println(err.Error())
+               return nil, err
+       }
+       wnd, ok := obj.(*gtk.Window)
+       if !ok {
+               return nil, err
+       }
+       return wnd, nil
+}
+
+func LoadMain() {
+       gtk.Init(nil)
+       ui, err := gtk.BuilderNewFromFile("resumebuilder.glade")
+       if err != nil {
+               fmt.Println(err.Error())
+               os.Exit(1)
+       }
+
+       wnd, err := getWindow(*ui)
+       if err != nil {
+               os.Exit(1)
+       }
+
+       btnobj, err := ui.GetObject("SaveButton")
+       if err != nil {
+               fmt.Println(err.Error())
+               os.Exit(1)
+       }
+       btn, ok := btnobj.(*gtk.Button)
+       if !ok {
+               os.Exit(1)
+       }
+       btn.Connect("clicked", SaveButtonClicked)
+       wnd.SetTitle("Resume Builder")
+       wnd.ShowAll()
+
+       wnd.Connect("destroy", func() {
+               gtk.MainQuit()
+       })
+       gtk.Main()
+}
+
+func SaveButtonClicked() {
+
+}
+
+func main() {
+       LoadMain()
+}