コード例 #1
0
def ShowPublishDialog(view=None, collection=None, modal=False, name=None,
                      account=None):
    filename = 'PublishCollection.xrc'
    title = _(u"Publish")

    isShared = sharing.isShared(collection)
    title = _(u"Manage Shared Collection") if isShared else _(u"Publish")

    xrcFile = os.path.join(Globals.chandlerDirectory,
                           'application', 'dialogs', filename)
    #[i18n] The wx XRC loading method is not able to handle raw 8bit paths
    #but can handle unicode
    xrcFile = unicode(xrcFile, sys.getfilesystemencoding())
    resources = wx.xrc.XmlResource(xrcFile)
    win = PublishCollectionDialog(title,
                                  resources=resources,
                                  view=view,
                                  collection=collection,
                                  modal=modal,
                                  name=name,
                                  account=account)
    win.CenterOnScreen()
    if modal:
        return win.ShowModal()
    else:
        win.Show()
        return win
コード例 #2
0
 def onFocusTogglePrivateEvent(self, event):
     """
     Toggle the "private" attribute of all the selected items
     or of the items specified in the optional arguments of the event.
     """
     selectedItems = self.__getSelectedItems(event)
     if len(selectedItems) > 0:
         # if any item is shared, give a warning if marking it private
         for item in selectedItems:
             if not item.private and sharing.isShared(item):
                 # Marking a shared item as "private" could act weird...
                 # Are you sure?
                 caption = _(u"Never Share This Item")
                 msg = _(u"Other people may be subscribed to this item; " \
                         "are you sure you want to mark it as private?")
                 if wx.MessageBox(msg,
                                  caption,
                                  style=wx.YES_NO,
                                  parent=wx.GetApp().mainFrame) == wx.YES:
                     break
                 else:
                     return
         # change the private state for all items selected
         for item in selectedItems:
             item.private = not item.private
コード例 #3
0
ファイル: PimBlocks.py プロジェクト: HackLinux/chandler
 def onFocusTogglePrivateEvent(self, event):
     """
     Toggle the "private" attribute of all the selected items
     or of the items specified in the optional arguments of the event.
     """
     selectedItems = self.__getSelectedItems(event)
     if len(selectedItems) > 0:
         # if any item is shared, give a warning if marking it private
         for item in selectedItems:
             if not item.private and sharing.isShared(item):
                 # Marking a shared item as "private" could act weird...
                 # Are you sure?
                 caption = _(u"Never Share This Item")
                 msg = _(u"Other people may be subscribed to this item; " \
                         "are you sure you want to mark it as private?")
                 if wx.MessageBox (msg, caption, style = wx.YES_NO,
                                   parent = wx.GetApp().mainFrame) == wx.YES:
                     break
                 else:
                     return
         # change the private state for all items selected
         for item in selectedItems:
             item.private = not item.private
コード例 #4
0
    def __init__(self, title, size=wx.DefaultSize,
                 pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE,
                 resources=None, view=None, collection=None,
                 modal=True, name=None, account=None):

        wx.Dialog.__init__(self, None, -1, title, pos, size, style)
        self.resources = resources
        self.view = view
        self.collection = collection    # The collection to share
        self.name = name
        self.account = account # use this account, overriding the default
        self.options = { }

        self.mySizer = wx.BoxSizer(wx.VERTICAL)

        # Turn on timezones
        notCancelled = ShowTurnOnTimezonesDialog(view,
                                                 modal=True,
                                                 state=PUBLISH,
                                                 parent=self)
        if notCancelled == False:
            self.OnCancel(None)
            return

        # Is this collection already shared?

        isShared = sharing.isShared(collection)

        if not isShared:       # Not yet shared, show "Publish"
            self.mainPanel = self.resources.LoadPanel(self,
                                                      "PublishCollection")
            self.buttonPanel = self.resources.LoadPanel(self,
                                                        "PublishButtonsPanel")
        else:                           # Already shared, show "Manage"
            self.mainPanel = self.resources.LoadPanel(self, "ManageCollection")
            self.buttonPanel = self.resources.LoadPanel(self,
                                                        "ManageButtonsPanel")


        # Create/Hide the status panel that appears when there is text to
        # display
        self.statusPanel = self.resources.LoadPanel(self, "StatusPanel")
        self.statusPanel.Hide()
        self.textStatus = wx.xrc.XRCCTRL(self, "TEXT_STATUS")

        self.updatePanel = self.resources.LoadPanel(self, "UpdatePanel")
        self.updatePanel.Hide()
        self.textUpdate = wx.xrc.XRCCTRL(self, "TEXT_UPDATE")
        self.gauge = wx.xrc.XRCCTRL(self, "GAUGE")
        self.gauge.SetRange(100)

        self.errorPanel = self.resources.LoadPanel(self, "ErrorPanel")
        self.errorPanel.Hide()
        self.Bind(wx.EVT_BUTTON, self.OnErrorDetails,
                  id=wx.xrc.XRCID("BUTTON_ERROR"))

        # Fit all the pieces together
        self.mySizer.Add(self.mainPanel, 0, wx.GROW|wx.ALL, 5)
        self.mySizer.Add(self.buttonPanel, 0, wx.GROW|wx.ALL, 5)
        self.SetSizer(self.mySizer)
        self.mySizer.SetSizeHints(self)
        self.mySizer.Fit(self)

        if not isShared:       # Not yet shared, show "Publish"
            self.ShowPublishPanel()
        else:                           # Already shared, show "Manage"
            self.ShowManagePanel()