Restructure project #3

Merged
h7x4 merged 10 commits from restructure-project into master 2023-09-02 21:18:04 +02:00
16 changed files with 22 additions and 32 deletions
Showing only changes of commit 006c010907 - Show all commits

View File

@ -5,7 +5,7 @@ import signal
from sqlalchemy import or_, and_ from sqlalchemy import or_, and_
from .models import User, Product from ..models import User, Product
def search_user(string, session, ignorethisflag=None): def search_user(string, session, ignorethisflag=None):
string = string.lower() string = string.lower()

View File

@ -5,8 +5,8 @@ import datetime
from collections import defaultdict from collections import defaultdict
from .helpers import * from .helpers import *
from .models import Transaction from ..models import Transaction
from .db import Session from ..db import Session
def getUser(): def getUser():
while 1: while 1:

View File

@ -35,15 +35,15 @@ def main():
config.read(args.config) config.read(args.config)
if args.subcommand == 'loop': if args.subcommand == 'loop':
import dibbler.text_based as text_based import dibbler.subcommands.loop as loop
text_based.main() loop.main()
elif args.subcommand == 'create-db': elif args.subcommand == 'create-db':
import dibbler.scripts.makedb as makedb import dibbler.subcommands.makedb as makedb
makedb.main() makedb.main()
elif args.subcommand == 'slabbedasker': elif args.subcommand == 'slabbedasker':
import dibbler.scripts.slabbedasker as slabbedasker import dibbler.subcommands.slabbedasker as slabbedasker
slabbedasker.main() slabbedasker.main()

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
from .addstock import AddStockMenu from .addstock import AddStockMenu
from .buymenu import BuyMenu from .buymenu import BuyMenu
from .editing import ( from .editing import (
@ -28,10 +26,3 @@ from .stats import (
BalanceMenu, BalanceMenu,
LoggedStatisticsMenu LoggedStatisticsMenu
) )
exit_commands = ['exit', 'abort', 'quit', 'bye', 'eat flaming death', 'q']
help_commands = ['help', '?']
context_commands = ['what', '??']
local_help_commands = ['help!', '???']
faq_commands = ['faq']
restart_commands = ['restart']

View File

@ -7,19 +7,17 @@ from select import select
from dibbler.db import Session from dibbler.db import Session
from dibbler.models import User from dibbler.models import User
from dibbler.helpers import ( from dibbler.lib.helpers import (
search_user, search_user,
search_product, search_product,
guess_data_type, guess_data_type,
argmax, argmax,
) )
from . import ( exit_commands = ['exit', 'abort', 'quit', 'bye', 'eat flaming death', 'q']
context_commands, help_commands = ['help', '?']
local_help_commands, context_commands = ['what', '??']
help_commands, local_help_commands = ['help!', '???']
exit_commands,
)
class ExitMenu(Exception): class ExitMenu(Exception):

View File

@ -6,11 +6,12 @@ import sys
from dibbler.db import Session from dibbler.db import Session
from . import faq_commands, restart_commands
from .buymenu import BuyMenu from .buymenu import BuyMenu
from .faq import FAQMenu from .faq import FAQMenu
from .helpermenus import Menu from .helpermenus import Menu
faq_commands = ['faq']
restart_commands = ['restart']
def restart(): def restart():
# Does not work if the script is not executable, or if it was # Does not work if the script is not executable, or if it was

View File

@ -2,7 +2,7 @@ import sqlalchemy
from dibbler.conf import config from dibbler.conf import config
from dibbler.models import Transaction, Product, User from dibbler.models import Transaction, Product, User
from dibbler.helpers import less from dibbler.lib.helpers import less
from .helpermenus import Menu, Selector from .helpermenus import Menu, Selector

View File

@ -2,7 +2,7 @@ import re
from dibbler.conf import config from dibbler.conf import config
from dibbler.models import Product, User from dibbler.models import Product, User
from dibbler.printer_helpers import print_bar_code, print_name_label from dibbler.lib.printer_helpers import print_bar_code, print_name_label
from .helpermenus import Menu from .helpermenus import Menu

View File

@ -1,8 +1,8 @@
from sqlalchemy import desc, func from sqlalchemy import desc, func
from dibbler.helpers import less from dibbler.lib.helpers import less
from dibbler.models import PurchaseEntry, Product, User from dibbler.models import PurchaseEntry, Product, User
from dibbler.statistikkHelpers import statisticsTextOnly from dibbler.lib.statistikkHelpers import statisticsTextOnly
from .helpermenus import Menu from .helpermenus import Menu

View File

@ -5,9 +5,9 @@ import random
import sys import sys
import traceback import traceback
from .conf import config from ..conf import config
from .helpers import * from ..lib.helpers import *
from .menus import * from ..menus import *
random.seed() random.seed()

View File

@ -4,7 +4,7 @@
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import matplotlib.dates as mdates import matplotlib.dates as mdates
from dibbler.statistikkHelpers import * from dibbler.lib.statistikkHelpers import *
def getInputType(): def getInputType():
inp = 0 inp = 0