Source

vlocity-vinstall-gambas / Vlocity / Step7b.class

' Gambas class file

'    This file is part of vinstall-ng

'    vinstall-ng is free software: you can redistribute it and/or modify
'    it under the terms of the GNU General Public License as published by
'    the Free Software Foundation, either version 2 of the License, or
'    (at your option) any later version.

'    vinstall-ng  is distributed in the hope that it will be useful,
'    but WITHOUT ANY WARRANTY; without even the implied warranty of
'    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
'    GNU General Public License for more details.

'    You should have received a copy of the GNU General Public License
'    along with vinstall-ng.  If not, see <http://www.gnu.org/licenses/>.

PRIVATE PicYes AS Picture
PRIVATE PicNo AS Picture

PUBLIC SUB Form_Open()

  ME.tlbanner.Text = "<h2>" & ("Customize Your") & Space(1) & Main.Install.Name & Space(1) & ("Installation") & "</h2>"
  
  ME.btTglSel.Width = MdlObjSizer.get_object_width(ME.btTglSel.Text) + 48
    ME.gvOptions.Rows.count = 1
    ME.gvOptions.Columns.count = 3
    gvOptions.Columns[1].Text = ("Package Name")
    gvOptions.Columns[0].Width = 48
    gvOptions.Columns[2].Text = ("Description")

    
    'ME.Resize(ClsGlobal.fRunningMainForm.pnlstack.Width, ClsGlobal.fRunningMainForm.pnlstack.height)
    picYes = Picture.Load("images/16px-check.png")
    picNo = Picture.Load("images/16px-Nocheck.png")
    ME.MovieBox1.Path = "images/throbber.gif"
    
    WAIT 1
    ME.LIST_OPTIONAL_PACKAGES()  
    
    HPanel2.Visible = FALSE
    Panel1.Height = ME.ClientH - (HBox5.Height * 1.5) - Panel1.Top
    'clean up the grid
     REPEAT 
      IF gvOptions[gvOptions.Rows.Count - 1, 1].Text = "" THEN DEC gvOptions.Rows.Count
    UNTIL gvOptions[gvOptions.Rows.Count - 1, 1].Text <> ""

END




PUBLIC SUB LIST_OPTIONAL_PACKAGES()
  
  DIM irow, i AS Integer
  DIM sDescDump, sFile, sLine, sPkg, sDesc, sShortDesc AS String
  DIM sArr, sDescArr AS String[]
  
  'ME.Panel1.Visible = FALSE
  ME.tlWinExp.Text = ("Reading software catalog... Please wait a moment")
  ME.Panel1.Visible = FALSE
  ME.HPanel2.Visible = TRUE
  ME.HBox3.Visible = FALSE
  ME.HBox5.Visible = TRUE
  ME.MovieBox1.Playing = TRUE
  WAIT 0.1
  'irow = 2
  
    IF Exist("/mnt/source/veclinux/OPTIONAL") = FALSE THEN RETURN 
    sArr = Split(File.Load("/mnt/source/veclinux/OPTIONAL"), "\n")
      FOR i = 0 TO sArr.Max
      ME.MovieBox1.Playing = TRUE
      ME.MovieBox1.Refresh
        sLine = Trim(sArr[i])
        sPkg = Trim(sLine)
     IF sPkg THEN 
        SHELL "cat /mnt/source/PACKAGES.TXT | grep -i \"^" & sPkg & "\" | cut -f 2 -d :" TO sDescDump
          sDescDump = Trim(sDescDump)
          IF sDescDump THEN 
            sDescArr = Split(sDescDump, "\n")
            sShortDesc = Trim(sDescArr[0])
            sShortDesc = Replace(sShortDesc, sPkg, "")
            sShortDesc = Replace(sShortDesc, "(", "")
            sShortDesc = Replace(sShortDesc, ")", "")
            sShortDesc = Trim(sShortDesc)
            sShortDesc = UCase(Left(sShortDesc, 1)) & Right(sShortDesc, Len(sShortDesc) - 1)
            sDesc = Trim(sDescDump)
          ELSE 
            sShortDesc = ""
            sDesc = ""
          END IF
          WAIT 0.1
      'Message(sPkg & "<br><br>" & sShortDesc)
        gvOptions[irow, 0].Picture = PicYes
        gvOptions[irow, 0].Alignment = Align.Center
        gvOptions[irow, 1].Text = sPkg
        gvOptions[irow, 2].Text = Trim(sShortDesc)
        'gvOptions[irow, 3].Text = Trim(sDesc)
        'gvOptions[irow, 4].Text = "yes"
        INC irow
        INC gvOptions.Rows.Count
      END IF
      NEXT 
          
    ME.MovieBox1.Playing = FALSE
    ME.HPanel2.Visible = FALSE
    ME.Panel1.Visible = TRUE
    ME.HBox3.Visible = TRUE
    ME.HBox5.Visible = FALSE
    ME.tlWinExp.Text = ("Additional optional software available. Select which software packages to include in your installation.")
    'ME.Cleanup_PkgOptions()
    'IF gvOptions[gvOptions.Rows.Count, 1].Text = "" THEN DEC gvOptions.Rows.Count
  
