Beispiel #1
0
 def __init__(self, parent):
     wx.Frame.__init__(self, parent, wx.ID_ANY, title="Trove Newspaper Harvester -- Help", size=(400,400))
     wx.Frame.SetIcon(self, icons.getNewsSmallIcon())
     toolbar = self.CreateToolBar()
     #toolbar.AddLabelTool(1, 'Exit', wx.Bitmap('icons/system-log-out.png'))
     toolbar.AddLabelTool(1, 'Exit', icons.getExitBitmap())
     toolbar.Realize()
     htmlWin = html.HtmlWindow(self, -1)
     htmlWin.SetPage(help.help_text)
     self.Bind(wx.EVT_TOOL, self.OnClose, id=1)
Beispiel #2
0
 def __init__(self, parent):
     wx.Frame.__init__(self,
                       parent,
                       wx.ID_ANY,
                       title="Trove Newspaper Harvester -- Help",
                       size=(400, 400))
     wx.Frame.SetIcon(self, icons.getNewsSmallIcon())
     toolbar = self.CreateToolBar()
     #toolbar.AddLabelTool(1, 'Exit', wx.Bitmap('icons/system-log-out.png'))
     toolbar.AddLabelTool(1, 'Exit', icons.getExitBitmap())
     toolbar.Realize()
     htmlWin = html.HtmlWindow(self, -1)
     htmlWin.SetPage(help.help_text)
     self.Bind(wx.EVT_TOOL, self.OnClose, id=1)
