Example #1
0
    def OnCreatePost(self, evt):
    	self.title = self.tc_title.GetValue().encode('utf-8')
    	self.body = self.tc_post.GetValue().encode('utf-8')
        self.tags = self.tc_tag.GetValue().encode('utf-8')
        self.tags = string.replace(self.tags,' ', ',')
        self.date = self.tc_date.GetValue().encode('utf-8')

        if self.cb_publishing.GetValue() == 'private':
            self.private = 1
        else:
        	self.private = 0
        #print self.cb_publishing.GetValue()
        if self.cb_publishing.GetValue() == 'add to queue':
            self.date = 'on.2'


        #self.format = None
        self.api = Api(self.api.name, self.api.email, self.api.password, self.private, self.date, self.tags)
    	try:
    		self.post = self.api.write_regular(self.title, self.body)
    	except:
    		print "Posteado en blog primario"	
    	#print "Posteado en " % self.post
    	#assert False,dir(self.post.values)
    	self.Close()
Example #2
0
    def OnCreateAudio(self, evt):
    	self.data = self.b_browse.GetValue()
    	if not self.data:
    		self.data =None
    	self.source = self.tc_audiofileurl.GetValue()
    	if not self.source:
    		self.source = None
    	self.caption = self.tc_caption.GetValue().encode('utf-8')
        self.tags = self.tc_tag.GetValue().encode('utf-8')
        self.tags = string.replace(self.tags,' ', ',')
        self.date = self.tc_date.GetValue().encode('utf-8')

        if self.cb_publishing.GetValue() == 'private':
        	self.private = 1
        else:
        	self.private = 0


        #self.format = None
        self.api = Api(self.api.name, self.api.email, self.api.password, self.private, self.date, self.tags)
    	try:
    		self.post = self.api.write_audio(self.data, self.source, self.caption)
    	except:
    		print "audio posteado en el blog primario"
    	self.Close()
Example #3
0
 def OnCreatePost(self, evt):
 	self.title = self.tc_title.GetValue().encode('utf-8')
 	self.body = self.tc_post.GetValue().encode('utf-8')
         
     if self.body:
         self.api = Api(self.api.name, self.api.email, self.api.password, self.private, self.date, self.tags)
         try:
             self.post = self.api.write_regular(self.title, self.body)
         except:
             print "Posteado en blog primario"
         self.OnCancel(self)
     else:
         Message("Post is required")
Example #4
0
 def OnCreateChat(self, evt):
 	self.title = self.tc_title.GetValue().encode('utf-8')
 	self.conversation = self.tc_dialogue.GetValue().encode('utf-8')
     
     if self.conversation:
         self.api = Api(self.api.name, self.api.email, self.api.password, self.private, self.date, self.tags)
         try:
             self.post = self.api.write_conversation(self.title, self.conversation)
         except:
             print "posteado en el blog primario"
         self.OnCancel(self)
     else:
         Message('Dialogue is required')
Example #5
0
 def OnCreateQuote(self, evt):
 	self.quote = self.tc_quote.GetValue().encode('utf-8')
 	self.source = self.tc_source.GetValue().encode('utf-8')
     
     if self.quote:
         self.api = Api(self.api.name, self.api.email, self.api.password, self.private, self.date, self.tags)
         try:
             self.post = self.api.write_quote(self.quote, self.source)
         except:
             print "posteado en el blog primario"
         self.OnCancel(self)
     else:
         Message('Quote is required')
Example #6
0
    def OnCreateVideo(self, evt):
    	self.embed = self.tc_embed.GetValue()
    	self.caption = self.tc_caption.GetValue().encode('utf-8')

        if self.embed:
            self.api = Api(self.api.name, self.api.email, self.api.password, self.private, self.date, self.tags)
            try:
                self.post = self.api.write_video(self.embed, self.caption)
            except:
                print "posteado en el blog primario"
            self.OnCancel(self)
        else:
            Message('Embed a video is required')
Example #7
0
 def OnCreateLink(self, evt):
 	self.name = self.tc_name.GetValue().encode('utf-8')
 	self.urllink = self.tc_urllink.GetValue()
 	self.description = self.tc_description.GetValue().encode('utf-8')
     
     if self.urllink:
         self.api = Api(self.api.name, self.api.email, self.api.password, self.private, self.date, self.tags)
         try:
             self.post = self.api.write_link(self.name,self.urllink,self.description)
         except:
             print "posteado en el blog primario"
         self.OnCancel(self)
     else:
         Message('URL is required')
Example #8
0
    def OnCreateLink(self, evt):
        self.name = self.tc_name.GetValue().encode("utf-8")
        self.urllink = self.tc_urllink.GetValue()
        self.description = self.tc_description.GetValue().encode("utf-8")
        self.tags = self.tc_tag.GetValue().encode("utf-8")
        self.tags = string.replace(self.tags, " ", ",")
        self.date = self.tc_date.GetValue().encode("utf-8")

        if self.cb_publishing.GetValue() == "private":
            self.private = 1
        else:
            self.private = 0

        # self.format = None
        self.api = Api(self.api.name, self.api.email, self.api.password, self.private, self.date, self.tags)
        try:
            self.post = self.api.write_link(self.name, self.urllink, self.description)
        except:
            print "posteado en el blog primario"
        self.Close()
Example #9
0
    def OnCreateChat(self, evt):
    	self.title = self.tc_title.GetValue().encode('utf-8')
    	self.conversation = self.tc_dialogue.GetValue().encode('utf-8')
        self.tags = self.tc_tag.GetValue().encode('utf-8')
        self.tags = string.replace(self.tags,' ', ',')
        self.date = self.tc_date.GetValue().encode('utf-8')

        if self.cb_publishing.GetValue() == 'private':
        	self.private = 1
        else:
        	self.private = 0


        #self.format = None
        self.api = Api(self.api.name, self.api.email, self.api.password, self.private, self.date, self.tags)
    	try:
    		self.post = self.api.write_conversation(self.title, self.conversation)
    	except:
    		print "posteado en el blog primario"
    	self.Close()
Example #10
0
    def OnCreateQuote(self, evt):
    	self.quote = self.tc_quote.GetValue().encode('utf-8')
    	self.source = self.tc_source.GetValue().encode('utf-8')
        self.tags = self.tc_tag.GetValue().encode('utf-8')
        self.tags = string.replace(self.tags,' ', ',')
        self.date = self.tc_date.GetValue().encode('utf-8')

        if self.cb_publishing.GetValue() == 'private':
        	self.private = 1
        else:
        	self.private = 0


        #self.format = None
        self.api = Api(self.api.name, self.api.email, self.api.password, self.private, self.date, self.tags)
    	try:
    		self.post = self.api.write_quote(self.quote, self.source)
    	except:
    		print "posteado en el blog primario"
    	self.Close()
Example #11
0
    def OnCreateVideo(self, evt):
    	self.embed = self.tc_embed.GetValue()
    	self.caption = self.tc_caption.GetValue().encode('utf-8')
        self.tags = self.tc_tag.GetValue().encode('utf-8')
        self.tags = string.replace(self.tags,' ', ',')
        self.date = self.tc_date.GetValue().encode('utf-8')

        if self.cb_publishing.GetValue() == 'private':
        	self.private = 1
        else:
        	self.private = 0


        #self.format = None
        self.api = Api(self.api.name, self.api.email, self.api.password, self.private, self.date, self.tags)
    	try:
    		self.post = self.api.write_video(self.embed, self.caption)
    	except:
    		print "posteado en el blog primario"
    	self.Close()
Example #12
0
    def OnCreatePhoto(self, evt):
    	self.source = self.tc_photourl.GetValue()
    	if not self.source:
    		self.source = None

    	self.data = self.b_browse.GetValue()
    	if not self.data:
    		self.data = None

    	self.caption = self.tc_caption.GetValue().encode('utf-8')
    	self.click  = self.tc_photolink.GetValue()
        
        if self.source or self.data:
            self.api = Api(self.api.name, self.api.email, self.api.password, self.private, self.date, self.tags)
            try:
                self.post = self.api.write_photo(self.source, self.data, self.caption, self.click)
            except:
                print "Posteado en el primario"
            self.OnCancel(self)
        else:
            Message('Photo is required')
Example #13
0
    def OnCreateAudio(self, evt):
    	self.data = self.b_browse.GetValue()
    	if not self.data:
    		self.data =None
    	
    	"""
    	Not supported in the tumblr api at this time
    	self.source = self.tc_audiofileurl.GetValue()
    	if not self.source:
    		self.source = None
    	"""
    	self.source = None    	
    	self.caption = self.tc_caption.GetValue().encode('utf-8')

        if self.data or self.source:
            self.api = Api(self.api.name, self.api.email, self.api.password, self.private, self.date, self.tags)
            try:
                self.post = self.api.write_audio(self.data, self.source, self.caption)
            except:
                print "audio posteado en el blog primario"
            self.OnCancel(self)
        else:
            Message('Audio File is required')
