Пример #1
0
    def __init__(self):
    
        buxpaper.Window.__init__(self)
        
        self.index = 0
        
        self.sleepButton.clicked.connect(self.setSleepImage)
        self.sleepButton.show()
        
        browserIcon = buxpaper.icon_from_commands(buxpaper.browser_icon,
            self.closeButton.sizeHint().width(), self.closeButton.sizeHint().height())
        
        # Add a button for accessing the image browser.
        self.browserButton = buxpaper.Button(browserIcon)
        self.browserButton.clicked.connect(self.showBrowser)
        self.panel.addWidget(self.browserButton)
        
        # Add a button for accessing the adjustment panel.
        self.adjustImageWindow = AdjustImageWindow()
        self.adjustImageWindow.increaseBrightness.connect(self.increaseBrightness)
        self.adjustImageWindow.decreaseBrightness.connect(self.decreaseBrightness)
        self.adjustImageWindow.increaseContrast.connect(self.increaseContrast)
        self.adjustImageWindow.decreaseContrast.connect(self.decreaseContrast)
        self.adjustImageWindow.saveSettings.connect(self.saveSettings)
        
        self.adjustImageButton = buxpaper.Button(u"A")
        self.adjustImageButton.clicked.connect(self.adjustImage)
        self.panel.addWidget(self.adjustImageButton)
        
        self.saveThumbnailButton = buxpaper.Button(u"T")
        self.saveThumbnailButton.clicked.connect(self.saveThumbnail)
        self.saveThumbnailButton.hide()
        self.panel.addWidget(self.saveThumbnailButton)
        
        # Add a zoom button to the panel.
        self.zoomOutButton = buxpaper.Button("-")
        self.zoomOutButton.clicked.connect(self.zoomOut)
        self.panel.addWidget(self.zoomOutButton)

        self.previousButton = buxpaper.Button(u"\u25c4")
        self.previousButton.clicked.connect(self.previousPage)
        self.panel.addWidget(self.previousButton)
        
        self.nextButton = buxpaper.Button(u"\u25ba")
        self.nextButton.clicked.connect(self.nextPage)
        self.panel.addWidget(self.nextButton)
        
        self.config = buxpaper.Config(buxpaper.settings + "-gallery")
        self.config.load()
        
        # Use a stacked layout inside the main content widget.
        layout = QStackedLayout(self.contentWidget)
        layout.setContentsMargins(0, 0, 0, 0)
        self.createBrowserPage()
        layout.addWidget(self.browserPage)
        self.createPreviewPage()
        layout.addWidget(self.previewPage)
        
        self.showBrowser()
Пример #2
0
 def __init__(self, parent = None):
 
     QWidget.__init__(self, parent)
     
     self.pressed = False
     self.setFont(QApplication.font())
     
     self.document = None
     self.page = 0
     self.paragraphs = []
     self.paragraph_index = [(0, 0)]
     self.image = QImage()
     
     self.config = buxpaper.Config(buxpaper.settings + "-reader")
     self.config.load()
Пример #3
0
    def __init__(self):

        buxpaper.Window.__init__(self)

        self.editing = False

        self.sleepButton.clicked.connect(self.setSleepImage)
        self.sleepButton.show()

        self.previousButton = buxpaper.Button(u"\u25c4")
        self.previousButton.clicked.connect(self.previousMonth)
        self.panel.addWidget(self.previousButton)

        self.nextButton = buxpaper.Button(u"\u25ba")
        self.nextButton.clicked.connect(self.nextMonth)
        self.panel.addWidget(self.nextButton)

        self.config = buxpaper.Config(
            os.path.join(CalendarDir, "calendar.json"))
        self.config.load()

        self.label_format = self.config.get("Label format", self.LabelFormat)
        self.current_label_colour = self.config.get("Current label colour",
                                                    self.CurrentLabelColour)
        self.appointment_label_colour = self.config.get(
            "Appointment label colour", self.AppointmentLabelColour)

        self.appointments = self.config.get("Appointments", {})

        # Use a stacked layout inside the main content widget.
        layout = QStackedLayout(self.contentWidget)
        layout.setContentsMargins(0, 0, 0, 0)
        self.createMonthPage()
        layout.addWidget(self.monthPage)
        self.createDayPage()
        layout.addWidget(self.dayPage)

        today = datetime.date.today()
        self.showMonth(today.year, today.month)