Beispiel #3
0
    def __init__(self, parent, id, title):
        '''
        Create the GUI.
        '''
        wx.Frame.__init__(self, parent, id, title, size=(600, 550))
        #icon = wx.Icon('icons/small-news.png', wx.BITMAP_TYPE_PNG, 16, 16)
        wx.Frame.SetIcon(self, icons.getNewsSmallIcon())
        self.requestQ = Queue.Queue()  #create queues
        self.resultQ = Queue.Queue()
        # Add menu
        menubar = wx.MenuBar()
        filemenu = wx.Menu()
        # File menu - Open and Exit
        menuOpen = wx.MenuItem(filemenu, wx.ID_OPEN, "&Open\tCtrl+O",
                               " Open an existing project")
        #menuOpen.SetBitmap(wx.Bitmap('icons/document-open.png'))
        menuExit = wx.MenuItem(filemenu, wx.ID_EXIT, "E&xit\tCtrl+X",
                               " Terminate the program")
        filemenu.AppendItem(menuOpen)
        filemenu.AppendItem(menuExit)
        menubar.Append(filemenu, '&File')
        # Help menu
        helpmenu = wx.Menu()
        menuAbout = helpmenu.Append(wx.ID_ABOUT, '&About',
                                    " Information about this program")
        menuHelp = helpmenu.Append(wx.ID_HELP, '&Help')
        menubar.Append(helpmenu, '&Help')

        self.SetMenuBar(menubar)
        self.Bind(wx.EVT_MENU, self.OnOpen, menuOpen)
        self.Bind(wx.EVT_MENU, self.OnAbout, menuAbout)
        self.Bind(wx.EVT_MENU, self.OnExit, menuExit)
        self.Bind(wx.EVT_MENU, self.OnHelp, menuHelp)
        #Add the various widgets
        panel = wx.Panel(self)
        vbox = wx.BoxSizer(wx.VERTICAL)
        # Project details box
        db = wx.StaticBox(panel, -1, label="Project details")
        vbox2 = wx.StaticBoxSizer(db, wx.VERTICAL)
        # Project name field
        hbox1 = wx.BoxSizer(wx.HORIZONTAL)
        label_1 = wx.StaticText(panel, -1, label='Name:')
        hbox1.Add(label_1, flag=wx.RIGHT, border=10)
        self.project_name = wx.TextCtrl(panel,
                                        -1,
                                        validator=TextObjectValidator('text'))
        hbox1.Add(self.project_name, proportion=1)
        # Project folder selector
        hbox1.Add((10, -1))
        label_2 = wx.StaticText(panel, -1, label='Folder:')
        hbox1.Add(label_2, flag=wx.RIGHT | wx.LEFT, border=10)
        self.directory = wx.DirPickerCtrl(panel,
                                          -1,
                                          style=wx.DIRP_USE_TEXTCTRL)
        hbox1.Add(self.directory)
        vbox2.Add(hbox1,
                  flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP,
                  border=10)
        # Extra space
        vbox2.Add((-1, 10))
        # URL field
        hbox3 = wx.BoxSizer(wx.HORIZONTAL)
        label_3 = wx.StaticText(panel, -1, label='Search URL:')
        hbox3.Add(label_3, flag=wx.RIGHT, border=8)
        self.url = wx.TextCtrl(panel, -1, validator=TextObjectValidator('url'))
        hbox3.Add(self.url, proportion=1)
        vbox2.Add(hbox3, proportion=1, flag=wx.EXPAND | wx.ALL, border=10)
        # Add the project details box
        vbox.Add(vbox2, flag=wx.EXPAND | wx.ALL, border=10)
        vbox.Add((-1, 10))
        # create options box
        sb = wx.StaticBox(panel, -1, label="Options")
        vbox3 = wx.StaticBoxSizer(sb, wx.VERTICAL)
        # Text checkbox
        hbox4 = wx.BoxSizer(wx.HORIZONTAL)
        self.save_text = wx.CheckBox(panel, -1, label='Save text')
        hbox4.Add(self.save_text, flag=wx.ALL, border=10)
        # PDF checkbox
        self.save_pdf = wx.CheckBox(panel, -1, label='Save pdf')
        hbox4.Add(self.save_pdf, flag=wx.ALL, border=10)
        vbox3.Add(hbox4)
        # Order files by options
        hbox5 = wx.BoxSizer(wx.HORIZONTAL)
        label_4 = wx.StaticText(panel, -1, label='Organise files by:')
        hbox5.Add(label_4, flag=wx.RIGHT, border=10)
        self.order_by = wx.ComboBox(panel,
                                    -1,
                                    choices=['year', 'newspaper'],
                                    value='year')
        hbox5.Add(self.order_by)
        vbox3.Add(hbox5, flag=wx.EXPAND | wx.ALL, border=10)
        # Start at
        hbox6 = wx.BoxSizer(wx.HORIZONTAL)
        label_5 = wx.StaticText(panel, -1, label='Start at result number:')
        hbox6.Add(label_5, flag=wx.RIGHT, border=10)
        self.start_at = wx.TextCtrl(panel, -1, value='0')
        hbox6.Add(self.start_at)
        vbox3.Add(hbox6, flag=wx.EXPAND | wx.ALL, border=10)
        # Add the options box
        vbox.Add(vbox3, flag=wx.EXPAND | wx.ALL, border=10)
        vbox.Add((-1, 10))
        # Add the GO! button
        hbox7 = wx.BoxSizer(wx.HORIZONTAL)
        self.go = wx.Button(panel, ID_BEGIN, 'GO!')
        hbox7.Add(self.go)
        vbox.Add(hbox7, flag=wx.ALIGN_RIGHT | wx.RIGHT, border=10)
        # Extra space
        vbox.Add((-1, 10))
        # Create the status box
        sm = wx.StaticBox(panel, -1, label="Status")
        vbox4 = wx.StaticBoxSizer(sm, wx.VERTICAL)
        # Add text area to contain status updates
        hbox9 = wx.BoxSizer(wx.HORIZONTAL)
        self.output_window = wx.TextCtrl(panel,
                                         -1,
                                         style=wx.TE_AUTO_SCROLL
                                         | wx.TE_MULTILINE | wx.TE_READONLY)
        hbox9.Add(self.output_window, proportion=1, flag=wx.EXPAND)
        vbox.Add(vbox4, proportion=1, flag=wx.EXPAND | wx.ALL, border=10)
        vbox4.Add(hbox9, proportion=1, flag=wx.ALL | wx.EXPAND, border=10)
        # Extra space
        vbox.Add((-1, 10))
        # Add all the widgets to the panel
        panel.SetSizer(vbox)
        # Create a timer for status updates
        self.output_window_timer = wx.Timer(self.output_window, -1)
        # Events
        wx.EVT_BUTTON(self, ID_BEGIN, self.OnBegin)
        self.output_window.Bind(EVT_STDDOUT, self.OnUpdateOutputWindow)
        self.output_window.Bind(wx.EVT_TIMER,
                                self.OnProcessPendingOutputWindowEvents)
        self.Bind(EVT_WORKER_DONE, self.OnWorkerDone)
        self.Bind(EVT_HARVEST_RESULT, self.OnHarvestResult)
        # Thread
        self.worker = Worker(self, self.requestQ, self.resultQ)