Example #14
0
    def OnAuthTumblr(self, event):
    	self.Blog = self.tc_blog.GetValue()
    	#if not self.Blog:
    		#self.Blog = ''
    		#assert False,self.Blog
    		#print "Conectado al blog primario: "
    	self.User = self.tc_mail.GetValue()
    	self.Password = self.tc_password.GetValue()
    	
    	self.api = Api(self.Blog, self.User, self.Password)
    	#assert False,dir(self.api)
    	try:
			self.auth = self.api.auth_check()
			self.panel.Destroy()
			self.dashboard = Dashboard(self, -1)
    		#print "Te haz logueado"
    	except opentumblr.tumblr.TumblrAuthError:
    		self.invalid = Invalid(self)
    		self.invalid.Show()
    		print errors['403']
    	except urllib2.HTTPError:
    		print errors['404']
    	except urllib2.URLError:
    		print errors['urlopen']
Example #15
0
class Video(wx.Panel):
    def __init__(self, parent, id):
        wx.Panel.__init__(self, parent, id)
        self.parent = parent
        self.api = self.parent.api
        self.tags = None
        self.date = None
        self.private = 0

        self.p_main = wx.Panel(self, -1)
        self.s_video_staticbox = wx.StaticBox(self.p_main, -1, "")
        self.b_options = wx.Button(self.p_main, -1, "Advanced  options")
        self.l_addvideo = wx.StaticText(self.p_main, -1, "Add a Video")
        self.l_embed = wx.StaticText(self.p_main, -1, "Embed a Video")
        self.label_1 = wx.StaticText(self.p_main, -1, "This can be a URL from video sites like YouTube or Vimeo, \nor the raw Embed-tag from any video/flash site. \n(ie. http://youtube.com/watch?v=oCmAD-z7-mA)")
        self.tc_embed = wx.TextCtrl(self.p_main, -1, "")
        self.l_caption = wx.StaticText(self.p_main, -1, "Caption (optional)")
        self.tc_caption = wx.TextCtrl(self.p_main, -1, "", style=wx.TE_MULTILINE)
        self.b_create = wx.Button(self.p_main, -1, "Create post")
        self.b_cancel = wx.Button(self.p_main, -1, "Cancel")
        
        self.Bind(wx.EVT_BUTTON, self.AdvancedOptions, id = self.b_options.GetId())
        self.Bind(wx.EVT_BUTTON, self.OnCreateVideo, id = self.b_create.GetId())
        self.Bind(wx.EVT_BUTTON, self.OnCancel, id = self.b_cancel.GetId())

        self.__set_properties()
        self.__do_layout()

    def __set_properties(self):
        self.SetFont(wx.Font(11, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Lucida Grande"))
        self.l_addvideo.SetFont(wx.Font(15, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.l_embed.SetFont(wx.Font(15, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        self.label_1.SetForegroundColour(wx.Colour(35, 142, 107))
        self.label_1.SetFont(wx.Font(9, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Lucida Grande"))
        #self.tc_embed.SetMinSize((250, 117))
        self.l_caption.SetFont(wx.Font(15, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        #self.tc_caption.SetMinSize((250, 118))
        self.p_main.SetBackgroundColour(wx.Colour(255, 255, 255))

    def __do_layout(self):
	    s_main = wx.BoxSizer(wx.VERTICAL)
	    s_video = wx.StaticBoxSizer(self.s_video_staticbox, wx.VERTICAL)
	    s_buttons = wx.BoxSizer(wx.HORIZONTAL)
	    s_video.Add(self.b_options, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 2)
	    s_video.Add(self.l_addvideo, 0, wx.ALL, 2)
	    s_video.Add(self.l_embed, 0, wx.ALL, 2)
	    s_video.Add(self.label_1, 0, wx.ALL, 2)
	    s_video.Add(self.tc_embed, 1, wx.ALL|wx.EXPAND, 2)
	    s_video.Add(self.l_caption, 0, wx.ALL, 2)
	    s_video.Add(self.tc_caption, 1, wx.ALL|wx.EXPAND, 2)
	    s_buttons.Add(self.b_create, 1, wx.LEFT|wx.EXPAND, 2)
	    s_buttons.Add(self.b_cancel, 1, wx.LEFT|wx.EXPAND, 2)
	    s_video.Add(s_buttons, 0, wx.ALL|wx.EXPAND, 2)
	    self.p_main.SetSizer(s_video)
	    s_main.Add(self.p_main, 1, wx.ALL|wx.EXPAND, 10)
	    self.SetSizer(s_main)
	    s_main.Fit(self)
        #self.SetSizer(s_video)
        #s_video.Fit(self)

    def AdvancedOptions(self, evt):
        self.options = AdvancedOptions(self, -1)
        self.options.Center()
        if self.options.ShowModal() == wx.ID_OK:
            self.tags = self.options.tc_tag.GetValue().encode('utf-8')
            self.tags = string.replace(self.tags,' ', ',')
            self.date = self.options.tc_date.GetValue().encode('utf-8')

            if self.options.cb_publishing.GetValue() == 'private':
                self.private = 1
            else:
                self.private = 0

            if self.options.cb_publishing.GetValue() == 'add to queue':
                self.date = 'on.2'
        self.options.Destroy()
    
    def OnCreateVideo(self, evt):
    	self.embed = self.tc_embed.GetValue()
    	self.caption = self.tc_caption.GetValue().encode('utf-8')

        if self.embed:
            self.api = Api(self.api.name, self.api.email, self.api.password, self.private, self.date, self.tags)
            try:
                self.post = self.api.write_video(self.embed, self.caption)
            except:
                print "posteado en el blog primario"
            self.OnCancel(self)
        else:
            Message('Embed a video is required')
            
    def OnCancel(self, evt):
	    """ Sirve para cancel y cerrar la opcion de text """
	    self.parent.SetPanel(None)
Example #16
0
class Quote(wx.Dialog):
    def __init__(self, parent, id):
        # begin wxGlade: Quote.__init__
        self.parent = parent
        self.api = self.parent.api
        wx.Dialog.__init__(self, parent, id, style = wx.DEFAULT_DIALOG_STYLE)
        self.panel = wx.Panel(self, -1)
        self.p_options = wx.Panel(self.panel, -1)
        self.p_quote = wx.Panel(self.panel, -1)
        self.s_options_staticbox = wx.StaticBox(self.p_options, -1, "")
        self.s_quote_staticbox = wx.StaticBox(self.p_quote, -1, "")
        self.l_addquote = wx.StaticText(self.p_quote, -1, "Add a Quote")
        self.l_quote = wx.StaticText(self.p_quote, -1, "Quote")
        self.tc_quote = wx.TextCtrl(self.p_quote, -1, "")
        self.l_source = wx.StaticText(self.p_quote, -1, "Source ( optional )")
        self.tc_source = wx.TextCtrl(self.p_quote, -1, "")
        self.b_create = wx.Button(self.p_quote, -1, "Create post")
        self.b_preview = wx.Button(self.p_quote, -1, "Preview")
        self.b_cancel = wx.Button(self.p_quote, -1, "Cancel")
        self.b_options = wx.Button(self.p_options, -1, "Advanced  options")
        self.l_publishing = wx.StaticText(self.p_options, -1, "Publishing options")
        self.cb_publishing = wx.ComboBox(self.p_options, -1, choices=["publish now", "add to queue", "publish on...", "save as draft", "private"], style=wx.CB_DROPDOWN)
        self.l_date = wx.StaticText(self.p_options, -1, "Date this post")
        self.tc_date = wx.TextCtrl(self.p_options, -1, "")
        self.l_tag = wx.StaticText(self.p_options, -1, "Tag this post")
        self.tc_tag = wx.TextCtrl(self.p_options, -1, "", style=wx.TE_MULTILINE)
        self.l_url = wx.StaticText(self.p_options, -1, "Set a custom post URL")
        self.tc_url = wx.TextCtrl(self.p_options, -1, "/post/123456/")

        self.Bind(wx.EVT_BUTTON, self.OnCreateQuote, id = self.b_create.GetId())
        self.Bind(wx.EVT_BUTTON, self.OnCancel, id = self.b_cancel.GetId())
        self.Bind(wx.EVT_COMBOBOX, self.GetParent().OnPublishingOptions, id = self.cb_publishing.GetId())

        self.__set_properties()
        self.__do_layout()
        # end wxGlade

    def __set_properties(self):
        # begin wxGlade: Quote.__set_properties
        self.SetTitle("Add a Quote")
        self.SetBackgroundColour(wx.Colour(55, 85, 113))
        self.l_addquote.SetMinSize((-1, 80))
        self.l_addquote.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.l_addquote.SetFont(wx.Font(40, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.l_quote.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.l_quote.SetFont(wx.Font(25, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        self.tc_quote.SetMinSize((600, 150))
        self.tc_quote.SetFont(wx.Font(25, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 1, ""))
        self.l_source.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.l_source.SetFont(wx.Font(25, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        self.tc_source.SetMinSize((600, 150))
        self.tc_source.SetFont(wx.Font(25, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        self.p_quote.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.b_options.SetMinSize((141, 30))
        self.l_publishing.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.cb_publishing.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.cb_publishing.SetSelection(0)
        self.l_date.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.tc_date.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.l_tag.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.tc_tag.SetMinSize((201, 80))
        self.tc_tag.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.l_url.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.tc_url.SetBackgroundColour(wx.Colour(221, 221, 221))
        self.tc_url.SetForegroundColour(wx.Colour(192, 192, 192))
        self.tc_url.SetFont(wx.Font(13, wx.DECORATIVE, wx.NORMAL, wx.NORMAL, 0, "Lucida Grande"))
        self.p_options.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.panel.SetBackgroundColour(wx.Colour(55, 85, 113))
        # end wxGlade

    def __do_layout(self):
        # begin wxGlade: Quote.__do_layout
        sizer_1 = wx.BoxSizer(wx.VERTICAL)
        gs_quote = wx.FlexGridSizer(1, 2, 0, 0)
        s_options = wx.StaticBoxSizer(self.s_options_staticbox, wx.VERTICAL)
        s_quote = wx.StaticBoxSizer(self.s_quote_staticbox, wx.VERTICAL)
        s_buttons = wx.BoxSizer(wx.HORIZONTAL)
        s_quote.Add(self.l_addquote, 0, wx.ALL|wx.EXPAND, 2)
        s_quote.Add(self.l_quote, 0, wx.ALL|wx.EXPAND, 2)
        s_quote.Add(self.tc_quote, 0, wx.ALL|wx.EXPAND, 10)
        s_quote.Add(self.l_source, 0, wx.ALL|wx.EXPAND, 2)
        s_quote.Add(self.tc_source, 0, wx.ALL|wx.EXPAND, 10)
        s_buttons.Add(self.b_create, 0, wx.ALL|wx.EXPAND, 2)
        s_buttons.Add(self.b_preview, 0, wx.ALL|wx.EXPAND, 2)
        s_buttons.Add(self.b_cancel, 0, wx.LEFT|wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 363)
        s_quote.Add(s_buttons, 1, wx.ALL|wx.EXPAND, 2)
        self.p_quote.SetSizer(s_quote)
        gs_quote.Add(self.p_quote, 1, wx.ALL|wx.EXPAND, 20)
        s_options.Add(self.b_options, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 30)
        s_options.Add(self.l_publishing, 0, wx.ALL|wx.EXPAND, 5)
        s_options.Add(self.cb_publishing, 0, wx.ALL|wx.EXPAND, 5)
        s_options.Add(self.l_date, 0, wx.ALL|wx.EXPAND, 5)
        s_options.Add(self.tc_date, 0, wx.ALL|wx.EXPAND, 5)
        s_options.Add(self.l_tag, 0, wx.ALL|wx.EXPAND, 5)
        s_options.Add(self.tc_tag, 0, wx.ALL|wx.EXPAND, 5)
        s_options.Add(self.l_url, 0, wx.ALL|wx.EXPAND, 5)
        s_options.Add(self.tc_url, 0, wx.ALL|wx.EXPAND, 5)
        self.p_options.SetSizer(s_options)
        gs_quote.Add(self.p_options, 1, wx.ALL|wx.EXPAND, 20)
        self.panel.SetSizer(gs_quote)
        sizer_1.Add(self.panel, 1, wx.EXPAND, 0)
        self.SetSizer(sizer_1)
        sizer_1.Fit(self)
        self.Layout()
        # end wxGlade

# end of class Quote
    def OnCreateQuote(self, evt):
    	self.quote = self.tc_quote.GetValue().encode('utf-8')
    	self.source = self.tc_source.GetValue().encode('utf-8')
        self.tags = self.tc_tag.GetValue().encode('utf-8')
        self.tags = string.replace(self.tags,' ', ',')
        self.date = self.tc_date.GetValue().encode('utf-8')

        if self.cb_publishing.GetValue() == 'private':
        	self.private = 1
        else:
        	self.private = 0


        #self.format = None
        self.api = Api(self.api.name, self.api.email, self.api.password, self.private, self.date, self.tags)
    	try:
    		self.post = self.api.write_quote(self.quote, self.source)
    	except:
    		print "posteado en el blog primario"
    	self.Close()

    def OnCancel(self, evt):
        self.Close()
Example #17
0
class Text(wx.Panel):
    def __init__(self, parent, id):
        wx.Panel.__init__(self, parent, id)
        self.parent = parent
        self.api = self.parent.api
        self.tags = None
        self.date = None
        self.private = 0
        self.p_main = wx.Panel(self, -1)

        self.s_text_staticbox = wx.StaticBox(self.p_main, -1, "")
        self.b_options = wx.Button(self.p_main, -1, "Advanced  options")
        self.l_text = wx.StaticText(self.p_main, -1, "Add a Text Post")
        self.l_title = wx.StaticText(self.p_main, -1, "Title (optional)")
        self.tc_title = wx.TextCtrl(self.p_main, -1, "")
        self.l_post = wx.StaticText(self.p_main, -1, "Post")
        self.tc_post = wx.TextCtrl(self.p_main, -1, "", style=wx.TE_MULTILINE)
        self.b_create = wx.Button(self.p_main, -1, "Create post")
        self.b_cancel = wx.Button(self.p_main, -1, "Cancel")
        
        self.Bind(wx.EVT_BUTTON, self.AdvancedOptions, id = self.b_options.GetId())
        self.Bind(wx.EVT_BUTTON, self.OnCreatePost, id = self.b_create.GetId())
        self.Bind(wx.EVT_BUTTON, self.OnCancel, id = self.b_cancel.GetId())

        self.__set_properties()
        self.__do_layout()

    def __set_properties(self):
        self.l_text.SetFont(wx.Font(15, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.l_title.SetFont(wx.Font(15, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        self.l_post.SetFont(wx.Font(15, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        #self.tc_post.SetMinSize((250, 250))
        #self.b_create.SetFont(wx.Font(13, wx.DECORATIVE, wx.NORMAL, wx.NORMAL, 0, "Lucida Grande"))
        self.p_main.SetBackgroundColour(wx.Colour(255, 255, 255))

    def __do_layout(self):
	    s_main = wx.BoxSizer(wx.VERTICAL)
	    s_text = wx.StaticBoxSizer(self.s_text_staticbox, wx.VERTICAL)
	    s_buttons = wx.BoxSizer(wx.HORIZONTAL)
	    s_text.Add(self.b_options, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 2)
	    s_text.Add(self.l_text, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 2)
	    s_text.Add(self.l_title, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 2)
	    s_text.Add(self.tc_title, 0, wx.ALL|wx.EXPAND, 2)
	    s_text.Add(self.l_post, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 2)
	    s_text.Add(self.tc_post, 1, wx.ALL|wx.EXPAND, 2)
	    s_buttons.Add(self.b_create, 1, wx.LEFT|wx.EXPAND, 2)
	    s_buttons.Add(self.b_cancel, 1, wx.LEFT|wx.EXPAND, 2)
	    s_text.Add(s_buttons, 0, wx.ALL|wx.EXPAND, 2)
	    self.p_main.SetSizer(s_text)
	    s_main.Add(self.p_main, 1, wx.ALL|wx.EXPAND, 10)
	    self.SetSizer(s_main)
	    s_main.Fit(self)
        #self.SetSizer(s_text)
        #s_text.Fit(self)

    def AdvancedOptions(self, evt):
        self.options = AdvancedOptions(self, -1)
        self.options.Center()
        if self.options.ShowModal() == wx.ID_OK:
            self.tags = self.options.tc_tag.GetValue().encode('utf-8')
            self.tags = string.replace(self.tags,' ', ',')
            self.date = self.options.tc_date.GetValue().encode('utf-8')

            if self.options.cb_publishing.GetValue() == 'private':
                self.private = 1
            else:
            	self.private = 0

            if self.options.cb_publishing.GetValue() == 'add to queue':
                self.date = 'on.2'
        self.options.Destroy()
                
    def OnCreatePost(self, evt):
    	self.title = self.tc_title.GetValue().encode('utf-8')
    	self.body = self.tc_post.GetValue().encode('utf-8')
            
        if self.body:
            self.api = Api(self.api.name, self.api.email, self.api.password, self.private, self.date, self.tags)
            try:
                self.post = self.api.write_regular(self.title, self.body)
            except:
                print "Posteado en blog primario"
            self.OnCancel(self)
        else:
            Message("Post is required")

    def OnCancel(self, evt):
        """ Sirve para cancel y cerrar la opcion de text """
        self.parent.SetPanel(None)
Example #18
0
class Chat(wx.Dialog):
    def __init__(self, parent, id):
        # begin wxGlade: Chat.__init__
        self.parent = parent
        self.api = self.parent.api
        wx.Dialog.__init__(self, parent, id, style = wx.DEFAULT_DIALOG_STYLE)
        self.panel = wx.Panel(self, -1)
        self.p_options = wx.Panel(self.panel, -1)
        self.p_chat = wx.Panel(self.panel, -1)
        self.s_options_staticbox = wx.StaticBox(self.p_options, -1, "")
        self.s_chat_staticbox = wx.StaticBox(self.p_chat, -1, "")
        self.l_addchat = wx.StaticText(self.p_chat, -1, "Add a Chat Post")
        self.l_title = wx.StaticText(self.p_chat, -1, "Title (optional)")
        self.tc_title = wx.TextCtrl(self.p_chat, -1, "")
        self.l_dialogue = wx.StaticText(self.p_chat, -1, "Dialogue")
        self.l_example = wx.StaticText(self.p_chat, -1, "Example")
        self.l_tourist = wx.StaticText(self.p_chat, -1, "Tourist: Could you give us directions to Olive Garden?")
        self.l_nyorker = wx.StaticText(self.p_chat, -1, "New Yorker: No, but I could give you directions to an actual Italian restaurant.")
        self.tc_dialogue = wx.TextCtrl(self.p_chat, -1, "", style=wx.TE_MULTILINE)
        self.b_create = wx.Button(self.p_chat, -1, "Create post")
        self.b_preview = wx.Button(self.p_chat, -1, "Preview")
        self.b_cancel = wx.Button(self.p_chat, -1, "Cancel")
        self.b_options = wx.Button(self.p_options, -1, "Advanced  options")
        self.l_publishing = wx.StaticText(self.p_options, -1, "Publishing options")
        self.cb_publishing = wx.ComboBox(self.p_options, -1, choices=["publish now", "add to queue", "publish on...", "save as draft", "private"], style=wx.CB_DROPDOWN)
        self.l_date = wx.StaticText(self.p_options, -1, "Date this post")
        self.tc_date = wx.TextCtrl(self.p_options, -1, "")
        self.l_tag = wx.StaticText(self.p_options, -1, "Tag this post")
        self.tc_tag = wx.TextCtrl(self.p_options, -1, "", style=wx.TE_MULTILINE)
        self.l_url = wx.StaticText(self.p_options, -1, "Set a custom post URL")
        self.tc_url = wx.TextCtrl(self.p_options, -1, "/post/123456/")

        self.Bind(wx.EVT_BUTTON, self.OnCreateChat, id = self.b_create.GetId())
        self.Bind(wx.EVT_BUTTON, self.OnCancel, id = self.b_cancel.GetId())
        self.Bind(wx.EVT_COMBOBOX, self.GetParent().OnPublishingOptions, id = self.cb_publishing.GetId())

        self.__set_properties()
        self.__do_layout()
        # end wxGlade

    def __set_properties(self):
        # begin wxGlade: Chat.__set_properties
        self.SetTitle("Add Text Post")
        self.SetBackgroundColour(wx.Colour(55, 85, 113))
        self.l_addchat.SetMinSize((-1, 80))
        self.l_addchat.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.l_addchat.SetFont(wx.Font(40, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.l_title.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.l_title.SetFont(wx.Font(25, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        self.tc_title.SetMinSize((600, 50))
        self.tc_title.SetFont(wx.Font(25, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 1, ""))
        self.l_dialogue.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.l_dialogue.SetFont(wx.Font(25, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        self.l_example.SetBackgroundColour(wx.Colour(216, 216, 191))
        self.l_example.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.l_tourist.SetBackgroundColour(wx.Colour(216, 216, 191))
        self.l_nyorker.SetBackgroundColour(wx.Colour(216, 216, 191))
        self.tc_dialogue.SetMinSize((600, 150))
        self.tc_dialogue.SetFont(wx.Font(25, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        self.p_chat.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.b_options.SetMinSize((141, 30))
        self.l_publishing.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.cb_publishing.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.cb_publishing.SetSelection(0)
        self.l_date.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.tc_date.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.l_tag.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.tc_tag.SetMinSize((201, 80))
        self.tc_tag.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.l_url.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.tc_url.SetBackgroundColour(wx.Colour(221, 221, 221))
        self.tc_url.SetForegroundColour(wx.Colour(192, 192, 192))
        self.tc_url.SetFont(wx.Font(13, wx.DECORATIVE, wx.NORMAL, wx.NORMAL, 0, "Lucida Grande"))
        self.p_options.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.panel.SetBackgroundColour(wx.Colour(55, 85, 113))
        # end wxGlade

    def __do_layout(self):
        # begin wxGlade: Chat.__do_layout
        sizer = wx.BoxSizer(wx.VERTICAL)
        gs_chat = wx.FlexGridSizer(1, 2, 0, 0)
        s_options = wx.StaticBoxSizer(self.s_options_staticbox, wx.VERTICAL)
        s_chat = wx.StaticBoxSizer(self.s_chat_staticbox, wx.VERTICAL)
        s_buttons = wx.BoxSizer(wx.HORIZONTAL)
        s_chat.Add(self.l_addchat, 0, wx.ALL|wx.EXPAND, 2)
        s_chat.Add(self.l_title, 0, wx.ALL|wx.EXPAND, 2)
        s_chat.Add(self.tc_title, 0, wx.ALL|wx.EXPAND, 10)
        s_chat.Add(self.l_dialogue, 0, wx.ALL|wx.EXPAND, 2)
        s_chat.Add(self.l_example, 0, wx.LEFT|wx.TOP|wx.EXPAND, 2)
        s_chat.Add(self.l_tourist, 0, wx.LEFT|wx.EXPAND, 2)
        s_chat.Add(self.l_nyorker, 0, wx.LEFT|wx.EXPAND, 2)
        s_chat.Add(self.tc_dialogue, 0, wx.ALL|wx.EXPAND, 10)
        s_buttons.Add(self.b_create, 0, wx.ALL|wx.EXPAND, 2)
        s_buttons.Add(self.b_preview, 0, wx.ALL|wx.EXPAND, 2)
        s_buttons.Add(self.b_cancel, 0, wx.LEFT|wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 363)
        s_chat.Add(s_buttons, 1, wx.ALL|wx.EXPAND, 2)
        self.p_chat.SetSizer(s_chat)
        gs_chat.Add(self.p_chat, 1, wx.ALL|wx.EXPAND, 20)
        s_options.Add(self.b_options, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 30)
        s_options.Add(self.l_publishing, 0, wx.ALL|wx.EXPAND, 5)
        s_options.Add(self.cb_publishing, 0, wx.ALL|wx.EXPAND, 5)
        s_options.Add(self.l_date, 0, wx.ALL|wx.EXPAND, 5)
        s_options.Add(self.tc_date, 0, wx.ALL|wx.EXPAND, 5)
        s_options.Add(self.l_tag, 0, wx.ALL|wx.EXPAND, 5)
        s_options.Add(self.tc_tag, 0, wx.ALL|wx.EXPAND, 5)
        s_options.Add(self.l_url, 0, wx.ALL|wx.EXPAND, 5)
        s_options.Add(self.tc_url, 0, wx.ALL|wx.EXPAND, 5)
        self.p_options.SetSizer(s_options)
        gs_chat.Add(self.p_options, 1, wx.ALL|wx.EXPAND, 20)
        self.panel.SetSizer(gs_chat)
        sizer.Add(self.panel, 1, wx.EXPAND, 0)
        self.SetSizer(sizer)
        sizer.Fit(self)
        self.Layout()
        # end wxGlade

# end of class Chat
    def OnCreateChat(self, evt):
    	self.title = self.tc_title.GetValue().encode('utf-8')
    	self.conversation = self.tc_dialogue.GetValue().encode('utf-8')
        self.tags = self.tc_tag.GetValue().encode('utf-8')
        self.tags = string.replace(self.tags,' ', ',')
        self.date = self.tc_date.GetValue().encode('utf-8')

        if self.cb_publishing.GetValue() == 'private':
        	self.private = 1
        else:
        	self.private = 0


        #self.format = None
        self.api = Api(self.api.name, self.api.email, self.api.password, self.private, self.date, self.tags)
    	try:
    		self.post = self.api.write_conversation(self.title, self.conversation)
    	except:
    		print "posteado en el blog primario"
    	self.Close()

    def OnCancel(self, evt):
	    self.Close()
Example #19
0
class Photo(wx.Panel):
    def __init__(self, parent, id):
        wx.Panel.__init__(self, parent, id)
        self.parent = parent
        self.api = self.parent.api
        self.tags = None
        self.date = None
        self.private = 0

        self.p_main = wx.Panel(self, -1)
        self.s_photo_staticbox = wx.StaticBox(self.p_main, -1, "")
        self.b_options = wx.Button(self.p_main, -1, "Advanced  options")
        self.s_browse_staticbox = wx.StaticBox(self.p_main, -1, "")
        self.l_addphoto = wx.StaticText(self.p_main, -1, "Upload a Photo")
        self.l_photo = wx.StaticText(self.p_main, -1, "Photo")
        self.b_browse = filebrowse.FileBrowseButton(self.p_main, -1)
        self.l_supports = wx.StaticText(self.p_main, -1, "Supports JPEG, GIF, PNG and BMP.  Max photo size is 10 MB.     ")
        self.l_photourl = wx.StaticText(self.p_main, -1, "Photo Url")
        self.tc_photourl = wx.TextCtrl(self.p_main, -1, "")
        self.l_caption = wx.StaticText(self.p_main, -1, "Caption")
        self.tc_caption = wx.TextCtrl(self.p_main, -1, "", style=wx.TE_MULTILINE)
        self.l_photolink = wx.StaticText(self.p_main, -1, "Photo links to the URL")
        self.tc_photolink = wx.TextCtrl(self.p_main, -1, "")
        self.b_create = wx.Button(self.p_main, -1, "Create post")
        self.b_cancel = wx.Button(self.p_main, -1, "Cancel")
        
        self.Bind(wx.EVT_BUTTON, self.AdvancedOptions, id = self.b_options.GetId())
        self.Bind(wx.EVT_BUTTON, self.OnCreatePhoto, id = self.b_create.GetId())
        self.Bind(wx.EVT_BUTTON, self.OnCancel, id = self.b_cancel.GetId())

        self.__set_properties()
        self.__do_layout()

    def __set_properties(self):
        self.l_addphoto.SetFont(wx.Font(15, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.l_photo.SetFont(wx.Font(15, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        self.l_supports.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.l_photourl.SetFont(wx.Font(15, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        self.tc_photourl.SetMinSize((-1, -1))
        self.tc_photourl.SetFont(wx.Font(15, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        self.l_caption.SetFont(wx.Font(15, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        self.tc_caption.SetFont(wx.Font(15, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Lucida Grande"))
        #self.tc_caption.SetMinSize((100, 120))
        self.tc_photolink.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.tc_photolink.SetFont(wx.Font(11, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        self.p_main.SetBackgroundColour(wx.Colour(255, 255, 255))

    def __do_layout(self):
	    s_main = wx.BoxSizer(wx.VERTICAL)
	    s_photo = wx.StaticBoxSizer(self.s_photo_staticbox, wx.VERTICAL)
	    s_buttons = wx.BoxSizer(wx.HORIZONTAL)
	    s_photolink = wx.BoxSizer(wx.VERTICAL)
	    s_photourl = wx.BoxSizer(wx.HORIZONTAL)
	    s_browse = wx.StaticBoxSizer(self.s_browse_staticbox, wx.HORIZONTAL)
	    s_photo.Add(self.b_options, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 2)
	    s_photo.Add(self.l_addphoto, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 2)
	    s_photo.Add(self.l_photo, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 2)
	    s_browse.Add(self.b_browse, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 2)
	    s_photo.Add(s_browse, 0, wx.EXPAND, 0)
	    s_photo.Add(self.l_supports, 0, wx.BOTTOM, 20)
	    s_photourl.Add(self.l_photourl, 0, wx.ALL, 2)
	    s_photourl.Add(self.tc_photourl, 1, wx.ALL|wx.EXPAND, 2)
	    s_photo.Add(s_photourl, 0, wx.EXPAND, 0)
	    s_photo.Add(self.l_caption, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 2)
	    s_photo.Add(self.tc_caption, 1, wx.ALL|wx.EXPAND, 2)
	    s_photolink.Add(self.l_photolink, 0, wx.ALL, 2)
	    s_photolink.Add(self.tc_photolink, 0, wx.ALL|wx.EXPAND, 2)
	    s_photo.Add(s_photolink, 0, wx.EXPAND, 0)
	    s_buttons.Add(self.b_create, 1, wx.LEFT|wx.EXPAND, 2)
	    s_buttons.Add(self.b_cancel, 1, wx.LEFT|wx.EXPAND, 2)
	    s_photo.Add(s_buttons, 0, wx.ALL|wx.EXPAND, 2)
	    self.p_main.SetSizer(s_photo)
	    s_main.Add(self.p_main, 1, wx.ALL|wx.EXPAND, 10)
	    self.SetSizer(s_main)
	    s_main.Fit(self)

    def AdvancedOptions(self, evt):
        self.options = AdvancedOptions(self, -1)
        self.options.Center()
        if self.options.ShowModal() == wx.ID_OK:
            self.tags = self.options.tc_tag.GetValue().encode('utf-8')
            self.tags = string.replace(self.tags,' ', ',')
            self.date = self.options.tc_date.GetValue().encode('utf-8')

            if self.options.cb_publishing.GetValue() == 'private':
                self.private = 1
            else:
        	    self.private = 0

            if self.options.cb_publishing.GetValue() == 'add to queue':
                self.date = 'on.2'
        self.options.Destroy()

    def OnCreatePhoto(self, evt):
    	self.source = self.tc_photourl.GetValue()
    	if not self.source:
    		self.source = None

    	self.data = self.b_browse.GetValue()
    	if not self.data:
    		self.data = None

    	self.caption = self.tc_caption.GetValue().encode('utf-8')
    	self.click  = self.tc_photolink.GetValue()
        
        if self.source or self.data:
            self.api = Api(self.api.name, self.api.email, self.api.password, self.private, self.date, self.tags)
            try:
                self.post = self.api.write_photo(self.source, self.data, self.caption, self.click)
            except:
                print "Posteado en el primario"
            self.OnCancel(self)
        else:
            Message('Photo is required')
            
    def OnCancel(self, evt):
        """ Sirve para cancel y cerrar la opcion de text """
        self.parent.SetPanel(None)
Example #20
0
class Audio(wx.Panel):
    def __init__(self, parent, id):
        wx.Panel.__init__(self, parent, id)
        self.parent = parent
        self.api = self.parent.api
        self.tags = None
        self.date = None
        self.private = 0

        self.p_main = wx.Panel(self, -1)
        self.s_audio_staticbox = wx.StaticBox(self.p_main, -1, "")
        self.s_browse_staticbox = wx.StaticBox(self.p_main, -1, "")
        self.b_options = wx.Button(self.p_main, -1, "Advanced  options")
        self.l_addaudio = wx.StaticText(self.p_main, -1, "Upload an Audio Post")
        self.l_audiofile = wx.StaticText(self.p_main, -1, "Audio File")
        self.b_browse = filebrowse.FileBrowseButton(self.p_main, -1)
        
        """
        Not supported in the tumblr api at this time
        self.l_audiofileurl = wx.StaticText(self.p_main, -1, "Photo Url")
        self.tc_audiofileurl = wx.TextCtrl(self.p_main, -1, "")
        """
        
        self.l_caption = wx.StaticText(self.p_main, -1, "Caption (optional)")
        self.tc_caption = wx.TextCtrl(self.p_main, -1, "", style=wx.TE_MULTILINE)
        self.b_create = wx.Button(self.p_main, -1, "Create post")
        self.b_cancel = wx.Button(self.p_main, -1, "Cancel")
        
        self.Bind(wx.EVT_BUTTON, self.AdvancedOptions, id = self.b_options.GetId())
        self.Bind(wx.EVT_BUTTON, self.OnCreateAudio, id = self.b_create.GetId())
        self.Bind(wx.EVT_BUTTON, self.OnCancel, id = self.b_cancel.GetId())

        self.__set_properties()
        self.__do_layout()

    def __set_properties(self):
        self.l_addaudio.SetFont(wx.Font(15, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.l_audiofile.SetFont(wx.Font(15, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        
        """
        Not supported in the tumblr api at this time
        self.l_audiofileurl.SetFont(wx.Font(15, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        """
        
        self.l_caption.SetFont(wx.Font(15, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        #self.tc_caption.SetMinSize((250, 222))
        self.p_main.SetBackgroundColour(wx.Colour(255, 255, 255))

    def __do_layout(self):
	    s_main = wx.BoxSizer(wx.VERTICAL)
	    s_audio = wx.StaticBoxSizer(self.s_audio_staticbox, wx.VERTICAL)
	    s_buttons = wx.BoxSizer(wx.HORIZONTAL)
	    s_audio.Add(self.b_options, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 2)
	    s_audiofileurl = wx.BoxSizer(wx.HORIZONTAL)
	    s_browse = wx.StaticBoxSizer(self.s_browse_staticbox, wx.HORIZONTAL)
	    s_audio.Add(self.l_addaudio, 0, wx.ALL, 2)
	    s_audio.Add(self.l_audiofile, 0, wx.ALL, 2)
	    s_browse.Add(self.b_browse, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 2)
	    s_audio.Add(s_browse, 0, wx.EXPAND, 0)
	
	    """
	    Not supported in the tumblr api at this time
	    s_audiofileurl.Add(self.l_audiofileurl, 0, wx.ALL, 2)
	    s_audiofileurl.Add(self.tc_audiofileurl, 1, wx.ALL|wx.EXPAND, 2)
	    s_audio.Add(s_audiofileurl, 0, wx.EXPAND, 0)
	    """
	    s_audio.Add(self.l_caption, 0, wx.ALL, 2)
	    s_audio.Add(self.tc_caption, 1, wx.ALL|wx.EXPAND, 2)
	    s_buttons.Add(self.b_create, 1, wx.LEFT|wx.EXPAND, 2)
	    s_buttons.Add(self.b_cancel, 1, wx.LEFT|wx.EXPAND, 2)
	    s_audio.Add(s_buttons, 0, wx.ALL|wx.EXPAND, 2)
	    self.p_main.SetSizer(s_audio)
	    s_main.Add(self.p_main, 1, wx.ALL|wx.EXPAND, 10)
	    self.SetSizer(s_main)
	    s_main.Fit(self)

    def AdvancedOptions(self, evt):
        self.options = AdvancedOptions(self, -1)
        self.options.Center()
        if self.options.ShowModal() == wx.ID_OK:
            self.tags = self.options.tc_tag.GetValue().encode('utf-8')
            self.tags = string.replace(self.tags,' ', ',')
            self.date = self.options.tc_date.GetValue().encode('utf-8')

            if self.options.cb_publishing.GetValue() == 'private':
                self.private = 1
            else:
                self.private = 0

            if self.options.cb_publishing.GetValue() == 'add to queue':
                self.date = 'on.2'
        self.options.Destroy()
    
    def OnCreateAudio(self, evt):
    	self.data = self.b_browse.GetValue()
    	if not self.data:
    		self.data =None
    	
    	"""
    	Not supported in the tumblr api at this time
    	self.source = self.tc_audiofileurl.GetValue()
    	if not self.source:
    		self.source = None
    	"""
    	self.source = None    	
    	self.caption = self.tc_caption.GetValue().encode('utf-8')

        if self.data or self.source:
            self.api = Api(self.api.name, self.api.email, self.api.password, self.private, self.date, self.tags)
            try:
                self.post = self.api.write_audio(self.data, self.source, self.caption)
            except:
                print "audio posteado en el blog primario"
            self.OnCancel(self)
        else:
            Message('Audio File is required')

    def OnCancel(self, evt):
        """ Sirve para cancel y cerrar la opcion de text """
        self.parent.SetPanel(None)
Example #21
0
class Quote(wx.Panel):
    def __init__(self, parent, id):
        wx.Panel.__init__(self, parent, id)
        self.parent = parent
        self.api = self.parent.api
        self.tags = None
        self.date = None
        self.private = 0

        self.p_main = wx.Panel(self, -1)
        self.s_quote_staticbox = wx.StaticBox(self.p_main, -1, "")
        self.b_options = wx.Button(self.p_main, -1, "Advanced  options")
        self.l_addquote = wx.StaticText(self.p_main, -1, "Add a Quote")
        self.l_quote = wx.StaticText(self.p_main, -1, "Quote")
        self.tc_quote = wx.TextCtrl(self.p_main, -1, "")
        self.l_source = wx.StaticText(self.p_main, -1, "Source ( optional )")
        self.tc_source = wx.TextCtrl(self.p_main, -1, "")
        self.b_create = wx.Button(self.p_main, -1, "Create post")
        self.b_cancel = wx.Button(self.p_main, -1, "Cancel")
        
        self.Bind(wx.EVT_BUTTON, self.AdvancedOptions, id = self.b_options.GetId())
        self.Bind(wx.EVT_BUTTON, self.OnCreateQuote, id = self.b_create.GetId())
        self.Bind(wx.EVT_BUTTON, self.OnCancel, id = self.b_cancel.GetId())

        self.__set_properties()
        self.__do_layout()

    def __set_properties(self):
        self.l_addquote.SetFont(wx.Font(15, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.l_quote.SetFont(wx.Font(15, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        #self.tc_quote.SetMinSize((250, 130))
        self.l_source.SetFont(wx.Font(15, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        #self.tc_source.SetMinSize((250, 130))
        self.p_main.SetBackgroundColour(wx.Colour(255, 255, 255))

    def __do_layout(self):
	    s_main = wx.BoxSizer(wx.VERTICAL)
	    s_quote = wx.StaticBoxSizer(self.s_quote_staticbox, wx.VERTICAL)
	    s_buttons = wx.BoxSizer(wx.HORIZONTAL)
	    s_quote.Add(self.b_options, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 2)
	    s_quote.Add(self.l_addquote, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 2)
	    s_quote.Add(self.l_quote, 0, wx.ALL, 2)
	    s_quote.Add(self.tc_quote, 1, wx.ALL|wx.EXPAND, 5)
	    s_quote.Add(self.l_source, 0, wx.ALL, 2)
	    s_quote.Add(self.tc_source, 1, wx.ALL|wx.EXPAND, 5)
	    s_buttons.Add(self.b_create, 1, wx.LEFT|wx.EXPAND, 2)
	    s_buttons.Add(self.b_cancel, 1, wx.LEFT|wx.EXPAND, 2)
	    s_quote.Add(s_buttons, 0, wx.ALL|wx.EXPAND, 2)
	    self.p_main.SetSizer(s_quote)
	    s_main.Add(self.p_main, 1, wx.ALL|wx.EXPAND, 10)
	    self.SetSizer(s_main)
	    s_main.Fit(self)
        #self.SetSizer(s_quote)
        #s_quote.Fit(self)
        # end wxGlade

    def AdvancedOptions(self, evt):
        self.options = AdvancedOptions(self, -1)
        self.options.Center()
        if self.options.ShowModal() == wx.ID_OK:
            self.tags = self.options.tc_tag.GetValue().encode('utf-8')
            self.tags = string.replace(self.tags,' ', ',')
            self.date = self.options.tc_date.GetValue().encode('utf-8')

            if self.options.cb_publishing.GetValue() == 'private':
                self.private = 1
            else:
                self.private = 0

            if self.options.cb_publishing.GetValue() == 'add to queue':
                self.date = 'on.2'
        self.options.Destroy()

    def OnCreateQuote(self, evt):
    	self.quote = self.tc_quote.GetValue().encode('utf-8')
    	self.source = self.tc_source.GetValue().encode('utf-8')
        
        if self.quote:
            self.api = Api(self.api.name, self.api.email, self.api.password, self.private, self.date, self.tags)
            try:
                self.post = self.api.write_quote(self.quote, self.source)
            except:
                print "posteado en el blog primario"
            self.OnCancel(self)
        else:
            Message('Quote is required')

    def OnCancel(self, evt):
        """ Sirve para cancel y cerrar la opcion de text """
        self.parent.SetPanel(None)
Example #22
0
class Chat(wx.Panel):
    def __init__(self, parent, id):
        wx.Panel.__init__(self, parent, id)
        self.parent = parent
        self.api = self.parent.api
        self.tags = None
        self.date = None
        self.private = 0

        self.p_main = wx.Panel(self, -1)
        self.s_chat_staticbox = wx.StaticBox(self.p_main, -1, "")
        self.b_options = wx.Button(self.p_main, -1, "Advanced  options")
        self.l_addchat = wx.StaticText(self.p_main, -1, "Add a Chat Post")
        self.l_title = wx.StaticText(self.p_main, -1, "Title (optional)")
        self.tc_title = wx.TextCtrl(self.p_main, -1, "")
        self.l_dialogue = wx.StaticText(self.p_main, -1, "Dialogue")
        self.l_example = wx.StaticText(self.p_main, -1, "Example")
        self.l_tourist = wx.StaticText(self.p_main, -1, "Tourist: Could you give us directions to Olive Garden?")
        self.l_nyorker = wx.StaticText(self.p_main, -1, "New Yorker:No,but I could give you directions to an actual restaurant.")
        self.tc_dialogue = wx.TextCtrl(self.p_main, -1, "", style=wx.TE_MULTILINE)
        self.b_create = wx.Button(self.p_main, -1, "Create post")
        self.b_cancel = wx.Button(self.p_main, -1, "Cancel")
        
        self.Bind(wx.EVT_BUTTON, self.AdvancedOptions, id = self.b_options.GetId())
        self.Bind(wx.EVT_BUTTON, self.OnCreateChat, id = self.b_create.GetId())
        self.Bind(wx.EVT_BUTTON, self.OnCancel, id = self.b_cancel.GetId())

        self.__set_properties()
        self.__do_layout()

    def __set_properties(self):
        self.SetFont(wx.Font(11, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Lucida Grande"))
        self.l_addchat.SetFont(wx.Font(15, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.l_title.SetFont(wx.Font(15, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        self.l_dialogue.SetFont(wx.Font(15, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        self.l_example.SetBackgroundColour(wx.Colour(216, 216, 191))
        self.l_example.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.l_tourist.SetBackgroundColour(wx.Colour(216, 216, 191))
        self.l_tourist.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Lucida Grande"))
        self.l_nyorker.SetBackgroundColour(wx.Colour(216, 216, 191))
        self.l_nyorker.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Lucida Grande"))
        #self.tc_dialogue.SetMinSize((260, 202))
        self.p_main.SetBackgroundColour(wx.Colour(255, 255, 255))

    def __do_layout(self):
	    s_main = wx.BoxSizer(wx.VERTICAL)
	    s_chat = wx.StaticBoxSizer(self.s_chat_staticbox, wx.VERTICAL)
	    s_buttons = wx.BoxSizer(wx.HORIZONTAL)
	    s_chat.Add(self.b_options, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 2)
	    s_chat.Add(self.l_addchat, 0, wx.ALL, 2)
	    s_chat.Add(self.l_title, 0, wx.ALL, 2)
	    s_chat.Add(self.tc_title, 0, wx.ALL|wx.EXPAND, 10)
	    s_chat.Add(self.l_dialogue, 0, wx.ALL, 2)
	    s_chat.Add(self.l_example, 0, wx.LEFT|wx.TOP, 2)
	    s_chat.Add(self.l_tourist, 0, wx.LEFT, 2)
	    s_chat.Add(self.l_nyorker, 0, wx.LEFT, 2)
	    s_chat.Add(self.tc_dialogue, 1, wx.ALL|wx.EXPAND, 2)
	    s_buttons.Add(self.b_create, 1, wx.LEFT|wx.EXPAND, 2)
	    s_buttons.Add(self.b_cancel, 1, wx.LEFT|wx.EXPAND, 2)
	    s_chat.Add(s_buttons, 0, wx.ALL|wx.EXPAND, 2)
	    self.p_main.SetSizer(s_chat)
	    s_main.Add(self.p_main, 1, wx.ALL|wx.EXPAND, 10)
	    self.SetSizer(s_main)
	    s_main.Fit(self)
        #self.SetSizer(s_chat)
        #s_chat.Fit(self)

    def AdvancedOptions(self, evt):
        self.options = AdvancedOptions(self, -1)
        self.options.Center()
        if self.options.ShowModal() == wx.ID_OK:
            self.tags = self.options.tc_tag.GetValue().encode('utf-8')
            self.tags = string.replace(self.tags,' ', ',')
            self.date = self.options.tc_date.GetValue().encode('utf-8')

            if self.options.cb_publishing.GetValue() == 'private':
                self.private = 1
            else:
                self.private = 0

            if self.options.cb_publishing.GetValue() == 'add to queue':
                self.date = 'on.2'
        self.options.Destroy()

    def OnCreateChat(self, evt):
    	self.title = self.tc_title.GetValue().encode('utf-8')
    	self.conversation = self.tc_dialogue.GetValue().encode('utf-8')
        
        if self.conversation:
            self.api = Api(self.api.name, self.api.email, self.api.password, self.private, self.date, self.tags)
            try:
                self.post = self.api.write_conversation(self.title, self.conversation)
            except:
                print "posteado en el blog primario"
            self.OnCancel(self)
        else:
            Message('Dialogue is required')

    def OnCancel(self, evt):
	    """ Sirve para cancel y cerrar la opcion de text """
	    self.parent.SetPanel(None)
Example #23
0
class Photo(wx.Dialog):
    def __init__(self, parent, id):
        # begin wxGlade: Photo.__init__
        self.parent = parent
        self.api = self.parent.api
        wx.Dialog.__init__(self, parent, id, style = wx.DEFAULT_FRAME_STYLE)
        self.panel = wx.Panel(self, -1)
        self.p_options = wx.Panel(self.panel, -1)
        self.p_photo = wx.Panel(self.panel, -1)
        self.s_photourl_staticbox = wx.StaticBox(self.p_photo, -1, "")
        self.s_photolink_staticbox = wx.StaticBox(self.p_photo, -1, "")
        self.s_photo_staticbox = wx.StaticBox(self.p_photo, -1, "")
        self.s_options_staticbox = wx.StaticBox(self.p_options, -1, "")
        self.s_browse_staticbox = wx.StaticBox(self.p_photo, -1, "")
        self.l_addphoto = wx.StaticText(self.p_photo, -1, "Upload a Photo")
        self.l_photo = wx.StaticText(self.p_photo, -1, "Photo")
        self.b_browse = filebrowse.FileBrowseButton(self.p_photo, -1, size=(703, -1))
        self.l_supports = wx.StaticText(self.p_photo, -1, "Supports JPEG, GIF, PNG and BMP.  Max photo size is 10 MB.")
        self.l_photourl = wx.StaticText(self.p_photo, -1, "Photo Url")
        self.tc_photourl = wx.TextCtrl(self.p_photo, -1, "")
        self.l_caption = wx.StaticText(self.p_photo, -1, "Caption")
        self.tc_caption = wx.TextCtrl(self.p_photo, -1, "", style=wx.TE_MULTILINE)
        self.l_photolink = wx.StaticText(self.p_photo, -1, "Photo links to the URL")
        self.tc_photolink = wx.TextCtrl(self.p_photo, -1, "")
        self.b_create = wx.Button(self.p_photo, -1, "Create post")
        self.b_preview = wx.Button(self.p_photo, -1, "Preview")
        self.b_cancel = wx.Button(self.p_photo, -1, "Cancel")
        self.b_options = wx.Button(self.p_options, -1, "Advanced  options")
        self.l_publishing = wx.StaticText(self.p_options, -1, "Publishing options")
        self.cb_publishing = wx.ComboBox(self.p_options, -1, choices=["publish now", "add to queue", "publish on...", "save as draft", "private"], style=wx.CB_DROPDOWN)
        self.l_date = wx.StaticText(self.p_options, -1, "Date this post")
        self.tc_date = wx.TextCtrl(self.p_options, -1, "")
        self.l_tag = wx.StaticText(self.p_options, -1, "Tag this post")
        self.tc_tag = wx.TextCtrl(self.p_options, -1, "", style=wx.TE_MULTILINE)
        self.l_url = wx.StaticText(self.p_options, -1, "Set a custom post URL")
        self.tc_url = wx.TextCtrl(self.p_options, -1, "/post/123456/")

        self.Bind(wx.EVT_BUTTON, self.OnCreatePhoto, id = self.b_create.GetId())
        self.Bind(wx.EVT_BUTTON, self.OnCancel, id = self.b_cancel.GetId())
        self.Bind(wx.EVT_COMBOBOX, self.GetParent().OnPublishingOptions, id = self.cb_publishing.GetId())

        self.__set_properties()
        self.__do_layout()
        # end wxGlade

    def __set_properties(self):
        # begin wxGlade: Photo.__set_properties
        self.SetTitle("Upload a Photo")
        self.l_addphoto.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.l_addphoto.SetFont(wx.Font(40, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.l_photo.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.l_photo.SetFont(wx.Font(25, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        self.l_supports.SetFont(wx.Font(11, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.l_photourl.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.l_photourl.SetFont(wx.Font(25, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        self.tc_photourl.SetMinSize((500, 25))
        self.tc_photourl.SetFont(wx.Font(15, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        self.l_caption.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.l_caption.SetFont(wx.Font(25, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        self.tc_caption.SetMinSize((640, 100))
        self.tc_caption.SetFont(wx.Font(15, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Lucida Grande"))
        self.l_photolink.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.tc_photolink.SetMinSize((624, 50))
        self.tc_photolink.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.tc_photolink.SetFont(wx.Font(25, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        self.p_photo.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.b_options.SetMinSize((141, 30))
        self.l_publishing.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.cb_publishing.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.cb_publishing.SetSelection(0)
        self.l_date.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.tc_date.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.l_tag.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.tc_tag.SetMinSize((201, 80))
        self.tc_tag.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.l_url.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.tc_url.SetBackgroundColour(wx.Colour(221, 221, 221))
        self.tc_url.SetForegroundColour(wx.Colour(192, 192, 192))
        self.tc_url.SetFont(wx.Font(13, wx.DECORATIVE, wx.NORMAL, wx.NORMAL, 0, "Lucida Grande"))
        self.p_options.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.panel.SetBackgroundColour(wx.Colour(55, 85, 113))
        # end wxGlade

    def __do_layout(self):
        # begin wxGlade: Photo.__do_layout
        sizer = wx.BoxSizer(wx.VERTICAL)
        gs_photo = wx.FlexGridSizer(1, 2, 0, 0)
        s_options = wx.StaticBoxSizer(self.s_options_staticbox, wx.VERTICAL)
        s_photo = wx.StaticBoxSizer(self.s_photo_staticbox, wx.VERTICAL)
        s_buttons = wx.BoxSizer(wx.HORIZONTAL)
        s_photolink = wx.StaticBoxSizer(self.s_photolink_staticbox, wx.VERTICAL)
        s_photourl = wx.StaticBoxSizer(self.s_photourl_staticbox, wx.HORIZONTAL)
        s_browse = wx.StaticBoxSizer(self.s_browse_staticbox, wx.HORIZONTAL)
        s_photo.Add(self.l_addphoto, 0, wx.ALL|wx.EXPAND, 2)
        s_photo.Add(self.l_photo, 0, wx.ALL|wx.EXPAND, 2)
        s_browse.Add(self.b_browse, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 2)
        s_photo.Add(s_browse, 0, wx.EXPAND, 0)
        s_photo.Add(self.l_supports, 0, wx.BOTTOM|wx.EXPAND, 40)
        s_photourl.Add(self.l_photourl, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 2)
        s_photourl.Add(self.tc_photourl, 0, wx.ALL|wx.EXPAND, 2)
        s_photo.Add(s_photourl, 1, wx.EXPAND, 0)
        s_photo.Add(self.l_caption, 0, wx.ALL|wx.EXPAND, 2)
        s_photo.Add(self.tc_caption, 0, wx.ALL, 10)
        s_photolink.Add(self.l_photolink, 0, wx.ALL|wx.EXPAND, 2)
        s_photolink.Add(self.tc_photolink, 0, wx.ALL|wx.EXPAND, 2)
        s_photo.Add(s_photolink, 1, wx.EXPAND, 0)
        s_buttons.Add(self.b_create, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 2)
        s_buttons.Add(self.b_preview, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 2)
        s_buttons.Add(self.b_cancel, 0, wx.LEFT|wx.ALIGN_CENTER_VERTICAL, 400)
        s_photo.Add(s_buttons, 0, wx.ALL|wx.EXPAND, 2)
        self.p_photo.SetSizer(s_photo)
        gs_photo.Add(self.p_photo, 1, wx.ALL|wx.EXPAND, 20)
        s_options.Add(self.b_options, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 30)
        s_options.Add(self.l_publishing, 0, wx.ALL|wx.EXPAND, 5)
        s_options.Add(self.cb_publishing, 0, wx.ALL|wx.EXPAND, 5)
        s_options.Add(self.l_date, 0, wx.ALL|wx.EXPAND, 5)
        s_options.Add(self.tc_date, 0, wx.ALL|wx.EXPAND, 5)
        s_options.Add(self.l_tag, 0, wx.ALL|wx.EXPAND, 5)
        s_options.Add(self.tc_tag, 0, wx.ALL|wx.EXPAND, 5)
        s_options.Add(self.l_url, 0, wx.ALL|wx.EXPAND, 5)
        s_options.Add(self.tc_url, 0, wx.ALL|wx.EXPAND, 5)
        self.p_options.SetSizer(s_options)
        gs_photo.Add(self.p_options, 1, wx.ALL|wx.EXPAND, 20)
        self.panel.SetSizer(gs_photo)
        sizer.Add(self.panel, 1, wx.EXPAND, 0)
        self.SetSizer(sizer)
        sizer.Fit(self)
        self.Layout()
        # end wxGlade

# end of class Photo
    def OnCreatePhoto(self, evt):
    	self.source = self.tc_photourl.GetValue()
    	if not self.source:
    		self.source = None

    	self.data = self.b_browse.GetValue()
    	if not self.data:
    		self.data = None

    	self.caption = self.tc_caption.GetValue().encode('utf-8')
    	self.click  = self.tc_photolink.GetValue()
        self.tags = self.tc_tag.GetValue().encode('utf-8')
        self.tags = string.replace(self.tags,' ', ',')
        self.date = self.tc_date.GetValue().encode('utf-8')

        if self.cb_publishing.GetValue() == 'private':
        	self.private = 1
        else:
        	self.private = 0


        #self.format = None
        self.api = Api(self.api.name, self.api.email, self.api.password, self.private, self.date, self.tags)
    	try:
    		self.post = self.api.write_photo(self.source, self.data, self.caption, self.click)
    	except:
    		print "Posteado en el primario"
    	self.Close()

    def OnCancel(self, evt):
        self.Close()
Example #24
0
class Login(wx.Frame):
    def __init__(self, parent, id):
        # begin wxGlade: Login.__init__
        #kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, parent, id, style=wx.DEFAULT_FRAME_STYLE ^(wx.MAXIMIZE_BOX))
        self.panel = wx.Panel(self, -1)
        self.panel_login = wx.Panel(self.panel, -1, style=wx.DOUBLE_BORDER|wx.TAB_TRAVERSAL)
        self.l_tumblr = wx.StaticText(self, -1, "Tumblr", style=wx.ALIGN_CENTRE)
        self.l_login = wx.StaticText(self.panel_login, -1, "Log in")
        self.l_mail = wx.StaticText(self.panel_login, -1, "E-mail address")
        self.tc_mail = wx.TextCtrl(self.panel_login, -1, "")
        self.l_password = wx.StaticText(self.panel_login, -1, "Password")
        self.tc_password = wx.TextCtrl(self.panel_login, -1, "", style=wx.TE_PASSWORD)
        self.l_blog = wx.StaticText(self.panel_login, -1, "Blog")
        self.tc_blog = wx.TextCtrl(self.panel_login, -1, "")
        self.b_login = wx.Button(self.panel_login, -1, "Login")

        self.Bind(wx.EVT_BUTTON, self.OnAuthTumblr, id = self.b_login.GetId())
        self.__set_properties()
        self.__do_layout()
        # end wxGlade

    def __set_properties(self):
        # begin wxGlade: Login.__set_properties
        self.SetTitle("OpenTumblr")
        self.SetBackgroundColour(wx.Colour(55, 85, 113))
        self.SetForegroundColour(wx.Colour(55, 85, 113))
        self.l_tumblr.SetBackgroundColour(wx.Colour(55, 85, 113))
        self.l_tumblr.SetForegroundColour(wx.Colour(255, 255, 255))
        self.l_tumblr.SetFont(wx.Font(30, wx.SWISS, wx.NORMAL, wx.NORMAL, 0, ""))
        self.l_login.SetMinSize((74, 45))
        self.l_login.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.l_login.SetFont(wx.Font(25, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        self.l_mail.SetMinSize((260, 30))
        self.l_mail.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.l_mail.SetFont(wx.Font(20, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        self.tc_mail.SetMinSize((260, 30))
        self.tc_mail.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.tc_mail.SetFont(wx.Font(15, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        self.l_password.SetMinSize((260, 30))
        self.l_password.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.l_password.SetFont(wx.Font(20, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        self.tc_password.SetMinSize((260, 30))
        self.tc_password.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.tc_password.SetFont(wx.Font(15, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        self.l_blog.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.l_blog.SetFont(wx.Font(20, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.tc_blog.SetMinSize((260, 30))
        self.tc_blog.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.tc_blog.SetFont(wx.Font(15, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        self.panel_login.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.panel.SetBackgroundColour(wx.Colour(55, 85, 113))
        # end wxGlade

    def __do_layout(self):
        # begin wxGlade: Login.__do_layout
        sizer_1 = wx.BoxSizer(wx.VERTICAL)
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer_login = wx.BoxSizer(wx.VERTICAL)
        sizer_1.Add(self.l_tumblr, 0, wx.EXPAND|wx.ALIGN_CENTER_HORIZONTAL, 0)
        sizer_login.Add(self.l_login, 0, wx.ALL|wx.EXPAND, 5)
        sizer_login.Add(self.l_mail, 0, wx.ALL|wx.EXPAND, 10)
        sizer_login.Add(self.tc_mail, 0, wx.ALL|wx.EXPAND, 10)
        sizer_login.Add(self.l_password, 0, wx.ALL|wx.EXPAND, 10)
        sizer_login.Add(self.tc_password, 0, wx.ALL|wx.EXPAND, 10)
        sizer_login.Add(self.l_blog, 0, wx.ALL|wx.EXPAND, 10)
        sizer_login.Add(self.tc_blog, 0, wx.ALL|wx.EXPAND, 10)
        sizer_login.Add((30, 30), 0, wx.ALL|wx.EXPAND, 10)
        sizer_login.Add(self.b_login, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 10)
        self.panel_login.SetSizer(sizer_login)
        sizer.Add(self.panel_login, 1, wx.ALL|wx.EXPAND, 10)
        self.panel.SetSizer(sizer)
        sizer_1.Add(self.panel, 1, wx.EXPAND, 0)
        self.SetSizer(sizer_1)
        sizer_1.Fit(self)
        self.Layout()
        # end wxGlade

# end of class Login
    def OnAuthTumblr(self, event):
    	self.Blog = self.tc_blog.GetValue()
    	#if not self.Blog:
    		#self.Blog = ''
    		#assert False,self.Blog
    		#print "Conectado al blog primario: "
    	self.User = self.tc_mail.GetValue()
    	self.Password = self.tc_password.GetValue()
    	
    	self.api = Api(self.Blog, self.User, self.Password)
    	#assert False,dir(self.api)
    	try:
			self.auth = self.api.auth_check()
			self.panel.Destroy()
			self.dashboard = Dashboard(self, -1)
    		#print "Te haz logueado"
    	except opentumblr.tumblr.TumblrAuthError:
    		self.invalid = Invalid(self)
    		self.invalid.Show()
    		print errors['403']
    	except urllib2.HTTPError:
    		print errors['404']
    	except urllib2.URLError:
    		print errors['urlopen']