예제 #1
0
    def onCloseSaveEntry(self):
        if self.hasActiveEntry:

            #Save first
            FsUtils.save_book(self.activeBook)

            #Clear ui
            self.setUiInactive()
예제 #2
0
    def __init__(self, *args, **kwargs):
        super(MainWindow, self).__init__(*args, **kwargs)

        uic.loadUi(FsUtils.get_resource("/ui/mainwindow.ui"), self)
        FsUtils.load_settings()

        self._book: BookEntry = None
        self._cost: Cost = None
        self._hasActiveEntry = False

        self.setupSlots()

        self.setUiInactive()
예제 #3
0
    def showBooks(self, item):

        if item.text() == "New Batch":
            self.batch_id: int = FsUtils.get_new_batch_id()
        else:
            self.batch_id: int = item.text()
        while self.booksList.count() > 0:
            self.booksList.takeItem(0)
        books = [
            n.replace(".json", "")
            for n in FsUtils.get_books_in_batch(self.batch_id)
        ]

        self.booksList.addItems(books)
예제 #4
0
    def __init__(self, parent, active_book):
        super().__init__(parent)
        uic.loadUi(FsUtils.get_resource("/ui/bookmove.ui"), self)
        self.accepted.connect(self.moveBook)
        self.bookSelected = None
        self.book_id = None
        self.batch_id = None
        self.active_book = active_book

        batches = FsUtils.get_batches()
        if batches is not None:
            batches.append("New Batch")
            self.batchesList.addItems(batches)

        self.batchesList.itemClicked.connect(self.showBooks)
        self.booksList.itemClicked.connect(self.loadBook)
예제 #5
0
    def __init__(self, parent):
        super().__init__(parent)
        self.main = parent
        uic.loadUi(FsUtils.get_resource("/ui/bookbrowser.ui"), self)
        self.accepted.connect(self.openBook)
        self.bookSelected = None
        self.book_id = None
        self.batch_id = None
        """
        discover all batches in the main directory
        """
        batches = FsUtils.get_batches()
        if batches is not None:
            self.batchesList.addItems(batches)

        self.batchesList.itemClicked.connect(self.showBooks)
        self.booksList.itemClicked.connect(self.loadBook)
예제 #6
0
 def showBooks(self, item):
     self.batch_id: int = item.text()
     while self.booksList.count() > 0:
         self.booksList.takeItem(0)
     books = [
         n.replace(".json", "")
         for n in FsUtils.get_books_in_batch(item.text())
     ]
     self.booksList.addItems(books)
예제 #7
0
 def loadBook(self, item):
     """
     show the book entries
     """
     self.book_id = item.text()
     self.bookSelected = FsUtils.get_book(self.book_id, self.batch_id)
     self.labelBox.setText(self.bookSelected.box)
     self.labelBookType.setText(self.bookSelected.booktype.getDisplayText())
     self.labelCoverMaterial.setText(self.bookSelected.coverMaterial)
예제 #8
0
 def loadBook(self, item):
     """
     load book entry to show its data in the preview and so it can later pass it to main
     """
     self.book_id = item.text()
     self.bookSelected = FsUtils.get_book(self.book_id, self.batch_id)
     self.labelBox.setText(self.bookSelected.box)
     self.labelBookType.setText(self.bookSelected.booktype.getDisplayText())
     self.labelCoverMaterial.setText(self.bookSelected.coverMaterial)
예제 #9
0
    def __init__(self, parent):
        super().__init__(parent)
        cost = parent.cost
        book = parent.activeBook
        uic.loadUi(FsUtils.get_resource("ui/costbreakdown.ui"), self)

        if cost.canBookBeEvalutated():
            self.spinDisplayCover.setValue(cost.getBoardCost())
            self.spinDisplayPaper.setValue(cost.getPageCost())
            self.spinDisplaySew.setValue(cost.getThreadRibbonCost())
            self.spinDisplaySuper.setValue(cost.getSuperCost())
            self.spinDisplayCloth.setValue(cost.getClothCost())
            self.spinDisplayHeadband.setValue(cost.getHeadbandCost())
            self.spinDisplayExtra.setValue(cost.getExtraCosts())

            if book.booktype is BookType.STAB:
                self.labelSewType.setText("Ribbon")
            else:
                self.labelSewType.setText("Thread")
예제 #10
0
 def onNewEntryOnNewBatch(self):
     self.activeBook = FsUtils.create_book_new_batch()
     self.setUiActive()
예제 #11
0
 def onNewEntryOnCurrentBatch(self):
     self.activeBook = FsUtils.create_book_current_batch()
     self.setUiActive()
예제 #12
0
 def saveSettings(self):
     FsUtils.save_settings()
예제 #13
0
 def __init__(self, parent, active_book: BookEntry):
     super().__init__(parent)
     uic.loadUi(FsUtils.get_resource("ui/discription.ui"), self)
     self.book_entry: BookEntry = active_book
     self.generateDiscription()
예제 #14
0
 def moveBook(self):
     if self.batch_id is not None:
         FsUtils.move_book(self.active_book, self.batch_id)
         self.close()
예제 #15
0
 def __init__(self, parent=None):
     super().__init__(parent=parent)
     uic.loadUi(FsUtils.get_resource("/ui/settings.ui"), self)
     self.pushChangeDirectory.clicked.connect(self.changeDictory)
     self.accepted.connect(self.saveSettings)
     self.lineDirectory.setText(FsUtils.get_book_dir())
예제 #16
0
 def openBook(self):
     if self.bookSelected is not None:
         self.main.onEntryLoaded(
             FsUtils.get_book(self.book_id, self.batch_id))
         self.close()
예제 #17
0
 def onDirectorySelected(self, path):
     FsUtils.set_books_dir(path)
     self.lineDirectory.setText(path)