Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
HIllya51 committed Jul 17, 2024
1 parent 3515386 commit 13762a9
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 23 deletions.
33 changes: 25 additions & 8 deletions LunaTranslator/LunaTranslator/gui/dynalang.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ def updatelangtext(self):


class LMessageBox(QMessageBox, LBase):
_title = None
_text = None
def __init__(self, *argc, **kwarg):
super().__init__(*argc, **kwarg)
self._title = None
self._text = None

def setText(self, t):
self._text = t
Expand Down Expand Up @@ -106,7 +108,10 @@ def updatelangtext(self):


class LGroupBox(QGroupBox, LBase):
_text = None

def __init__(self, *argc, **kwarg):
super().__init__(*argc, **kwarg)
self._text = None

def setTitle(self, t):
self._text = t
Expand Down Expand Up @@ -145,7 +150,10 @@ def addRow(self, *argc):


class LDialog(QDialog, LBase):
_title = None

def __init__(self, *argc, **kwarg):
super().__init__(*argc, **kwarg)
self._title = None

def setWindowTitle(self, t):
self._title = t
Expand All @@ -157,7 +165,10 @@ def updatelangtext(self):


class LMainWindow(QMainWindow, LBase):
_title = None

def __init__(self, *argc, **kwarg):
super().__init__(*argc, **kwarg)
self._title = None

def setWindowTitle(self, t):
self._title = t
Expand All @@ -178,7 +189,9 @@ def updatelangtext(self):


class LTabBar(QTabBar, LBase):
__titles = []
def __init__(self, *argc, **kwarg):
super().__init__(*argc, **kwarg)
self.__titles = []

def insertTab(self, idx, t):
self.__titles.insert(idx, t)
Expand All @@ -198,7 +211,9 @@ def updatelangtext(self):


class LTabWidget(QTabWidget, LBase):
__titles = []
def __init__(self, *argc, **kwarg):
super().__init__(*argc, **kwarg)
self.__titles = []

def addTab(self, w, t):
self.__titles.append(t)
Expand All @@ -210,7 +225,9 @@ def updatelangtext(self):


class LStandardItemModel(QStandardItemModel, LBase):
__ls = []
def __init__(self, *argc, **kwarg):
super().__init__(*argc, **kwarg)
self.__ls = []

def setHorizontalHeaderLabels(self, ls: list):
self.__ls = ls.copy()
Expand Down
33 changes: 18 additions & 15 deletions LunaTranslator/LunaTranslator/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,11 @@ def __repr__(self):


class ResponseBase:
headers = CaseInsensitiveDict()
cookies = {}
status_code = 0
content = b""
def __init__(self):
self.headers = CaseInsensitiveDict()
self.cookies = {}
self.status_code = 0
self.content = b""

@property
def text(self):
Expand Down Expand Up @@ -347,17 +348,19 @@ def generate_random_string(length=16):


class Session:
cookies = {}
_requester = None
_libidx = -1

headers = CaseInsensitiveDict(
{
# "Accept-Encoding": "gzip, deflate, br",
"Accept": "*/*",
"Connection": "keep-alive",
}
)
def __init__(self):

self.cookies = {}
self._requester = None
self._libidx = -1

self.headers = CaseInsensitiveDict(
{
# "Accept-Encoding": "gzip, deflate, br",
"Accept": "*/*",
"Connection": "keep-alive",
}
)

def __enter__(self):
return self
Expand Down

0 comments on commit 13762a9

Please sign in to comment.