Пример #4
0
 def __init__(self):
 
     buxpaper.Window.__init__(self)
     
     self.config = buxpaper.Config(buxpaper.settings + "-launcher")
     self.config.load()
     
     self.this_appdir = os.path.abspath(os.path.split(__file__)[0])
     
     self.process = None
     self.processLabel = None
     
     # Hide the close button.
     self.closeButton.hide()
     
     # Add a power status indicator.
     self.statusWidget = StatusWidget()
     self.panel.insertWidget(0, self.statusWidget)
     
     # Add buttons to the panel.
     self.previousButton = buxpaper.Button(u"\u25c4")
     self.previousButton.clicked.connect(self.previousPage)
     self.panel.addWidget(self.previousButton)
     
     self.nextButton = buxpaper.Button(u"\u25ba")
     self.nextButton.clicked.connect(self.nextPage)
     self.panel.addWidget(self.nextButton)
     
     # Create widgets inside the content widget.
     self.pages = QStackedWidget()
     
     layout = QVBoxLayout(self.contentWidget)
     layout.addWidget(self.pages)
     
     self.loadApplicationDetails()
     self.statusWidget.updateStatus()
     self.updateButtons()
Пример #5
0
    def __init__(self):

        buxpaper.Window.__init__(self)

        self.config = buxpaper.Config(buxpaper.settings + "-sketch")
        self.config.load()

        self.viewer = Viewer(self.config)
        self.currentTime = time.time()

        self.documentList = DocumentChooser(self.config)
        self.documentList.chosen.connect(self.openDocument)

        # Add buttons to the panel.
        self.sleepButton.clicked.connect(self.setSleepImage)
        self.sleepButton.show()

        browserIcon = buxpaper.icon_from_commands(
            buxpaper.browser_icon,
            self.closeButton.sizeHint().width(),
            self.closeButton.sizeHint().height())

        # Viewer buttons

        # Add a button for accessing the image browser.
        self.browserButton = buxpaper.Button(browserIcon)
        self.browserButton.clicked.connect(self.showBrowser)
        self.panel.addWidget(self.browserButton)

        self.annotateButton = buxpaper.Button(u"T")
        self.annotateButton.clicked.connect(self.annotateDocument)
        self.panel.addWidget(self.annotateButton)

        self.clearButton = buxpaper.Button(u"\u2718")
        self.clearButton.clicked.connect(self.clearDocument)
        self.panel.addWidget(self.clearButton)

        self.storeButton = buxpaper.Button(u"\u2714")
        self.storeButton.setEnabled(False)
        self.storeButton.clicked.connect(self.storeDocument)
        self.viewer.saved.connect(self.storeButton.setDisabled)
        self.panel.addWidget(self.storeButton)

        # Browser buttons

        # Add a button to allow creation of a new document.
        self.newButton = buxpaper.Button(u"+")
        self.newButton.clicked.connect(self.newDocument)
        self.panel.addWidget(self.newButton)

        # Add navigation buttons.
        self.previousButton = buxpaper.Button(u"\u25c4")
        self.previousButton.clicked.connect(self.previousPage)
        self.panel.addWidget(self.previousButton)
        self.documentList.hasPrevious.connect(self.previousButton.setEnabled)
        self.viewer.hasPrevious.connect(self.previousButton.setEnabled)
        self.viewer.changed.connect(self.sleepButton.setEnabled)
        self.viewer.changed.connect(self.storeButton.setEnabled)

        self.nextButton = buxpaper.Button(u"\u25ba")
        self.nextButton.clicked.connect(self.nextPage)
        self.panel.addWidget(self.nextButton)
        self.documentList.hasNext.connect(self.nextButton.setEnabled)
        self.viewer.hasNext.connect(self.nextButton.setEnabled)

        layout = QStackedLayout(self.contentWidget)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(self.viewer)
        layout.addWidget(self.documentList)

        self.documentList.loadDocumentDetails()

        # Wait until the window has been given its final geometry before
        # attempting to lay out the browser.
        QTimer.singleShot(0, self.showBrowser)