Beispiel #4
0
 def __init__(self, parent, id, title):
     '''
     Create the GUI.
     '''
     wx.Frame.__init__(self, parent, id, title, size=(600, 550))
     #icon = wx.Icon('icons/small-news.png', wx.BITMAP_TYPE_PNG, 16, 16)
     wx.Frame.SetIcon(self, icons.getNewsSmallIcon())
     self.requestQ = Queue.Queue() #create queues
     self.resultQ = Queue.Queue()
     # Add menu
     menubar = wx.MenuBar()
     filemenu = wx.Menu()
     # File menu - Open and Exit
     menuOpen = wx.MenuItem(filemenu, wx.ID_OPEN, "&Open\tCtrl+O"," Open an existing project")
     #menuOpen.SetBitmap(wx.Bitmap('icons/document-open.png'))
     menuExit = wx.MenuItem(filemenu, wx.ID_EXIT,"E&xit\tCtrl+X"," Terminate the program")
     filemenu.AppendItem(menuOpen)
     filemenu.AppendItem(menuExit)
     menubar.Append(filemenu, '&File')
     # Help menu
     helpmenu = wx.Menu()
     menuAbout = helpmenu.Append(wx.ID_ABOUT, '&About', " Information about this program")
     menuHelp = helpmenu.Append(wx.ID_HELP, '&Help')
     menubar.Append(helpmenu, '&Help')
     
     self.SetMenuBar(menubar)
     self.Bind(wx.EVT_MENU, self.OnOpen, menuOpen)
     self.Bind(wx.EVT_MENU, self.OnAbout, menuAbout)
     self.Bind(wx.EVT_MENU, self.OnExit, menuExit)
     self.Bind(wx.EVT_MENU, self.OnHelp, menuHelp)
     #Add the various widgets
     panel = wx.Panel(self)
     vbox = wx.BoxSizer(wx.VERTICAL)
     # Project details box
     db = wx.StaticBox(panel, -1, label="Project details")
     vbox2 = wx.StaticBoxSizer(db, wx.VERTICAL)
     # Project name field
     hbox1 = wx.BoxSizer(wx.HORIZONTAL)
     label_1 = wx.StaticText(panel, -1, label='Name:')
     hbox1.Add(label_1, flag=wx.RIGHT, border=10)
     self.project_name = wx.TextCtrl(panel,-1, validator = TextObjectValidator('text'))
     hbox1.Add(self.project_name, proportion=1)
     # Project folder selector
     hbox1.Add((10, -1))
     label_2 = wx.StaticText(panel, -1, label='Folder:')
     hbox1.Add(label_2, flag=wx.RIGHT|wx.LEFT, border=10)
     self.directory = wx.DirPickerCtrl(panel, -1, style=wx.DIRP_USE_TEXTCTRL)
     hbox1.Add(self.directory)
     vbox2.Add(hbox1, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=10)
     # Extra space
     vbox2.Add((-1, 10))
     # URL field
     hbox3 = wx.BoxSizer(wx.HORIZONTAL)
     label_3 = wx.StaticText(panel, -1, label='Search URL:')
     hbox3.Add(label_3, flag=wx.RIGHT, border=8)
     self.url = wx.TextCtrl(panel, -1, validator = TextObjectValidator('url'))
     hbox3.Add(self.url, proportion=1)
     vbox2.Add(hbox3, proportion=1, flag=wx.EXPAND|wx.ALL, border=10)
     # Add the project details box
     vbox.Add(vbox2, flag=wx.EXPAND|wx.ALL, border=10)
     vbox.Add((-1, 10))
     # create options box
     sb = wx.StaticBox(panel, -1, label="Options")
     vbox3 =wx.StaticBoxSizer(sb, wx.VERTICAL)
     # Text checkbox
     hbox4 = wx.BoxSizer(wx.HORIZONTAL)
     self.save_text = wx.CheckBox(panel, -1, label='Save text')
     hbox4.Add(self.save_text, flag=wx.ALL, border=10)
     # PDF checkbox
     self.save_pdf = wx.CheckBox(panel, -1, label='Save pdf')
     hbox4.Add(self.save_pdf, flag=wx.ALL, border=10)
     vbox3.Add(hbox4)
     # Order files by options
     hbox5 = wx.BoxSizer(wx.HORIZONTAL)
     label_4 = wx.StaticText(panel, -1, label='Organise files by:')
     hbox5.Add(label_4, flag=wx.RIGHT, border=10)
     self.order_by = wx.ComboBox(panel, -1, choices=['year','newspaper'], value='year')
     hbox5.Add(self.order_by)
     vbox3.Add(hbox5, flag=wx.EXPAND|wx.ALL, border=10)
     # Start at
     hbox6 = wx.BoxSizer(wx.HORIZONTAL)
     label_5 = wx.StaticText(panel, -1, label='Start at result number:')
     hbox6.Add(label_5, flag=wx.RIGHT, border=10)
     self.start_at = wx.TextCtrl(panel, -1, value='0')
     hbox6.Add(self.start_at)
     vbox3.Add(hbox6, flag=wx.EXPAND|wx.ALL, border=10)
     # Add the options box
     vbox.Add(vbox3, flag=wx.EXPAND|wx.ALL, border=10)
     vbox.Add((-1, 10))
     # Add the GO! button
     hbox7 = wx.BoxSizer(wx.HORIZONTAL)
     self.go = wx.Button(panel, ID_BEGIN, 'GO!')
     hbox7.Add(self.go)
     vbox.Add(hbox7, flag=wx.ALIGN_RIGHT|wx.RIGHT, border=10)
     # Extra space
     vbox.Add((-1, 10))
     # Create the status box
     sm = wx.StaticBox(panel, -1, label="Status")
     vbox4 = wx.StaticBoxSizer(sm, wx.VERTICAL)
     # Add text area to contain status updates
     hbox9 = wx.BoxSizer(wx.HORIZONTAL)
     self.output_window = wx.TextCtrl(panel, -1, style=wx.TE_AUTO_SCROLL|wx.TE_MULTILINE|wx.TE_READONLY)
     hbox9.Add(self.output_window, proportion=1, flag=wx.EXPAND)
     vbox.Add(vbox4, proportion=1, flag=wx.EXPAND|wx.ALL, border=10)
     vbox4.Add(hbox9, proportion=1, flag=wx.ALL|wx.EXPAND, border=10)
     # Extra space
     vbox.Add((-1, 10))
     # Add all the widgets to the panel
     panel.SetSizer(vbox)
     # Create a timer for status updates
     self.output_window_timer = wx.Timer(self.output_window, -1)
     # Events
     wx.EVT_BUTTON(self, ID_BEGIN, self.OnBegin)
     self.output_window.Bind(EVT_STDDOUT, self.OnUpdateOutputWindow)
     self.output_window.Bind(wx.EVT_TIMER, self.OnProcessPendingOutputWindowEvents)
     self.Bind(EVT_WORKER_DONE, self.OnWorkerDone)
     self.Bind(EVT_HARVEST_RESULT, self.OnHarvestResult)
     # Thread
     self.worker = Worker(self, self.requestQ, self.resultQ)