Yardım TC Offlineshop Hataları

Konu sahibi bu konuda soru soruyor. Sorusu ile ilgili bilgisi olanların yanıtlamasını bekliyor.

MEKA

Discord: mekaprojects
Site yetkilisi
Süper Moderatör
Premium Üye
Grafiker
Geliştirici
Yardımsever Üye
Mesaj
2.790
Çözümler
287
Beğeni
2.047
Puan
1.850
Ticaret Puanı
2
1. Problem İtemi Tezgaha sürüklüyoruz fiyat belirleme penceresi geliyor Won kısmında 0 yang kısmında "|" işareti oluyor yazı yazmak için hiç birşey yazmadan tamama basarsak bu syserr düşüyor buraya otomatik 0 girili yaparsak gözlemlerime göre bu problem kalkıyor

Verdiği syserr
Kod:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    0812 17:37:39736 :: Traceback (most recent call last):

0812 17:37:39736 ::   File "ui.py", line 1515, in CallEvent

0812 17:37:39737 ::   File "ui.py", line 129, in __call__

0812 17:37:39737 ::   File "ui.py", line 111, in __call__

0812 17:37:39737 ::   File "uiOfflineShopBuilder.py", line 291, in AcceptInputPrice

0812 17:37:39737 :: ValueError
0812 17:37:39737 :: :
0812 17:37:39737 :: invalid literal for int() with base 10: ''

uiofflineshopbuilder.py:
    def AcceptInputPrice(self):
        if not self.priceInputBoard:
            return True

        text = self.priceInputBoard.GetText()

        if app.ENABLE_CHEQUE_SYSTEM:
            cheText = self.priceInputBoard.GetChequeText()
            if not text and not cheText:
                return True

            if not text.isdigit() and not cheText.isdigit():
                return True

            if int(text) <= 0 and int(cheText) <= 0:
                return True
        else:
            if not text:
                return True

            if not text.isdigit():
                return True

            if int(text) <= 0:
                return True

2. Hata Giyili itemi tezgaha sürükleyince fiyat penceresi açılıyor fiyat girip tamama basınca boş tezgah açmış oluyoruz giyili itemi sürükleyince uyarı verdirtmek gerek
 
Son düzenleme:
uiOfflineShopBuilder.py dosyasında bulunan AcceptInputPrice fonksiyonunu konuya ekleyebilir misiniz
 
Şöyle değiştirmeyi dener misiniz?
Değişiklik yapılan satırları işaretledim.

Python:
    def AcceptInputPrice(self):
        if not self.priceInputBoard:
            return True

        if app.ENABLE_CHEQUE_SYSTEM:
            cheText = self.priceInputBoard.GetChequeText()            
            text = self.priceInputBoard.GetText()

            if not text or not cheText:
                return True

            if not text.isdigit() or not cheText.isdigit():
                return True

            if int(text) <= 0 and int(cheText) <= 0:
                return True

        else:
            text = self.priceInputBoard.GetText()

            if not text:
                return True

            if not text.isdigit():
                return True

            if int(text) <= 0:
                return True
 
Son düzenleme:
GetCheque() yerine GetChequeText() kullandım öyle tanımlı olduğu için syserr kalkıyor fakat 0 yazılı gelmiyor.
 
Evet kalkıyor fakat 0 yazılı gelmiyor won kısmına tıklayınca yangda 0 görünür oluyor
 
Kalkması önemliydi. Eğer yanlış hatırlamıyorsam tc offlineshop'da son koyduğun iteme miktar girdiğin zaman başka bir item eklediğinde otomatik olarak yang değerini yazdırıyordu. Belki bu yüzden syserr veriyordu. Bu şekilde düzenleyince bir tanesinde veri boş gelirse işlemi devam ettirmeyecek.

Son durumu daha net anlayabilmem için video yada gif atabilir misiniz?
 
b9233838d2369675c66a72d28ad73702.gif

Siz yorum yazmadan önce lastprice kısmını aktif ettim bendeki kodlar ile o aktif olunca otomatik 0 yazılı geliyor aynı itemde miktarı kayıt etse neyse :D her iteme aynı fiyatı kayıt ediyor bu yüzden iptal etmiş olmam gerek
 
Gifde bir sorun göremedim ben aslında. Normalde böyle olması gerekmiyor muydu. Son girilen değerin otomatik yazmasını mı istiyorsunuz?
 
Bir düşündümde aslında böyle olması daha mantıklı syserri çözmüşken wona tıklayıncada 0ı kaldırmasını sağlayabilirmiyiz? tıklayıp 1 yazdık mesela 01 oluyor direk 1 olsun mesela
 
Başında sıfır olması değeri etkilemiyor. uicommon.py'de MoneyInputDialog fonksiyonu içindeki kodları verebilir misiniz?
 
Ben ticarete max 99 won koyulacak şekilde ayarladım bu yüzden 0 varken rakam yazınca 09 oluyor 0ı tıklayınca otomatik silse 99 sığacak :D

