mirror of https://gitlab.com/pamhyr/pamhyr2
Pamhyr2: Fix pep8.
parent
b9fddcf78c
commit
4d8277c5c2
|
|
@ -48,6 +48,7 @@ class SetCommand(QUndoCommand):
|
||||||
for key in self._new:
|
for key in self._new:
|
||||||
f[key] = self._new[key]
|
f[key] = self._new[key]
|
||||||
|
|
||||||
|
|
||||||
class AddCommand(QUndoCommand):
|
class AddCommand(QUndoCommand):
|
||||||
def __init__(self, files, row):
|
def __init__(self, files, row):
|
||||||
QUndoCommand.__init__(self)
|
QUndoCommand.__init__(self)
|
||||||
|
|
@ -65,6 +66,7 @@ class AddCommand(QUndoCommand):
|
||||||
else:
|
else:
|
||||||
self._files.insert(self._row, self._new)
|
self._files.insert(self._row, self._new)
|
||||||
|
|
||||||
|
|
||||||
class DelCommand(QUndoCommand):
|
class DelCommand(QUndoCommand):
|
||||||
def __init__(self, files, row):
|
def __init__(self, files, row):
|
||||||
QUndoCommand.__init__(self)
|
QUndoCommand.__init__(self)
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ from View.AdditionalFiles.List import ListModel
|
||||||
from View.AdditionalFiles.Translate import AddFileTranslate
|
from View.AdditionalFiles.Translate import AddFileTranslate
|
||||||
from View.AdditionalFiles.Edit.Window import EditAddFileWindow
|
from View.AdditionalFiles.Edit.Window import EditAddFileWindow
|
||||||
|
|
||||||
|
|
||||||
class AddFileListWindow(PamhyrWindow):
|
class AddFileListWindow(PamhyrWindow):
|
||||||
_pamhyr_ui = "AdditionalFileList"
|
_pamhyr_ui = "AdditionalFileList"
|
||||||
_pamhyr_name = "Additional files"
|
_pamhyr_name = "Additional files"
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ class SetCommand(QUndoCommand):
|
||||||
for key in self._new:
|
for key in self._new:
|
||||||
f[key] = self._new[key]
|
f[key] = self._new[key]
|
||||||
|
|
||||||
|
|
||||||
class AddCommand(QUndoCommand):
|
class AddCommand(QUndoCommand):
|
||||||
def __init__(self, lines, row):
|
def __init__(self, lines, row):
|
||||||
QUndoCommand.__init__(self)
|
QUndoCommand.__init__(self)
|
||||||
|
|
@ -65,6 +66,7 @@ class AddCommand(QUndoCommand):
|
||||||
else:
|
else:
|
||||||
self._lines.insert(self._row, self._new)
|
self._lines.insert(self._row, self._new)
|
||||||
|
|
||||||
|
|
||||||
class DelCommand(QUndoCommand):
|
class DelCommand(QUndoCommand):
|
||||||
def __init__(self, lines, row):
|
def __init__(self, lines, row):
|
||||||
QUndoCommand.__init__(self)
|
QUndoCommand.__init__(self)
|
||||||
|
|
|
||||||
10
src/tools.py
10
src/tools.py
|
|
@ -234,14 +234,19 @@ def timestamp(dt: datetime):
|
||||||
return (dt - datetime(1970, 1, 1)).total_seconds()
|
return (dt - datetime(1970, 1, 1)).total_seconds()
|
||||||
return dt.timestamp()
|
return dt.timestamp()
|
||||||
|
|
||||||
|
|
||||||
def date_iso_to_timestamp(date: str):
|
def date_iso_to_timestamp(date: str):
|
||||||
return datetime.isoformat(date)
|
if type(date) is str:
|
||||||
|
return datetime.fromisoformat(date).timestamp()
|
||||||
|
else:
|
||||||
|
return datetime.isoformat(date)
|
||||||
|
|
||||||
|
|
||||||
def date_dmy_to_timestamp(date: str):
|
def date_dmy_to_timestamp(date: str):
|
||||||
if date.count(":") == 0:
|
if date.count(":") == 0:
|
||||||
ret = datetime.strptime(date, "%d/%m/%y")
|
ret = datetime.strptime(date, "%d/%m/%y")
|
||||||
elif date.count(".") == 1:
|
elif date.count(".") == 1:
|
||||||
ret= datetime.strptime(date, "%d/%m/%y %H:%M:%S.%f")
|
ret = datetime.strptime(date, "%d/%m/%y %H:%M:%S.%f")
|
||||||
elif date.count(":") == 1:
|
elif date.count(":") == 1:
|
||||||
ret = datetime.strptime(date, "%d/%m/%y %H:%M")
|
ret = datetime.strptime(date, "%d/%m/%y %H:%M")
|
||||||
elif date.count(":") == 2:
|
elif date.count(":") == 2:
|
||||||
|
|
@ -251,6 +256,7 @@ def date_dmy_to_timestamp(date: str):
|
||||||
|
|
||||||
return ret.timestamp()
|
return ret.timestamp()
|
||||||
|
|
||||||
|
|
||||||
def old_pamhyr_date_to_timestamp(date: str):
|
def old_pamhyr_date_to_timestamp(date: str):
|
||||||
v = date.split(":")
|
v = date.split(":")
|
||||||
if len(v) != 4:
|
if len(v) != 4:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue