Added loggers to some functions. Needs more work

This commit is contained in:
2016-05-10 20:23:48 -05:00
parent df563d86d8
commit 745a2a614e
9 changed files with 84 additions and 17 deletions

View File

@@ -1,7 +1,9 @@
# -*- coding: utf-8 -*-
import os
import widgetUtils
import logging
from wxUI.dialogs import attach as gui
log = logging.getLogger("controller.attach")
class attach(object):
def __init__(self):
@@ -10,21 +12,26 @@ class attach(object):
widgetUtils.connect_event(self.dialog.photo, widgetUtils.BUTTON_PRESSED, self.upload_image)
widgetUtils.connect_event(self.dialog.remove, widgetUtils.BUTTON_PRESSED, self.remove_attachment)
self.dialog.get_response()
log.debug("Attachments controller started.")
def upload_image(self, *args, **kwargs):
image, description = self.dialog.get_image()
if image != None:
self.attachments.append({"type": "photo", "file": image, "description": os.path.basename(image)})
imageInfo = {"type": "photo", "file": image, "description": os.path.basename(image)}
log.debug("Image data to upload: %r" % (imageInfo,))
self.attachments.append(imageInfo)
info = [_(u"Photo"), os.path.basename(image)]
self.dialog.attachments.insert_item(False, *info)
self.dialog.remove.Enable(True)
def remove_attachment(self, *args, **kwargs):
current_item = self.dialog.attachments.get_selected()
log.debug("Removing item %d" % (current_item,))
if current_item == -1: current_item = 0
self.attachments.pop(current_item)
self.dialog.attachments.remove_item(current_item)
self.check_remove_status()
log.debug("Removed")
def check_remove_status(self):
if len(self.attachments) == 0 and self.dialog.attachments.get_count() == 0:

View File

@@ -6,6 +6,7 @@ import utils
import posts
import player
import output
import logging
from wxUI.tabs import home
from pubsub import pub
from sessionmanager import session
@@ -14,6 +15,8 @@ from wxUI import commonMessages
from vk import upload
from vk.exceptions import VkAPIMethodError
log = logging.getLogger("controller.buffers")
class baseBuffer(object):
""" a basic representation of a buffer. Other buffers should be derived from this class"""
def __init__(self, parent=None, name="", session=None, composefunc=None, *args, **kwargs):