END


PUBLIC SUB OnExit()
  
  Read_Optional_Pkg_Selection()
  
  'Message(ClsGlobal.sPkgListToInstall)
  
END
PUBLIC SUB StartUp()
  
  ME.Resize(ClsGlobal.fRunningMainForm.pnlstack.Width, ClsGlobal.fRunningMainForm.pnlstack.height)
  
END
PUBLIC FUNCTION GetNext() AS String
  
  IF Main.SelectedSrc.MultiDisk = FALSE THEN RETURN "Step8"
  IF Main.SelectedSrc.MultiDisk = TRUE THEN RETURN "Step7c" ' Display the contents of cd2
  
END



PUBLIC SUB TOGGLE_SELECTION(BsELECTaLL AS Boolean)
  
  DIM irow AS Integer
  IF BsELECTaLL = TRUE THEN 
    FOR irow = 0 TO gvOptions.Rows.Count - 1
      gvOptions[irow, 0].Picture = PicYes
      'gvOptions[irow, 4].Text = "yes"
    NEXT 
  ELSE 
    FOR irow = 0 TO gvOptions.Rows.Count - 1
      gvOptions[irow, 0].Picture = PicNo
      'gvOptions[irow, 4].Text = "no"
    NEXT 
  END IF
  
END


PUBLIC SUB gvOptions_Click()

'if LAST.row < 2 THEN RETURN 
'IF LAST.row = 0 OR LAST.row = 1 THEN RETURN  
IF gvOptions[LAST.row, 1].Text = "" THEN RETURN 
'IF LAST.column = 0 OR LAST.column = 1 THEN 
  IF gvOptions[LAST.row, 0].Picture = PicYes THEN 
    gvOptions[LAST.row, 0].Picture = PicNo
    'gvOptions[LAST.row, 4].Text = "no"
  ELSE 
    gvOptions[LAST.row, 0].Picture = PicYes
    'gvOptions[LAST.row, 4].Text = "yes"
  END IF
' ELSE 
'   RETURN 
'   STOP EVENT 
' END IF

gvOptions.Refresh
END

PUBLIC SUB btTglSel_Click()

  IF LAST.text = ("Un-Select All") THEN 
    ME.TOGGLE_SELECTION(FALSE)
    ME.btTglSel.Text = ("Select All")
  ELSE 
    ME.TOGGLE_SELECTION(TRUE)
    ME.btTglSel.Text = ("Un-Select All")
  END IF
  gvOptions.Refresh
  LAST.Width = MdlObjSizer.get_object_width(LAST.text) + 48

END

PUBLIC SUB Read_Optional_Pkg_Selection()
  
  DIM IROW AS Integer
  DIM sList AS String
  
  Main.Install.Packages.Clear()
  ClsGlobal.sPkgListToInstall = ""
  FOR irow = 0 TO gvOptions.Rows.count - 1
    'IF gvOptions[irow, 4].Text LIKE "yes" THEN 
    IF gvOptions[irow, 0].Picture = PicYes THEN 
      sList = sList & Trim(gvOptions[irow, 1].Text) & ","
      Main.Install.Packages.Add(gvOptions[irow, 1].Text)
    END IF
  NEXT 
  ClsGlobal.sPkgListToInstall = Trim(sList)
      
  
END



PUBLIC SUB HPanel2_MouseDown()

  

END
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.