Пример #1
0
class BudgetFormAdmin(ModelFormWidget):

    MODEL = Budget
    TITLE = 'Suppliers'

    FIELDSETS = [
        'expensecode',
        no_columns('year', 'amount'),
    ]

    AUTHORIZED_GROUPS = ['superuser']
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self._start = ControlDate('Start')
        self._end = ControlDate('End')
        self._groups = ControlAutoComplete('Groups',
                                           multiple=True,
                                           queryset=Group.objects.all())
        self._costcenters = ControlAutoComplete(
            'Cost centers', multiple=True, queryset=CostCenter.objects.all())
        self._projects = ControlAutoComplete('Projects',
                                             multiple=True,
                                             queryset=Project.objects.all())
        self._applybtn = ControlButton('Apply', default=self.populate_report)

        self._updategraphs_btn = ControlButton('Update graphs',
                                               default=self.populate_graphs)
        self._projs_pie = ControlPieChart('Projects')
        self._grps_pie = ControlPieChart('Groups')
        self._fellow_pie = ControlPieChart('Fellowship type')
        self._amount_chart = ControlBarsChart('Amount per date')

        self._list = ControlQueryList(
            'List',
            rows_per_page=15,
            headers=[
                'Person', 'Contract:Start', 'Contract:Until',
                'Contract:Salary', 'Contract:Ref', 'Contract:Position',
                'Contract:Fellowship type', 'Contract:Fellowship ref',
                'Paid:Amount', 'Paid:Start', 'Paid:Until', 'Paid:Req. num.',
                'Paid:Req. created', 'C.C. Group', 'C.C.', 'Proj.', 'Grant'
            ],
            list_display=[
                'contract__person', 'contract__start', 'contract__end',
                'contract__salary', 'contract__ref', 'contract__position',
                'contract__fellowship_type', 'contract__fellowship_ref',
                'total', 'start', 'end', 'order__requisition_number',
                'order__requisition_date', 'project__costcenter__group',
                'project__costcenter__code', 'project__code', 'project__grant'
            ])

        self.formset = [
            no_columns('_start', '_end', '_groups', '_costcenters',
                       '_projects', '_applybtn'),
            segment('_list'),
            (segment('h2:Amount per projects', '_projs_pie', css='overflow'),
             segment('h2:Amount per groups', '_grps_pie', css='overflow')),
            (segment('h2:Amount per fellowship', '_fellow_pie',
                     css='overflow'), ' '),
            segment('_amount_chart', css='overflow'),
        ]
Пример #3
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self._repos = ControlCheckBoxList('Repositories',
                                          headers=['', 'Repositories paths'])
        self._authors = ControlCheckBoxList(
            'Authors', headers=['', 'Author name', 'Email'])
        self._load = ControlButton('Load', default=self.load_data)
        self._save = ControlButton('Save', default=self.save_data)

        self.formset = [no_columns('_load', '_save'), '_repos', '_authors']

        if os.path.exists(self.CONF_FILENAME):
            with open(self.CONF_FILENAME, 'r') as infile:
                self._repos.value, self._authors.value = json.load(infile)
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self._start       = ControlDate('Start')
        self._end         = ControlDate('End')
        self._period      = ControlCombo('Period', items=[('Yearly', YEARLY),('Monthly', MONTHLY)], default=YEARLY)
        self._applybtn    = ControlButton('Apply', default=self.populate_graphs)

        self._people_chart  = ControlBarsChart('People per year')
        self._growth0_chart = ControlLineChart('Growth per year')
        
        self._nation_chart  = ControlPieChart('Nationalities')

        self.formset = [
            no_columns('_start', '_end','_applybtn'),
            segment('h2:People','_people_chart', css='overflow'),
            segment('h2:Growth (people)','_growth0_chart', css='overflow'),
            segment('h2:Nationalities','_nation_chart', css='overflow'),
        ]
