Separated also tab GUI components in modules so it will be easier to mantain the codebase in the future

This commit is contained in:
2021-04-23 12:26:35 -05:00
parent 0a0e2a4dd9
commit 5978a7749d
26 changed files with 315 additions and 26 deletions

View File

@@ -11,7 +11,7 @@ from pubsub import pub
from vk_api import upload
from mutagen.id3 import ID3
from presenters import player
from wxUI.tabs import home
from wxUI.tabs import audio
from sessionmanager import utils
from mysc.thread_utils import call_threaded
from wxUI import commonMessages, menus
@@ -22,7 +22,7 @@ log = logging.getLogger("controller.buffers.audio")
class audioBuffer(wallBuffer):
def create_tab(self, parent):
self.tab = home.audioTab(parent)
self.tab = audio.audioTab(parent)
self.tab.name = self.name
self.connect_events()
if self.name == "me_audio":

View File

@@ -3,7 +3,7 @@ import logging
import wx
import widgetUtils
import output
from wxUI.tabs import home
from wxUI.tabs import audioAlbum
from .audio import audioBuffer
log = logging.getLogger("controller.buffers.audioPlaylist")
@@ -13,7 +13,7 @@ class audioAlbumBuffer(audioBuffer):
but is deprecated as VK removed its audio support for third party apps."""
def create_tab(self, parent):
self.tab = home.audioAlbumTab(parent)
self.tab = audioAlbum.audioAlbumTab(parent)
self.tab.play.Enable(False)
self.tab.play_all.Enable(False)
self.connect_events()

View File

@@ -11,7 +11,7 @@ import widgetUtils
import output
from pubsub import pub
from vk_api.exceptions import VkApiError
from wxUI.tabs import home
from wxUI.tabs import chat
from mysc.thread_utils import call_threaded
from wxUI import commonMessages, menus
from sessionmanager import renderers
@@ -76,7 +76,7 @@ class chatBuffer(homeBuffer):
event.Skip()
def create_tab(self, parent):
self.tab = home.chatTab(parent)
self.tab = chat.chatTab(parent)
self.attachments = list()
self.connect_events()
self.tab.name = self.name
@@ -187,7 +187,7 @@ class chatBuffer(homeBuffer):
if i["type"] == "photos_list":
continue
try:
rendered_object = add_attachment(i)
rendered_object = renderers.add_attachment(i)
except:
log.exception("Error parsing the following attachment on chat: %r" % (i,))
attachments.append(rendered_object)

View File

@@ -8,7 +8,7 @@ import views
import interactors
import widgetUtils
from pubsub import pub
from wxUI.tabs import home
from wxUI.tabs import communityBoard
from mysc.thread_utils import call_threaded
from .wall import wallBuffer
@@ -17,7 +17,7 @@ log = logging.getLogger("controller.buffers.communityBoard")
class communityBoardBuffer(wallBuffer):
def create_tab(self, parent):
self.tab = home.topicTab(parent)
self.tab = communityBoard.communityBoardTab(parent)
self.connect_events()
self.tab.name = self.name
if "can_create_topic" not in self.session.db["group_info"][self.kwargs["group_id"]*-1] or ("can_create_topic" in self.session.db["group_info"][self.kwargs["group_id"]*-1] and self.session.db["group_info"][self.kwargs["group_id"]*-1]["can_create_topic"] != True):

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
import logging
from wxUI.tabs import home
from wxUI.tabs import communityDocuments
from .documents import documentsBuffer
log = logging.getLogger("controller.buffers.communityDocuments")
@@ -9,7 +9,7 @@ class communityDocumentsBuffer(documentsBuffer):
can_get_items = True
def create_tab(self, parent):
self.tab = home.documentCommunityTab(parent)
self.tab = communityDocuments.communityDocumentsTab(parent)
self.connect_events()
self.tab.name = self.name
if hasattr(self, "can_post") and self.can_post == False and hasattr(self.tab, "post"):

View File

@@ -8,7 +8,7 @@ import interactors
import widgetUtils
import output
from pubsub import pub
from wxUI.tabs import home
from wxUI.tabs import communityWall
from mysc.thread_utils import call_threaded
from .wall import wallBuffer
@@ -21,7 +21,7 @@ class communityWallBuffer(wallBuffer):
self.group_id = self.kwargs["owner_id"]
def create_tab(self, parent):
self.tab = home.communityTab(parent)
self.tab = communityWall.communityWallTab(parent)
self.connect_events()
self.tab.name = self.name
self.tab.post.Enable(False)

View File

@@ -8,7 +8,7 @@ import languageHandler
import widgetUtils
import output
from pubsub import pub
from wxUI.tabs import home
from wxUI.tabs import documents
from sessionmanager import utils
from mysc.thread_utils import call_threaded
from wxUI import menus
@@ -20,7 +20,7 @@ class documentsBuffer(wallBuffer):
can_get_items = False
def create_tab(self, parent):
self.tab = home.documentTab(parent)
self.tab = documents.documentsTab(parent)
self.connect_events()
self.tab.name = self.name
if hasattr(self, "can_post") and self.can_post == False and hasattr(self.tab, "post"):

View File

@@ -2,14 +2,14 @@
""" A buffer is a (virtual) list of items. All items belong to a category (wall posts, messages, persons...)"""
import logging
import output
from wxUI.tabs import home
from wxUI.tabs import empty
log = logging.getLogger("controller.buffers.empty")
class emptyBuffer(object):
def __init__(self, name=None, parent=None, *args, **kwargs):
self.tab = home.empty(parent=parent, name=name)
self.tab = empty.emptyTab(parent=parent, name=name)
self.name = name
def get_items(self, *args, **kwargs):

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
import logging
from wxUI.tabs import home
from wxUI.tabs import notification
from .wall import wallBuffer
log = logging.getLogger("controller.buffers")
@@ -8,7 +8,7 @@ log = logging.getLogger("controller.buffers")
class notificationBuffer(wallBuffer):
def create_tab(self, parent):
self.tab = home.notificationTab(parent)
self.tab = notification.notificationTab(parent)
self.connect_events()
self.tab.name = self.name

View File

@@ -11,7 +11,7 @@ import interactors
import languageHandler
import widgetUtils
from pubsub import pub
from wxUI.tabs import home
from wxUI.tabs import people
from wxUI.dialogs import timeline
from mysc.thread_utils import call_threaded
from wxUI import commonMessages, menus
@@ -37,7 +37,7 @@ class peopleBuffer(wallBuffer):
call_threaded(pub.sendMessage, "post", parent_endpoint="wall", child_endpoint="post", from_buffer=self.name, attachments_list=attachments, post_arguments=post_arguments)
def create_tab(self, parent):
self.tab = home.peopleTab(parent)
self.tab = people.peopleTab(parent)
self.connect_events()
self.tab.name = self.name
if hasattr(self, "can_post") and self.can_post == False and hasattr(self.tab, "post"):

View File

@@ -4,7 +4,7 @@ import webbrowser
import wx
import widgetUtils
import output
from wxUI.tabs import home
from wxUI.tabs import video
from wxUI import commonMessages, menus
from controller import selector
from .wall import wallBuffer
@@ -15,7 +15,7 @@ class videoBuffer(wallBuffer):
""" This buffer represents video elements, and it can be used for showing videos for the logged user or someone else."""
def create_tab(self, parent):
self.tab = home.videoTab(parent)
self.tab = video.videoTab(parent)
self.connect_events()
self.tab.name = self.name
if hasattr(self, "can_post") and self.can_post == False and hasattr(self.tab, "post"):

View File

@@ -3,7 +3,7 @@ import logging
import wx
import widgetUtils
import output
from wxUI.tabs import home
from wxUI.tabs import videoAlbum
from .video import videoBuffer
log = logging.getLogger("controller.buffers")
@@ -11,7 +11,7 @@ log = logging.getLogger("controller.buffers")
class videoAlbumBuffer(videoBuffer):
def create_tab(self, parent):
self.tab = home.videoAlbumTab(parent)
self.tab = video.videoAlbumTab(parent)
self.tab.play.Enable(False)
self.connect_events()
self.tab.name = self.name

View File

@@ -10,7 +10,6 @@ import widgetUtils
import output
from pubsub import pub
from vk_api.exceptions import VkApiError
from wxUI.tabs import home
from mysc.thread_utils import call_threaded
from wxUI import commonMessages
from .home import homeBuffer