Python:
class MoneyInputDialog(ui.ScriptWindow):

    def __init__(self):
        ui.ScriptWindow.__init__(self)

        if not app.ENABLE_CHEQUE_SYSTEM:
            self.moneyHeaderText = localeInfo.MONEY_INPUT_DIALOG_SELLPRICE
        self.__CreateDialog()
        self.SetMaxLength(9)
        if app.ENABLE_CHEQUE_SYSTEM:
            self.SetMaxLengthCheque(2)

    def __del__(self):
        ui.ScriptWindow.__del__(self)

    def __CreateDialog(self):

        pyScrLoader = ui.PythonScriptLoader()
        pyScrLoader.LoadScriptFile(self, "uiscript/moneyinputdialog.py")

        getObject = self.GetChild
        self.board = self.GetChild("board")
        self.acceptButton = getObject("AcceptButton")
        self.cancelButton = getObject("CancelButton")
        self.inputValue = getObject("InputValue")
        self.inputValue.SetNumberMode()
        self.inputValue.OnIMEUpdate = ui.__mem_func__(self.__OnValueUpdate)
        self.moneyText = getObject("MoneyValue")
        if app.ENABLE_CHEQUE_SYSTEM:
            self.SellInfoText = getObject("SellInfoText")
            self.InputValue_Cheque = getObject("InputValue_Cheque")
            self.InputValue_Cheque.SetNumberMode()
            self.InputValue_Cheque.OnIMEUpdate = ui.__mem_func__(self.__OnValueUpdate)
            self.InputValue_Cheque.OnMouseLeftButtonDown = ui.__mem_func__(self.__ClickChequeEditLine)
            self.inputValue.OnMouseLeftButtonDown = ui.__mem_func__(self.__ClickYangEditLine)
            self.chequeText = getObject("ChequeValue")

    def Open(self):
        self.inputValue.SetText("")
        self.inputValue.SetFocus()
        self.__OnValueUpdate()
        self.SetCenterPosition()
        self.SetTop()
        self.Show()

    def Close(self):
        self.ClearDictionary()
        self.board = None
        self.acceptButton = None
        self.cancelButton = None
        self.inputValue = None
        if app.ENABLE_CHEQUE_SYSTEM:
            self.InputValue_Cheque = None
        self.Hide()

    def SetTitle(self, name):
        self.board.SetTitleName(name)

    def SetFocus(self):
        self.inputValue.SetFocus()

    def SetMaxLength(self, length):
        length = min(9, length)
        self.inputValue.SetMax(length)

    def SetMoneyHeaderText(self, text):
        self.moneyHeaderText = text

    def SetAcceptEvent(self, event):
        self.acceptButton.SetEvent(event)
        self.inputValue.OnIMEReturn = event

    def SetCancelEvent(self, event):
        self.board.SetCloseEvent(event)
        self.cancelButton.SetEvent(event)
        self.inputValue.OnPressEscapeKey = event

    def SetValue(self, value):
        value=str(value)
        self.inputValue.SetText(value)
        self.__OnValueUpdate()
        ime.SetCursorPosition(len(value)+1)       

    def GetText(self):
        return self.inputValue.GetText()
        
    def __OnValueUpdate(self):
        if self.inputValue.IsFocus():
            ui.EditLine.OnIMEUpdate(self.inputValue)
        elif self.InputValue_Cheque.IsFocus():
            ui.EditLine.OnIMEUpdate(self.InputValue_Cheque)
        else:
            pass
        
        yang_text = self.inputValue.GetText()
        cheque_text = self.InputValue_Cheque.GetText()
        
        yang = 0
        cheque = 0
        
        if yang_text and yang_text.isdigit():
            try:
                yang = int(yang_text)
                
                if yang >= 2000000000:
                    yang = 1999999999
                    self.inputValue.SetText(str(yang))

            except ValueError:
                yang = 0

        if cheque_text and cheque_text.isdigit():
            try:
                cheque = int(cheque_text)
                
                if cheque >= 998:
                    cheque = 997
                    self.InputValue_Cheque.SetText(str(cheque))
            
            except ValueError:
                cheque = 0
        
        
        self.chequeText.SetText(str(cheque) + " " + localeInfo.CHEQUE_SYSTEM_UNIT_WON)
        self.moneyText.SetText(localeInfo.NumberToMoneyString(yang))

    if app.ENABLE_CHEQUE_SYSTEM:       
        def SetChequeValue(self, value):
            value=str(value)
            self.InputValue_Cheque.SetText(value)
            #self.InputValue_Cheque.SetFocus()
            self.__OnChequeValueUpdate()
            ime.SetCursorPosition(len(value)+1)
            
        def __ClickChequeEditLine(self):
            self.InputValue_Cheque.SetFocus()
            if len(self.inputValue.GetText()) <= 0:
                self.inputValue.SetText(str(0))
        
        def __ClickYangEditLine(self):
            self.inputValue.SetFocus()
            if len(self.InputValue_Cheque.GetText()) <= 0:
                self.InputValue_Cheque.SetText(str(0))
        
        def SetMaxLengthCheque(self, length):
            length = min(2, length)
            self.InputValue_Cheque.SetMax(length)
        
        def GetChequeText(self):
            return self.InputValue_Cheque.GetText()
 
Bu kodu;
Python:
        def __ClickChequeEditLine(self):
            self.InputValue_Cheque.SetFocus()
            if len(self.inputValue.GetText()) <= 0:
                self.inputValue.SetText(str(0)

Şöyle değiştirip deneyebilir misiniz?
Python:
        def __ClickChequeEditLine(self):
            self.InputValue_Cheque.SetFocus()
            if len(self.inputValue.GetText()) <= 0:
                self.inputValue.SetText("")
 
Bu sefer gifte wona tıklayınca yang 0 oluyordu şimdi hiç olmuyor won kısmında herhangi bi değişiklik yok 0 varken 1 yazınca 01 oluyor
 
Geri
Üst