Skip to content

Commit

Permalink
refactor: started work on move updateModulesInfo to Nim
Browse files Browse the repository at this point in the history
FossilOrigin-Name: 918a9cfda852848df0890c45a22bd16fe2423565c0c13173ef74a91007fc7495
  • Loading branch information
thindil committed Nov 19, 2023
1 parent 1009ea6 commit e4fb167
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion nim/src/steamsky.nim
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import game, log, tk
import goals, help, mobs, shipmodules, ships, basescargo, crew, events,
missions, stories, bases, combat, crew2, events2, missions2, basestrade,
basesship2
import ui/[utilsui, table]
import ui/[utilsui, table, shipsuimodules]

proc steamsky(params: cstring): PInterp {.exportc, raises: [TclError, IOError,
OSError, ValueError], tags: [ReadIOEffect, RootEffect].} =
Expand Down
30 changes: 30 additions & 0 deletions nim/src/ui/shipsuimodules.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2023 Bartek thindil Jasicki
#
# This file is part of Steam Sky.
#
# Steam Sky 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 3 of the License, or
# (at your option) any later version.
#
# Steam Sky 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 Steam Sky. If not, see <http://www.gnu.org/licenses/>.

import coreui, table

var modulesTable: TableWidget

proc updateModulesInfo*(page: Positive = 1) =
let
shipCanvas = mainPaned & ".shipinfoframe.modules.canvas"
shipInfoFrame = shipCanvas & ".frame"
if modulesTable.rowHeight == 1:
modulesTable = createTable(parent = shipInfoFrame, headers = @["Name",
"Durability", "Additional info"], scrollbar = mainPaned &
".shipinfoframe.modules.scrolly", command = "SortShipModules",
tooltipText = "Press mouse button to sort the modules.")

0 comments on commit e4fb167

Please sign in to comment.