Пример #5
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self._since = ControlDate('Since')
        self._until = ControlDate('Until')
        self._bars = ControlBarsChart('Graph')
        self._pie = ControlPieChart('Graph')
        self._apply = ControlButton('Apply', default=self.populate_graphs)
        self._lastweeks = ControlButton('Last 7 weeks',
                                        default=self.populate_last_7weeks,
                                        css='basic')
        self._open_conf = ControlButton('Config',
                                        default=self.open_conf_evt,
                                        css='basic red')

        self.formset = [
            no_columns('_open_conf', '_since', '_until', '_lastweeks',
                       '_apply'),
            '_bars',
            segment('_pie', css='overflow'),
        ]
Пример #6
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self._startyear = ControlInteger('Start year')
        self._endyear = ControlInteger('End year')
        self._keypubs = ControlCheckBox('Pub. types', default=False)
        self._pubtypes = ControlAutoComplete('Publications types',
                                             multiple=True,
                                             queryset=PubType.objects.all())
        self._applybtn = ControlButton('Apply', default=self.populate_graph)

        self._linegraph = ControlLineChart('Publications per year')
        #self._journalschart = ControlPieChart('Publications per journal')
        self._journalslist = ControlList(
            'Publications per journal',
            horizontal_headers=['Journals', 'N pubs', '%'])

        self.formset = [
            no_columns('_startyear', '_endyear', '_pubtypes', '_keypubs',
                       '_applybtn'),
            segment('_linegraph'), '_journalslist'
        ]
Пример #7
0
    def __init__(self,
                 title,
                 msg,
                 buttons,
                 handler,
                 msg_type,
                 parent_win=None):
        BaseWidget.__init__(self, title, parent_win=parent_win)

        self._label = ControlLabel(default=msg)
        #self._label.css = msg_type

        if buttons:
            buttons_formset = []
            for i, b in enumerate(buttons):
                name = 'button_{0}'.format(i)
                setattr(self, name, ControlButton(b))
                getattr(self, name).value = make_lambda_func(handler,
                                                             popup=self,
                                                             button=b)
                buttons_formset.append(name)

        self.formset = ['_label'] + [no_columns(buttons_formset)]
Пример #8
0
 def get_toolbar_buttons(self, *args, **kwargs):
     add_btn = super().get_toolbar_buttons(*args, **kwargs)
     return no_columns(add_btn, '_import_btn')
Пример #9
0
class PublicationFormWidget(ModelFormWidget):

    LAYOUT_POSITION = conf.ORQUESTRA_NEW_TAB

    HAS_CANCEL_BTN_ON_EDIT = False
    CLOSE_ON_REMOVE = True

    FIELDSETS = [
        no_columns('publication_keypub', 'publication_active'),
        ' ',
        {
            '1:Required Fields': [
                ('pubtype', 'publication_year', 'journal', '_addjounalbtn'),
                'publication_title',
                'publication_authors',
                'authors',
            ],
            '2:Optional Fields': [
                (
                    'publication_doi',
                    'publication_pmid',
                    'publication_web',
                ),
                (
                    'publication_received',
                    'publication_accepted',
                    'publication_publish',
                    'publication_volume',
                    'publication_issue',
                    'publication_pages',
                ),
            ],
            '3:Abstract': [
                'publication_abstract',
            ],
            '4:Book Information': [
                'publication_book',
                ('publication_company', 'publication_editors'),
            ],
            '5:Attachments': [
                'publication_file',
            ],
        },
    ]

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self._addjounalbtn = ControlButton(
            '<i class="ui icon newspaper outline"></i>Add journal',
            default=self.__add_journal_btn_evt)

    def __add_journal_btn_evt(self):
        JournalFormWidget()

    @property
    def title(self):
        obj = self.model_object
        if obj is None:
            return ModelFormWidget.title.fget(self)
        else:
            return "Publication: {0}".format(obj.publication_title)

    @title.setter
    def title(self, value):
        ModelFormWidget.title.fset(self, value)